From: Flavio Tordini Date: Sun, 25 Jul 2010 14:54:43 +0000 (+0200) Subject: Better constants definition X-Git-Tag: 1.2~43 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=baf9c79fa63d3236b15f9a5a977bd532fb592f0d;p=minitube Better constants definition --- diff --git a/minitube.pro b/minitube.pro index 09f3649..f515b32 100755 --- a/minitube.pro +++ b/minitube.pro @@ -1,14 +1,13 @@ -INCLUDEPATH += /usr/include/phonon CONFIG += release TEMPLATE = app +VERSION=1.0.1 +DEFINES += APP_VERSION="$$VERSION" +INCLUDEPATH += /usr/include/phonon # TODO Saner string behaviour # DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_STRICT_ITERATORS TARGET = minitube -mac { - TARGET = Minitube - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 -} + QT += network \ xml \ phonon @@ -25,7 +24,7 @@ HEADERS += src/MainWindow.h \ src/searchlineedit.h \ src/urllineedit.h \ src/spacer.h \ - src/Constants.h \ + src/constants.h \ src/iconloader/qticonloader.h \ src/faderwidget/FaderWidget.h \ src/ListModel.h \ @@ -69,7 +68,8 @@ SOURCES += src/main.cpp \ src/googlesuggest.cpp \ src/videowidget.cpp \ src/flickcharm.cpp \ - src/videodefinition.cpp + src/videodefinition.cpp \ + src/constants.cpp RESOURCES += resources.qrc DESTDIR = build/target/ OBJECTS_DIR = build/obj/ @@ -84,13 +84,8 @@ include(locale/locale.pri) # deploy DISTFILES += CHANGES \ COPYING -mac { - CONFIG += x86 \ - ppc - QMAKE_INFO_PLIST = Info.plist - ICON = minitube.icns -} -unix { + +unix { isEmpty(PREFIX):PREFIX = /usr BINDIR = $$PREFIX/bin INSTALLS += target @@ -103,11 +98,13 @@ unix { desktop \ iconsvg \ icon16 \ + icon22 \ icon32 \ icon48 \ icon64 \ icon128 \ - icon256 + icon256 \ + icon512 translations.path = $$PKGDATADIR translations.files += $$DESTDIR/locale desktop.path = $$DATADIR/applications @@ -116,6 +113,8 @@ unix { iconsvg.files += data/minitube.svg icon16.path = $$DATADIR/icons/hicolor/16x16/apps icon16.files += data/16x16/minitube.png + icon22.path = $$DATADIR/icons/hicolor/22x22/apps + icon22.files += data/22x22/minitube.png icon32.path = $$DATADIR/icons/hicolor/32x32/apps icon32.files += data/32x32/minitube.png icon48.path = $$DATADIR/icons/hicolor/48x48/apps @@ -126,5 +125,6 @@ unix { icon128.files += data/128x128/minitube.png icon256.path = $$DATADIR/icons/hicolor/256x256/apps icon256.files += data/256x256/minitube.png + icon256.path = $$DATADIR/icons/hicolor/512x512/apps + icon256.files += data/256x256/minitube.png } -win32:RC_FILE = minitube.rc diff --git a/src/AboutView.cpp b/src/AboutView.cpp index e9357ea..d8541ef 100644 --- a/src/AboutView.cpp +++ b/src/AboutView.cpp @@ -1,5 +1,5 @@ #include "AboutView.h" -#include "Constants.h" +#include "constants.h" AboutView::AboutView(QWidget *parent) : QWidget(parent) { diff --git a/src/AboutView.h b/src/AboutView.h index ba5fb7f..d411733 100644 --- a/src/AboutView.h +++ b/src/AboutView.h @@ -3,7 +3,7 @@ #include #include "View.h" -#include "Constants.h" +#include "constants.h" class AboutView : public QWidget, public View { diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 31398c4..b785fc1 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1,6 +1,6 @@ #include "MainWindow.h" #include "spacer.h" -#include "Constants.h" +#include "constants.h" #include "iconloader/qticonloader.h" #include "global.h" #include "videodefinition.h" diff --git a/src/SearchView.cpp b/src/SearchView.cpp index 191b1bd..8c0db9c 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -1,5 +1,5 @@ #include "SearchView.h" -#include "Constants.h" +#include "constants.h" namespace The { QMap* globalActions(); diff --git a/src/constants.cpp b/src/constants.cpp new file mode 100644 index 0000000..cabca3a --- /dev/null +++ b/src/constants.cpp @@ -0,0 +1,11 @@ +#include "constants.h" + +#define STR(x) #x +#define STRINGIFY(x) STR(x) + +const char *Constants::VERSION = STRINGIFY(APP_VERSION); +const char *Constants::APP_NAME = "Minitube"; +const char *Constants::ORG_NAME = "Flavio Tordini"; +const char *Constants::ORG_DOMAIN = "flavio.tordini.org"; +const char *Constants::WEBSITE = "http://flavio.tordini.org/minitube"; +const char *Constants::EMAIL = "flavio.tordini@gmail.com"; diff --git a/src/constants.h b/src/constants.h new file mode 100755 index 0000000..f26a313 --- /dev/null +++ b/src/constants.h @@ -0,0 +1,20 @@ +#ifndef CONSTANTS_H +#define CONSTANTS_H + +#include + +class Constants { + +public: + + static const char *VERSION; + static const char *APP_NAME; + static const char *ORG_NAME; + static const char *ORG_DOMAIN; + static const char *WEBSITE; + static const char *EMAIL; + static const QString USER_AGENT; + +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index a0b87be..1a3c102 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ #include #include -#include "Constants.h" +#include "constants.h" #include "MainWindow.h" int main(int argc, char **argv) { diff --git a/src/networkaccess.cpp b/src/networkaccess.cpp index 47d09df..378cb1a 100644 --- a/src/networkaccess.cpp +++ b/src/networkaccess.cpp @@ -1,11 +1,15 @@ #include "networkaccess.h" -#include "Constants.h" +#include "constants.h" #include namespace The { NetworkAccess* http(); } +const QString USER_AGENT = QString(Constants::APP_NAME) + + " " + Constants::VERSION + + " (" + Constants::WEBSITE + ")"; + NetworkReply::NetworkReply(QNetworkReply *networkReply) : QObject(networkReply) { this->networkReply = networkReply; } @@ -55,7 +59,7 @@ QNetworkReply* NetworkAccess::simpleGet(QUrl url, int operation) { QNetworkAccessManager *manager = The::networkAccessManager(); QNetworkRequest request(url); - request.setRawHeader("User-Agent", Constants::USER_AGENT.toUtf8()); + request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); request.setRawHeader("Connection", "Keep-Alive"); QNetworkReply *networkReply; diff --git a/src/updatechecker.cpp b/src/updatechecker.cpp index 35c4639..f8d381d 100644 --- a/src/updatechecker.cpp +++ b/src/updatechecker.cpp @@ -1,6 +1,6 @@ #include "updatechecker.h" #include "networkaccess.h" -#include "Constants.h" +#include "constants.h" namespace The { NetworkAccess* http(); diff --git a/src/youtubesearch.cpp b/src/youtubesearch.cpp index 664240b..45b2ad4 100644 --- a/src/youtubesearch.cpp +++ b/src/youtubesearch.cpp @@ -1,6 +1,6 @@ #include "youtubesearch.h" #include "youtubestreamreader.h" -#include "Constants.h" +#include "constants.h" #include "networkaccess.h" namespace The {