Browse Source

Prepend QBT_ for preprocessor variables

adaptive-webui-19844
Chocobo1 8 years ago
parent
commit
cb1646be32
  1. 2
      src/app/application.cpp
  2. 8
      src/app/main.cpp
  3. 2
      src/app/stacktrace_win_dlg.h
  4. 4
      src/base/bittorrent/session.cpp
  5. 2
      src/base/bittorrent/torrentcreatorthread.cpp
  6. 4
      src/base/net/dnsupdater.cpp
  7. 2
      src/gui/about_imp.h
  8. 6
      src/gui/mainwindow.cpp
  9. 8
      src/gui/programupdater.cpp
  10. BIN
      src/qbittorrent.rc
  11. 2
      src/webui/abstractwebapplication.cpp
  12. 2
      src/webui/webapplication.cpp
  13. 16
      version.pri

2
src/app/application.cpp

@ -127,7 +127,7 @@ Application::Application(const QString &id, int &argc, char **argv) @@ -127,7 +127,7 @@ Application::Application(const QString &id, int &argc, char **argv)
if (isFileLoggerEnabled())
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(VERSION));
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(QBT_VERSION));
}
#ifndef DISABLE_GUI

8
src/app/main.cpp

@ -189,7 +189,7 @@ int main(int argc, char *argv[]) @@ -189,7 +189,7 @@ int main(int argc, char *argv[])
}
// Set environment variable
if (!qputenv("QBITTORRENT", QByteArray(VERSION)))
if (!qputenv("QBITTORRENT", QBT_VERSION))
std::cerr << "Couldn't set environment variable...\n";
#ifndef DISABLE_GUI
@ -359,7 +359,7 @@ void sigAbnormalHandler(int signum) @@ -359,7 +359,7 @@ void sigAbnormalHandler(int signum)
const char str1[] = "\n\n*************************************************************\nCatching signal: ";
const char *sigName = sysSigName[signum];
const char str2[] = "\nPlease file a bug report at http://bug.qbittorrent.org and provide the following information:\n\n"
"qBittorrent version: " VERSION "\n";
"qBittorrent version: " QBT_VERSION "\n";
write(STDERR_FILENO, str1, strlen(str1));
write(STDERR_FILENO, sigName, strlen(sigName));
write(STDERR_FILENO, str2, strlen(str2));
@ -380,7 +380,7 @@ void showSplashScreen() @@ -380,7 +380,7 @@ void showSplashScreen()
{
QPixmap splash_img(":/icons/skin/splash.png");
QPainter painter(&splash_img);
QString version = VERSION;
QString version = QBT_VERSION;
painter.setPen(QPen(Qt::white));
painter.setFont(QFont("Arial", 22, QFont::Black));
painter.drawText(224 - painter.fontMetrics().width(version), 270, version);
@ -393,7 +393,7 @@ void showSplashScreen() @@ -393,7 +393,7 @@ void showSplashScreen()
void displayVersion()
{
std::cout << qPrintable(qApp->applicationName()) << " " << VERSION << std::endl;
std::cout << qPrintable(qApp->applicationName()) << " " << QBT_VERSION << std::endl;
}
QString makeUsage(const QString &prg_name)

2
src/app/stacktrace_win_dlg.h

@ -60,7 +60,7 @@ public: @@ -60,7 +60,7 @@ public:
"</p></font>"
"<br/><hr><br/>"
"<p align=center><font size=4>"
"qBittorrent version: " VERSION "<br/>"
"qBittorrent version: " QBT_VERSION "<br/>"
"Libtorrent version: %1<br/>"
"Qt version: " QT_VERSION_STR "<br/>"
"Boost version: %2<br/>"

4
src/base/bittorrent/session.cpp

@ -302,7 +302,7 @@ Session::Session(QObject *parent) @@ -302,7 +302,7 @@ Session::Session(QObject *parent)
;
#if LIBTORRENT_VERSION_NUM < 10100
libt::fingerprint fingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
libt::fingerprint fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
std::string peerId = fingerprint.to_string();
const ushort port = this->port();
std::pair<int, int> ports(port, port);
@ -332,7 +332,7 @@ Session::Session(QObject *parent) @@ -332,7 +332,7 @@ Session::Session(QObject *parent)
dispatchAlerts(alertPtr.release());
});
#else
std::string peerId = libt::generate_fingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
std::string peerId = libt::generate_fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
libt::settings_pack pack;
pack.set_int(libt::settings_pack::alert_mask, alertMask);
pack.set_str(libt::settings_pack::peer_fingerprint, peerId);

2
src/base/bittorrent/torrentcreatorthread.cpp

@ -103,7 +103,7 @@ void TorrentCreatorThread::run() @@ -103,7 +103,7 @@ void TorrentCreatorThread::run()
{
emit updateProgress(0);
QString creator_str("qBittorrent " VERSION);
QString creator_str("qBittorrent " QBT_VERSION);
try {
libt::file_storage fs;
// Adding files to the torrent

4
src/base/net/dnsupdater.cpp

@ -78,7 +78,7 @@ void DNSUpdater::checkPublicIP() @@ -78,7 +78,7 @@ void DNSUpdater::checkPublicIP()
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(
"http://checkip.dyndns.org", false, 0, false,
QString("qBittorrent/%1").arg(VERSION));
"qBittorrent/" QBT_VERSION);
connect(handler, SIGNAL(downloadFinished(QString, QByteArray)), SLOT(ipRequestFinished(QString, QByteArray)));
connect(handler, SIGNAL(downloadFailed(QString, QString)), SLOT(ipRequestFailed(QString, QString)));
@ -125,7 +125,7 @@ void DNSUpdater::updateDNSService() @@ -125,7 +125,7 @@ void DNSUpdater::updateDNSService()
m_lastIPCheckTime = QDateTime::currentDateTime();
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(
getUpdateUrl(), false, 0, false,
QString("qBittorrent/%1").arg(VERSION));
"qBittorrent/" QBT_VERSION);
connect(handler, SIGNAL(downloadFinished(QString, QByteArray)), SLOT(ipUpdateFinished(QString, QByteArray)));
connect(handler, SIGNAL(downloadFailed(QString, QString)), SLOT(ipUpdateFailed(QString, QString)));
}

2
src/gui/about_imp.h

@ -47,7 +47,7 @@ public: @@ -47,7 +47,7 @@ public:
setAttribute(Qt::WA_DeleteOnClose);
// Title
lb_name->setText("<b><h2>qBittorrent " VERSION "</h2></b>");
lb_name->setText("<b><h2>qBittorrent " QBT_VERSION "</h2></b>");
// About
QString aboutText = QString(

6
src/gui/mainwindow.cpp

@ -139,7 +139,7 @@ MainWindow::MainWindow(QWidget *parent) @@ -139,7 +139,7 @@ MainWindow::MainWindow(QWidget *parent)
Preferences *const pref = Preferences::instance();
m_uiLocked = pref->isUILocked();
setWindowTitle("qBittorrent " VERSION);
setWindowTitle("qBittorrent " QBT_VERSION);
m_displaySpeedInTitle = pref->speedInTitleBar();
// Setting icons
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
@ -1332,7 +1332,7 @@ void MainWindow::updateGUI() @@ -1332,7 +1332,7 @@ void MainWindow::updateGUI()
setWindowTitle(tr("[D: %1, U: %2] qBittorrent %3", "D = Download; U = Upload; %3 is qBittorrent version")
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate(), true))
.arg(Utils::Misc::friendlyUnit(status.payloadUploadRate(), true))
.arg(VERSION));
.arg(QBT_VERSION));
}
}
@ -1495,7 +1495,7 @@ void MainWindow::on_actionSpeedInTitleBar_triggered() @@ -1495,7 +1495,7 @@ void MainWindow::on_actionSpeedInTitleBar_triggered()
if (m_displaySpeedInTitle)
updateGUI();
else
setWindowTitle("qBittorrent " VERSION);
setWindowTitle("qBittorrent " QBT_VERSION);
}
void MainWindow::on_actionRSSReader_triggered()

8
src/gui/programupdater.cpp

@ -66,7 +66,7 @@ void ProgramUpdater::checkForUpdates() @@ -66,7 +66,7 @@ void ProgramUpdater::checkForUpdates()
RSS_URL, false, 0, false,
// Don't change this User-Agent. In case our updater goes haywire,
// the filehost can identify it and contact us.
QString("qBittorrent/%1 ProgramUpdater (www.qbittorrent.org)").arg(VERSION));
"qBittorrent/" QBT_VERSION " ProgramUpdater (www.qbittorrent.org)");
connect(handler, SIGNAL(downloadFinished(QString,QByteArray)), SLOT(rssDownloadFinished(QString,QByteArray)));
connect(handler, SIGNAL(downloadFailed(QString,QString)), SLOT(rssDownloadFailed(QString,QString)));
}
@ -137,9 +137,9 @@ void ProgramUpdater::updateProgram() @@ -137,9 +137,9 @@ void ProgramUpdater::updateProgram()
bool ProgramUpdater::isVersionMoreRecent(const QString &remoteVersion) const
{
QRegExp regVer("([0-9.]+)");
if (regVer.indexIn(QString(VERSION)) >= 0) {
if (regVer.indexIn(QBT_VERSION) >= 0) {
QString localVersion = regVer.cap(1);
qDebug() << Q_FUNC_INFO << "local version:" << localVersion << "/" << VERSION;
qDebug() << Q_FUNC_INFO << "local version:" << localVersion << "/" << QBT_VERSION;
QStringList remoteParts = remoteVersion.split('.');
QStringList localParts = localVersion.split('.');
for (int i = 0; i<qMin(remoteParts.size(), localParts.size()); ++i) {
@ -153,7 +153,7 @@ bool ProgramUpdater::isVersionMoreRecent(const QString &remoteVersion) const @@ -153,7 +153,7 @@ bool ProgramUpdater::isVersionMoreRecent(const QString &remoteVersion) const
return true;
// versions are equal, check if the local version is a development release, in which case it is older (2.9.2beta < 2.9.2)
QRegExp regDevel("(alpha|beta|rc)");
if (regDevel.indexIn(VERSION) >= 0)
if (regDevel.indexIn(QBT_VERSION) >= 0)
return true;
}
return false;

BIN
src/qbittorrent.rc

Binary file not shown.

2
src/webui/abstractwebapplication.cpp

@ -206,7 +206,7 @@ bool AbstractWebApplication::readFile(const QString& path, QByteArray &data, QSt @@ -206,7 +206,7 @@ bool AbstractWebApplication::readFile(const QString& path, QByteArray &data, QSt
translateDocument(dataStr);
if (path.endsWith("about.html") || path.endsWith("index.html") || path.endsWith("client.js"))
dataStr.replace("${VERSION}", VERSION);
dataStr.replace("${VERSION}", QBT_VERSION);
data = dataStr.toUtf8();
translatedFiles_[path] = data; // cashing translated file

2
src/webui/webapplication.cpp

@ -348,7 +348,7 @@ void WebApplication::action_version_api_min() @@ -348,7 +348,7 @@ void WebApplication::action_version_api_min()
void WebApplication::action_version_qbittorrent()
{
CHECK_URI(0);
print(QString(VERSION), Http::CONTENT_TYPE_TXT);
print(QString(QBT_VERSION), Http::CONTENT_TYPE_TXT);
}
void WebApplication::action_command_shutdown()

16
version.pri

@ -16,14 +16,14 @@ PROJECT_VERSION = $${VER_MAJOR}.$${VER_MINOR}.$${VER_BUGFIX} @@ -16,14 +16,14 @@ PROJECT_VERSION = $${VER_MAJOR}.$${VER_MINOR}.$${VER_BUGFIX}
PROJECT_VERSION = $${PROJECT_VERSION}$${VER_STATUS}
DEFINES += VERSION_MAJOR=$${VER_MAJOR}
DEFINES += VERSION_MINOR=$${VER_MINOR}
DEFINES += VERSION_BUGFIX=$${VER_BUGFIX}
DEFINES += VERSION_BUILD=$${VER_BUILD}
DEFINES += QBT_VERSION_MAJOR=$${VER_MAJOR}
DEFINES += QBT_VERSION_MINOR=$${VER_MINOR}
DEFINES += QBT_VERSION_BUGFIX=$${VER_BUGFIX}
DEFINES += QBT_VERSION_BUILD=$${VER_BUILD}
os2 {
DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
} else {
DEFINES += VERSION=\\\"v$${PROJECT_VERSION}\\\"
DEFINES += QBT_VERSION=\'\"v$${PROJECT_VERSION}\"\'
}
else {
DEFINES += QBT_VERSION=\\\"v$${PROJECT_VERSION}\\\"
}

Loading…
Cancel
Save