]> git.sur5r.net Git - minitube/commitdiff
Better constants definition
authorFlavio Tordini <flavio.tordini@gmail.com>
Sun, 25 Jul 2010 14:54:43 +0000 (16:54 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Sun, 25 Jul 2010 14:54:43 +0000 (16:54 +0200)
minitube.pro
src/AboutView.cpp
src/AboutView.h
src/MainWindow.cpp
src/SearchView.cpp
src/constants.cpp [new file with mode: 0644]
src/constants.h [new file with mode: 0755]
src/main.cpp
src/networkaccess.cpp
src/updatechecker.cpp
src/youtubesearch.cpp

index 09f3649fcbd319e4158f2848e44084fd519de98f..f515b328c1457324e7e8fdaf89562d7347f61844 100755 (executable)
@@ -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
index e9357ea577e8a1f5f09443d2c8ee5a6f447301de..d8541eff8af68eae5ca7fc34998aec4d55f284e7 100644 (file)
@@ -1,5 +1,5 @@
 #include "AboutView.h"
-#include "Constants.h"
+#include "constants.h"
 
 AboutView::AboutView(QWidget *parent) : QWidget(parent) {
 
index ba5fb7f87cf24265f6c1f778d4002216a210fc02..d4117338244ba72d11cc9479de09108d3d2df80d 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <QtGui>
 #include "View.h"
-#include "Constants.h"
+#include "constants.h"
 
 class AboutView : public QWidget, public View {
 
index 31398c4abdbd379bd91faa0c6b8c93be94270390..b785fc1d06e7e9e7832a3ae24bb24b94756d2d52 100755 (executable)
@@ -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"
index 191b1bdaabe80579218a2dc2665a4fc7ebb59510..8c0db9c1316d35be4cd01f35e344ff762e205704 100644 (file)
@@ -1,5 +1,5 @@
 #include "SearchView.h"
-#include "Constants.h"
+#include "constants.h"
 
 namespace The {
     QMap<QString, QAction*>* globalActions();
diff --git a/src/constants.cpp b/src/constants.cpp
new file mode 100644 (file)
index 0000000..cabca3a
--- /dev/null
@@ -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 (executable)
index 0000000..f26a313
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef CONSTANTS_H
+#define CONSTANTS_H
+
+#include <QString>
+
+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
index a0b87be0faa379fa5b6684170e2aa2fc919e0920..1a3c102ddf868a00d32f2cd6eaad79964a0fe61d 100755 (executable)
@@ -1,6 +1,6 @@
 #include <QtGui>
 #include <qtsingleapplication.h>
-#include "Constants.h"
+#include "constants.h"
 #include "MainWindow.h"
 
 int main(int argc, char **argv) {
index 47d09df54ea9fafe7aa127021d7d26f7b0793b6c..378cb1a80fd51e9573e27b2e778ef6dc46141d1e 100644 (file)
@@ -1,11 +1,15 @@
 #include "networkaccess.h"
-#include "Constants.h"
+#include "constants.h"
 #include <QtGui>
 
 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;
index 35c4639dc2b937ea34f22fbde156117337ebda8d..f8d381d2ecca99d7ecdfcaa182281a1e20bd0a81 100644 (file)
@@ -1,6 +1,6 @@
 #include "updatechecker.h"
 #include "networkaccess.h"
-#include "Constants.h"
+#include "constants.h"
 
 namespace The {
     NetworkAccess* http();
index 664240b4fc62e11b705f111c303b467e3ffbe695..45b2ad457e251aa8faa94a52514c16647ec25bf1 100644 (file)
@@ -1,6 +1,6 @@
 #include "youtubesearch.h"
 #include "youtubestreamreader.h"
-#include "Constants.h"
+#include "constants.h"
 #include "networkaccess.h"
 
 namespace The {