mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[QzCommon] Move constants initialization into source file (.cpp)
Plugins are now checking for a match of version that were built with in Plugin::testPlugin() function.
This commit is contained in:
parent
c6ae381404
commit
535cc3e73a
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
33
src/lib/app/qzcommon.cpp
Normal file
33
src/lib/app/qzcommon.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#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";
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), Qz::VERSION
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"),
|
||||
#ifdef GIT_REVISION
|
||||
+ " (" + GIT_REVISION + ")"
|
||||
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION)
|
||||
#else
|
||||
Qz::VERSION
|
||||
#endif
|
||||
) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").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") + "<br/>" +
|
||||
|
@ -385,9 +389,11 @@ QString QupZillaSchemeReply::configPage()
|
|||
cPage.replace(QLatin1String("%PL-DESC%"), tr("Description"));
|
||||
|
||||
cPage.replace(QLatin1String("%VERSION-INFO%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), Qz::VERSION
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"),
|
||||
#ifdef GIT_REVISION
|
||||
+ " (" + GIT_REVISION + ")"
|
||||
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION)
|
||||
#else
|
||||
Qz::VERSION
|
||||
#endif
|
||||
) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QT_VERSION_STR) +
|
||||
|
|
|
@ -66,9 +66,11 @@ void AboutDialog::showAbout()
|
|||
ui->authorsButton->setText(tr("Authors and Contributors"));
|
||||
if (m_aboutHtml.isEmpty()) {
|
||||
m_aboutHtml += "<center><div style='margin:10px;'>";
|
||||
m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(Qz::VERSION
|
||||
m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(
|
||||
#ifdef GIT_REVISION
|
||||
+ " (" + GIT_REVISION + ")"
|
||||
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION)
|
||||
#else
|
||||
Qz::VERSION
|
||||
#endif
|
||||
);
|
||||
m_aboutHtml += tr("<b>WebKit version %1</b></p>").arg(qWebKitVersion());
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user