diff --git a/src/defines.pri b/src/defines.pri index c21413b65..46edb6b4d 100644 --- a/src/defines.pri +++ b/src/defines.pri @@ -9,6 +9,7 @@ UI_DIR = $$PWD/../build mocinclude.CONFIG *= fix_target unix: VERSION = 1.7.0 +DEFINES *= QUPZILLA_VERSION=\\\"""$$VERSION"\\\"" # Please read BUILD information # #DEFINES *= PORTABLE_BUILD diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index 01a071437..adf0bfded 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -63,7 +63,7 @@ void CommandLineOptions::showHelp() " For more information please visit wiki at \n" " https://github.com/QupZilla/qupzilla/wiki \n"; - cout << help << " > " << Qz::WWWADDRESS.toUtf8().data() << endl; + cout << help << " > " << Qz::WWWADDRESS << endl; } void CommandLineOptions::parseActions() @@ -97,11 +97,11 @@ void CommandLineOptions::parseActions() } if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) { - cout << "QupZilla v" << Qz::VERSION.toUtf8().data() + cout << "QupZilla v" << Qz::VERSION #ifdef GIT_REVISION << " rev " << GIT_REVISION << " " #endif - << "(build " << Qz::BUILDTIME.toUtf8().data() << ")" + << "(build " << Qz::BUILDTIME << ")" << endl; ActionPair pair; pair.action = Qz::CL_ExitAction; diff --git a/src/lib/app/profilemanager.cpp b/src/lib/app/profilemanager.cpp index d9f8e5115..1a4b0762d 100644 --- a/src/lib/app/profilemanager.cpp +++ b/src/lib/app/profilemanager.cpp @@ -67,7 +67,7 @@ void ProfileManager::initConfigDir() const QFile versionFile(dir.filePath(QLatin1String("profiles/default/version"))); versionFile.open(QFile::WriteOnly); - versionFile.write(Qz::VERSION.toUtf8()); + versionFile.write(Qz::VERSION); versionFile.close(); } @@ -106,7 +106,7 @@ int ProfileManager::createProfile(const QString &profileName) QFile versionFile(dir.filePath(QLatin1String("/version"))); versionFile.open(QFile::WriteOnly); - versionFile.write(Qz::VERSION.toUtf8()); + versionFile.write(Qz::VERSION); versionFile.close(); return 0; @@ -172,7 +172,7 @@ void ProfileManager::updateCurrentProfile() } versionFile.open(QFile::WriteOnly); - versionFile.write(Qz::VERSION.toUtf8()); + versionFile.write(Qz::VERSION); versionFile.close(); } diff --git a/src/lib/app/qzcommon.cpp b/src/lib/app/qzcommon.cpp new file mode 100644 index 000000000..f88973cc4 --- /dev/null +++ b/src/lib/app/qzcommon.cpp @@ -0,0 +1,33 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2014 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "qzcommon.h" + +namespace Qz +{ +const int sessionVersion = 0x0003; +const int sessionVersionQt5 = 0x0003 | 0x050000; +const int bookmarksVersion = 1; + +const char* APPNAME = "QupZilla"; +const char* VERSION = QUPZILLA_VERSION; +const char* BUILDTIME = __DATE__" "__TIME__; +const char* AUTHOR = "David Rosca"; +const char* COPYRIGHT = "2010-2014"; +const char* WWWADDRESS = "http://www.qupzilla.com"; +const char* WIKIADDRESS = "https://github.com/QupZilla/qupzilla/wiki"; +} diff --git a/src/lib/app/qzcommon.h b/src/lib/app/qzcommon.h index f10eff343..f5620d61a 100644 --- a/src/lib/app/qzcommon.h +++ b/src/lib/app/qzcommon.h @@ -55,20 +55,20 @@ namespace Qz { // Version of session.dat file -static const int sessionVersion = 0x0003; +extern const int sessionVersion; // Backwards compatibility (used to be different for Qt4 and Qt5) -static const int sessionVersionQt5 = 0x0003 | 0x050000; +extern const int sessionVersionQt5; // Version of bookmarks.json file -static const int bookmarksVersion = 1; +extern const int bookmarksVersion; -static const QString APPNAME = "QupZilla"; -static const QString VERSION = "1.7.0"; -static const QString BUILDTIME = __DATE__" "__TIME__; -static const QString AUTHOR = "David Rosca"; -static const QString COPYRIGHT = "2010-2014"; -static const QString WWWADDRESS = "http://www.qupzilla.com"; -static const QString WIKIADDRESS = "https://github.com/QupZilla/qupzilla/wiki"; +extern const char* APPNAME; +extern const char* VERSION; +extern const char* BUILDTIME; +extern const char* AUTHOR; +extern const char* COPYRIGHT; +extern const char* WWWADDRESS; +extern const char* WIKIADDRESS; enum BrowserWindowType { BW_FirstAppWindow, diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 4805c1cf2..c6a35d8a0 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -71,6 +71,7 @@ SOURCES += \ app/mainmenu.cpp \ app/profilemanager.cpp \ app/proxystyle.cpp \ + app/qzcommon.cpp \ app/settings.cpp \ autofill/autofill.cpp \ autofill/autofillicon.cpp \ diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index e078ecd43..59e2a4102 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -165,9 +165,11 @@ QString QupZillaSchemeReply::reportbugPage() bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!")); bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystem()); - bPage.replace(QLatin1String("%INFO_APP%"), Qz::VERSION + bPage.replace(QLatin1String("%INFO_APP%"), #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" + QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#else + Qz::VERSION #endif ); bPage.replace(QLatin1String("%INFO_QT%"), QString("%1 (built with %2)").arg(qVersion(), QT_VERSION_STR)); @@ -218,14 +220,16 @@ QString QupZillaSchemeReply::aboutPage() aPage.replace(QLatin1String("%COPYRIGHT%"), tr("Copyright")); aPage.replace(QLatin1String("%VERSION-INFO%"), - QString("
%1
%2
").arg(tr("Version"), Qz::VERSION + QString("
%1
%2
").arg(tr("Version"), #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" + QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#else + Qz::VERSION #endif ) + QString("
%1
%2
").arg(tr("WebKit version"), qWebKitVersion())); aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer")); - aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(Qz::AUTHOR.toUtf8(), "nowrep@gmail.com")); + aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(Qz::AUTHOR, "nowrep@gmail.com")); aPage.replace(QLatin1String("%CONTRIBUTORS%"), tr("Contributors")); aPage.replace(QLatin1String("%CONTRIBUTORS-TEXT%"), authorString("Mladen Pejaković", "pejakm@autistici.org") + "
" + @@ -385,9 +389,11 @@ QString QupZillaSchemeReply::configPage() cPage.replace(QLatin1String("%PL-DESC%"), tr("Description")); cPage.replace(QLatin1String("%VERSION-INFO%"), - QString("
%1
%2
").arg(tr("Application version"), Qz::VERSION + QString("
%1
%2
").arg(tr("Application version"), #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" + QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#else + Qz::VERSION #endif ) + QString("
%1
%2
").arg(tr("Qt version"), QT_VERSION_STR) + diff --git a/src/lib/other/aboutdialog.cpp b/src/lib/other/aboutdialog.cpp index 1ab1a72b8..697df0ba4 100644 --- a/src/lib/other/aboutdialog.cpp +++ b/src/lib/other/aboutdialog.cpp @@ -66,9 +66,11 @@ void AboutDialog::showAbout() ui->authorsButton->setText(tr("Authors and Contributors")); if (m_aboutHtml.isEmpty()) { m_aboutHtml += "
"; - m_aboutHtml += tr("

Application version %1
").arg(Qz::VERSION + m_aboutHtml += tr("

Application version %1
").arg( #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" + QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#else + Qz::VERSION #endif ); m_aboutHtml += tr("WebKit version %1

").arg(qWebKitVersion()); diff --git a/src/lib/other/updater.cpp b/src/lib/other/updater.cpp index d2d2c1857..9f72eb1b8 100644 --- a/src/lib/other/updater.cpp +++ b/src/lib/other/updater.cpp @@ -154,7 +154,7 @@ void Updater::downCompleted(QNetworkReply* reply) void Updater::downloadNewVersion() { - m_window->tabWidget()->addView(QUrl(Qz::WWWADDRESS + "/download"), tr("Update"), Qz::NT_NotSelectedTab); + m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(Qz::WWWADDRESS) + QByteArray("/download")), tr("Update"), Qz::NT_NotSelectedTab); } Updater::~Updater() diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index ed0ed7a5d..e88c0aee9 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -492,7 +492,7 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent) connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*))); ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true); - ui->version->setText(" QupZilla v" + Qz::VERSION); + ui->version->setText(QSL(" QupZilla v") + QL1S(Qz::VERSION)); ui->listWidget->setCurrentRow(currentSettingsPage); QDesktopWidget* desktop = QApplication::desktop(); diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.cpp b/src/plugins/AccessKeysNavigation/akn_plugin.cpp index 902e28e33..719adabca 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.cpp +++ b/src/plugins/AccessKeysNavigation/akn_plugin.cpp @@ -62,9 +62,8 @@ void AKN_Plugin::unload() bool AKN_Plugin::testPlugin() { - // Let's be sure, require latest version of QupZilla - - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* AKN_Plugin::getTranslator(const QString &locale) diff --git a/src/plugins/AutoScroll/autoscrollplugin.cpp b/src/plugins/AutoScroll/autoscrollplugin.cpp index 27196f401..1fdd01fcb 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.cpp +++ b/src/plugins/AutoScroll/autoscrollplugin.cpp @@ -62,7 +62,8 @@ void AutoScrollPlugin::unload() bool AutoScrollPlugin::testPlugin() { - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* AutoScrollPlugin::getTranslator(const QString &locale) diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp index ab9f4cd9e..fe8b6c6a9 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp @@ -59,7 +59,8 @@ void GnomeKeyringPlugin::unload() bool GnomeKeyringPlugin::testPlugin() { - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* GnomeKeyringPlugin::getTranslator(const QString &locale) diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index e3524854d..c9ef04503 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -81,7 +81,8 @@ void GM_Plugin::unload() bool GM_Plugin::testPlugin() { - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* GM_Plugin::getTranslator(const QString &locale) diff --git a/src/plugins/KWalletPasswords/kwalletplugin.cpp b/src/plugins/KWalletPasswords/kwalletplugin.cpp index d4d15b15b..ec2a0ae80 100644 --- a/src/plugins/KWalletPasswords/kwalletplugin.cpp +++ b/src/plugins/KWalletPasswords/kwalletplugin.cpp @@ -59,7 +59,8 @@ void KWalletPlugin::unload() bool KWalletPlugin::testPlugin() { - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* KWalletPlugin::getTranslator(const QString &locale) diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index 50d41e369..512611ece 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -62,9 +62,8 @@ void MouseGesturesPlugin::unload() bool MouseGesturesPlugin::testPlugin() { - // Let's be sure, require latest version of QupZilla - - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* MouseGesturesPlugin::getTranslator(const QString &locale) diff --git a/src/plugins/PIM/PIM_plugin.cpp b/src/plugins/PIM/PIM_plugin.cpp index 29451ae4a..7715dff6d 100644 --- a/src/plugins/PIM/PIM_plugin.cpp +++ b/src/plugins/PIM/PIM_plugin.cpp @@ -65,9 +65,8 @@ void PIM_Plugin::unload() bool PIM_Plugin::testPlugin() { - // Let's be sure, require latest version of QupZilla - - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* PIM_Plugin::getTranslator(const QString &locale) diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp index 9e675294d..17770749f 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -72,7 +72,8 @@ void StatusBarIconsPlugin::unload() bool StatusBarIconsPlugin::testPlugin() { - return (Qz::VERSION == QLatin1String("1.7.0")); + // Require the version that the plugin was built with + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* StatusBarIconsPlugin::getTranslator(const QString &locale) diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index 16b7585dd..4f9552149 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -93,11 +93,11 @@ void TestPlugin::unload() bool TestPlugin::testPlugin() { - //This function is called right after init() - //There should be some testing if plugin is loaded correctly - //If this function returns false, plugin is automatically unloaded + // This function is called right after init() + // There should be some testing if plugin is loaded correctly + // If this function returns false, plugin is automatically unloaded - return (Qz::VERSION == QLatin1String("1.7.0")); + return (Qz::VERSION == QLatin1String(QUPZILLA_VERSION)); } QTranslator* TestPlugin::getTranslator(const QString &locale)