diff --git a/CMakeLists.txt b/CMakeLists.txt index 86178e05a..7c9c03633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,15 +17,17 @@ endif() set(PROJECT_VERSION "${PROJECT_VERSION}${VER_STATUS}") -add_definitions(-DVERSION_MAJOR=${VER_MAJOR}) -add_definitions(-DVERSION_MINOR=${VER_MINOR}) -add_definitions(-DVERSION_BUGFIX=${VER_BUGFIX}) -add_definitions(-DVERSION_BUILD=${VER_BUILD}) +add_definitions(-DQBT_VERSION_MAJOR=${VER_MAJOR}) +add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR}) +add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX}) +add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD}) # os2 { -# DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\' +# DEFINES += DQBT_VERSION=\'\"v$${PROJECT_VERSION}\"\' +# DEFINES += DQBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\' # } else { -add_definitions(-DVERSION="v${PROJECT_VERSION}") +add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}") +add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}") # } # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og") diff --git a/src/app/application.cpp b/src/app/application.cpp index 2795d654d..8eb2c8f26 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -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(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 diff --git a/src/app/main.cpp b/src/app/main.cpp index d1cd65a9e..cd6b00c3a 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -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) 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() { 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() 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) diff --git a/src/app/stacktrace_win_dlg.h b/src/app/stacktrace_win_dlg.h index 6c50b4776..62d8da7fc 100644 --- a/src/app/stacktrace_win_dlg.h +++ b/src/app/stacktrace_win_dlg.h @@ -60,7 +60,7 @@ public: "

" "


" "

" - "qBittorrent version: " VERSION "
" + "qBittorrent version: " QBT_VERSION "
" "Libtorrent version: %1
" "Qt version: " QT_VERSION_STR "
" "Boost version: %2
" diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 2d2b41fb9..39389d1f1 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -91,7 +91,7 @@ static const char PEER_ID[] = "qB"; static const char RESUME_FOLDER[] = "BT_backup"; -static const char USER_AGENT[] = "qBittorrent " VERSION; +static const char USER_AGENT[] = "qBittorrent/" QBT_VERSION; // to pass trackers whitelists, using the "v" prefixed version string namespace libt = libtorrent; using namespace BitTorrent; @@ -310,7 +310,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 ports(port, port); @@ -340,7 +340,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); diff --git a/src/base/bittorrent/torrentcreatorthread.cpp b/src/base/bittorrent/torrentcreatorthread.cpp index 1d9e35660..e4809994d 100644 --- a/src/base/bittorrent/torrentcreatorthread.cpp +++ b/src/base/bittorrent/torrentcreatorthread.cpp @@ -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 diff --git a/src/base/net/dnsupdater.cpp b/src/base/net/dnsupdater.cpp index c437ce782..2a57e1e99 100644 --- a/src/base/net/dnsupdater.cpp +++ b/src/base/net/dnsupdater.cpp @@ -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_2); 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() m_lastIPCheckTime = QDateTime::currentDateTime(); DownloadHandler *handler = DownloadManager::instance()->downloadUrl( getUpdateUrl(), false, 0, false, - QString("qBittorrent/%1").arg(VERSION)); + "qBittorrent/" QBT_VERSION_2); connect(handler, SIGNAL(downloadFinished(QString, QByteArray)), SLOT(ipUpdateFinished(QString, QByteArray))); connect(handler, SIGNAL(downloadFailed(QString, QString)), SLOT(ipUpdateFailed(QString, QString))); } diff --git a/src/gui/about_imp.h b/src/gui/about_imp.h index fac31ea3a..310aa72bb 100644 --- a/src/gui/about_imp.h +++ b/src/gui/about_imp.h @@ -47,7 +47,7 @@ public: setAttribute(Qt::WA_DeleteOnClose); // Title - lb_name->setText("

qBittorrent " VERSION "

"); + lb_name->setText("

qBittorrent " QBT_VERSION "

"); // About QString aboutText = QString( diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0b873443d..199022cf0 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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() 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() if (m_displaySpeedInTitle) updateGUI(); else - setWindowTitle("qBittorrent " VERSION); + setWindowTitle("qBittorrent " QBT_VERSION); } void MainWindow::on_actionRSSReader_triggered() diff --git a/src/gui/programupdater.cpp b/src/gui/programupdater.cpp index bec098e08..e4ce2597e 100644 --- a/src/gui/programupdater.cpp +++ b/src/gui/programupdater.cpp @@ -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_2 " 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() 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= 0) + if (regDevel.indexIn(QBT_VERSION) >= 0) return true; } return false; diff --git a/src/qbittorrent.rc b/src/qbittorrent.rc index 65e480bf7..bfd49e897 100644 Binary files a/src/qbittorrent.rc and b/src/qbittorrent.rc differ diff --git a/src/webui/abstractwebapplication.cpp b/src/webui/abstractwebapplication.cpp index 9c4d8c090..c15599466 100644 --- a/src/webui/abstractwebapplication.cpp +++ b/src/webui/abstractwebapplication.cpp @@ -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 diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 2598f6dd2..684c44da5 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -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() diff --git a/version.pri b/version.pri index d81fa0a96..12a87605f 100644 --- a/version.pri +++ b/version.pri @@ -1,3 +1,4 @@ +# keep it all lowercase to match program naming convention on *nix systems PROJECT_NAME = qbittorrent # Define version numbers here @@ -16,14 +17,16 @@ 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}\"\' + DEFINES += QBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\' +} +else { + DEFINES += QBT_VERSION=\\\"v$${PROJECT_VERSION}\\\" + DEFINES += QBT_VERSION_2=\\\"$${PROJECT_VERSION}\\\" } -