Stringified DEFINES.

This commit is contained in:
Martin Rotter 2016-06-01 11:28:44 +02:00
parent 594d114b9c
commit 686e17f04a
20 changed files with 101 additions and 95 deletions

View File

@ -42,14 +42,41 @@ TEMPLATE = app
TARGET = rssguard TARGET = rssguard
DEFINES *= QT_USE_QSTRINGBUILDER DEFINES *= QT_USE_QSTRINGBUILDER
APP_NAME = RSS Guard APP_NAME = "RSS Guard"
APP_LOW_NAME = rssguard APP_LOW_NAME = "rssguard"
APP_VERSION = 3.3.0 APP_LOW_H_NAME = ".rssguard"
APP_VERSION = "3.3.0"
APP_LONG_NAME = "$$APP_NAME $$APP_VERSION"
APP_AUTHOR = "Martin Rotter"
APP_EMAIL = "rotter.martinos@gmail.com"
APP_URL = "http://bitbucket.org/skunkos/rssguard"
APP_URL_ISSUES = "http://bitbucket.org/skunkos/rssguard/issues"
APP_URL_ISSUES_NEW_GITHUB = "https://github.com/martinrotter/rssguard/issues/new"
APP_URL_ISSUES_NEW_BITBUCKET = "http://bitbucket.org/skunkos/rssguard/issues/new"
APP_URL_WIKI = "https://bitbucket.org/skunkos/rssguard/wiki/Home"
APP_USERAGENT = "RSS Guard/3.3.0 (http://bitbucket.org/skunkos/rssguard)"
APP_DONATE_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
# Custom definitions.
DEFINES += APP_VERSION=\"$$APP_VERSION\"
DEFINES += APP_NAME=\"$$APP_NAME\"
DEFINES += APP_LOW_NAME=\"$$APP_LOW_NAME\"
DEFINES += APP_LOW_H_NAME=\"$$APP_LOW_H_NAME\"
DEFINES += APP_LONG_NAME=\"$$APP_LONG_NAME\"
DEFINES += APP_AUTHOR=\"$$APP_AUTHOR\"
DEFINES += APP_EMAIL=\"$$APP_EMAIL\"
DEFINES += APP_URL=\"$$APP_URL\"
DEFINES += APP_URL_ISSUES=\"$$APP_URL_ISSUES\"
DEFINES += APP_URL_ISSUES_NEW_GITHUB=\"$$APP_URL_ISSUES_NEW_GITHUB\"
DEFINES += APP_URL_ISSUES_NEW_BITBUCKET=\"$$APP_URL_ISSUES_NEW_BITBUCKET\"
DEFINES += APP_URL_WIKI=\"$$APP_URL_WIKI\"
DEFINES += APP_USERAGENT=\"$$APP_USERAGENT\"
DEFINES += APP_DONATE_URL=\"$$APP_DONATE_URL\"
CODECFORTR = UTF-8 CODECFORTR = UTF-8
CODECFORSRC = UTF-8 CODECFORSRC = UTF-8
message(rssguard: Welcome to RSS Guard qmake script.) message(rssguard: Welcomeo RSS Guard qmake script.)
message(rssguard: RSS Guard version is: '$$APP_VERSION'.) message(rssguard: RSS Guard version is: '$$APP_VERSION'.)
message(rssguard: Detected Qt version: '$$QT_VERSION'.) message(rssguard: Detected Qt version: '$$QT_VERSION'.)
message(rssguard: Destination directory: '$$PREFIX'.) message(rssguard: Destination directory: '$$PREFIX'.)
@ -65,7 +92,6 @@ isEmpty(PREFIX) {
message(rssguard: Build directory: '$$DESTDIR'.) message(rssguard: Build directory: '$$DESTDIR'.)
message(rssguard: Install directory: '$$PREFIX'.) message(rssguard: Install directory: '$$PREFIX'.)
QT += core gui widgets sql network xml printsupport QT += core gui widgets sql network xml printsupport
CONFIG += c++11 debug_and_release CONFIG += c++11 debug_and_release
@ -424,12 +450,12 @@ win32 {
ico.files = resources/graphics/$${TARGET}.ico ico.files = resources/graphics/$${TARGET}.ico
ico.path = $$quote($$PREFIX/) ico.path = $$quote($$PREFIX/)
app_icon.files = $$quote($$OUT_PWD/$${TARGET}.png) app_icon.files = $$quote($$PREFIX/$${TARGET}.png)
app_icon.extra = copy /y $$shell_quote($$shell_path($$PWD/resources/graphics/$${TARGET}_128.png)) $$shell_quote($$shell_path($$OUT_PWD/$${TARGET}.png)) app_icon.extra = copy /y $$shell_quote($$shell_path($$PWD/resources/graphics/$${TARGET}_128.png)) $$shell_quote($$shell_path($$PREFIX/$${TARGET}.png))
app_icon.path = $$quote($$PREFIX/) app_icon.path = $$quote($$PREFIX/)
app_plain_icon.files = $$quote($$OUT_PWD/$${TARGET}_plain.png) app_plain_icon.files = $$quote($$PREFIX/$${TARGET}_plain.png)
app_plain_icon.extra = copy /y $$shell_quote($$shell_path($$PWD/resources/graphics/$${TARGET}_plain_128.png)) $$shell_quote($$shell_path($$OUT_PWD/$${TARGET}_plain.png)) app_plain_icon.extra = copy /y $$shell_quote($$shell_path($$PWD/resources/graphics/$${TARGET}_plain_128.png)) $$shell_quote($$shell_path($$PREFIX/$${TARGET}_plain.png))
app_plain_icon.path = $$quote($$PREFIX/) app_plain_icon.path = $$quote($$PREFIX/)
translations.files = $$OUT_PWD/*.qm translations.files = $$OUT_PWD/*.qm
@ -470,7 +496,7 @@ unix:!mac {
misc_texts.path = $$quote($$PREFIX/usr/share/$$TARGET/information/) misc_texts.path = $$quote($$PREFIX/usr/share/$$TARGET/information/)
desktop_file.files = resources/desktop/$${TARGET}.desktop desktop_file.files = resources/desktop/$${TARGET}.desktop
desktop_file.path = $$quote($$PREFIX/usr/share/$$TARGET/information/) desktop_file.path = $$quote($$PREFIX/usr/share/applications/)
translations.files = $$OUT_PWD/*.qm translations.files = $$OUT_PWD/*.qm
translations.path = $$quote($$PREFIX/usr/share/applications/) translations.path = $$quote($$PREFIX/usr/share/applications/)

View File

@ -20,20 +20,8 @@
#include <QtGlobal> #include <QtGlobal>
#define APP_NAME "RSS Guard" #define _STR(x) #x
#define APP_LOW_NAME "rssguard" #define STRFY(x) _STR(x)
#define APP_LOW_H_NAME ".rssguard"
#define APP_LONG_NAME "RSS Guard 3.3.0"
#define APP_AUTHOR "Martin Rotter"
#define APP_EMAIL "rotter.martinos@gmail.com"
#define APP_URL "http://bitbucket.org/skunkos/rssguard"
#define APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues"
#define APP_URL_ISSUES_NEW_GITHUB "https://github.com/martinrotter/rssguard/issues/new"
#define APP_URL_ISSUES_NEW_BITBUCKET "http://bitbucket.org/skunkos/rssguard/issues/new"
#define APP_URL_WIKI "https://bitbucket.org/skunkos/rssguard/wiki/Home"
#define APP_VERSION "3.3.0"
#define APP_USERAGENT QString("RSS Guuard/3.3.0 (http://bitbucket.org/skunkos/rssguard)")
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
#define SERVICE_CODE_STD_RSS "std-rss" #define SERVICE_CODE_STD_RSS "std-rss"
#define SERVICE_CODE_TT_RSS "tt-rss" #define SERVICE_CODE_TT_RSS "tt-rss"
@ -225,33 +213,24 @@
#endif #endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
#define APP_DESKTOP_ENTRY_PATH "@DESKTOP_ENTRY_PATH@" #define APP_DESKTOP_ENTRY_PATH APP_PREFIX + QString("/share/applications")
#define APP_DESKTOP_ENTRY_FILE "@APP_LOW_NAME@.desktop" #define APP_DESKTOP_ENTRY_FILE "rssguard.desktop"
#define APP_LANG_PATH APP_PREFIX + QString("/share/rssguard/l10n") #define APP_LANG_PATH APP_PREFIX + QString("/share/rssguard/l10n")
#define APP_SKIN_PATH APP_PREFIX + QString("/share/rssguard/skins") #define APP_SKIN_PATH APP_PREFIX + QString("/share/rssguard/skins")
#define APP_INFO_PATH APP_PREFIX + QString("/share/rssguard/information") #define APP_INFO_PATH APP_PREFIX + QString("/share/rssguard/information")
#define APP_THEME_PATH APP_PREFIX + QString("/share/rssguard/icons") #define APP_THEME_PATH APP_PREFIX + QString("/share/rssguard/icons")
#define APP_MISC_PATH APP_PREFIX + QString("/share/rssguard/misc") #define APP_MISC_PATH APP_PREFIX + QString("/share/rssguard/misc")
#define APP_ICON_PATH APP_PREFIX + QString("/share/pixmaps/@APP_LOW_NAME@.png") #define APP_ICON_PATH APP_PREFIX + QString("/share/pixmaps/rssguard.png")
#define APP_ICON_PLAIN_PATH APP_PREFIX + QString("/share/rssguard/icons/@APP_LOW_NAME@_plain.png") #define APP_ICON_PLAIN_PATH APP_PREFIX + QString("/share/rssguard/icons/rssguard_plain.png")
#define APP_INITIAL_FEEDS_PATH APP_PREFIX + QString("/share/rssguard/initial_feeds") #define APP_INITIAL_FEEDS_PATH APP_PREFIX + QString("/share/rssguard/initial_feeds")
#elif defined(Q_OS_OSX) || defined(Q_WS_MAC) #elif defined(Q_OS_WIN)
#define APP_LANG_PATH APP_PREFIX + QString("/l10n")
#define APP_SKIN_PATH APP_PREFIX + QString("/skins")
#define APP_INFO_PATH APP_PREFIX + QString("/information")
#define APP_THEME_PATH APP_PREFIX + QString("/icons")
#define APP_MISC_PATH APP_PREFIX + QString("/misc")
#define APP_ICON_PATH APP_PREFIX + QString("/@APP_LOW_NAME@.png")
#define APP_ICON_PLAIN_PATH APP_PREFIX + QString("/@APP_LOW_NAME@_plain.png")
#define APP_INITIAL_FEEDS_PATH APP_PREFIX + QString("/initial_feeds")
#elif defined(Q_OS_WIN) || defined(Q_OS_OS2)
#define APP_LANG_PATH QApplication::applicationDirPath() + QString("/l10n") #define APP_LANG_PATH QApplication::applicationDirPath() + QString("/l10n")
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/skins") #define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/skins")
#define APP_INFO_PATH QApplication::applicationDirPath() #define APP_INFO_PATH QApplication::applicationDirPath()
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/icons") #define APP_THEME_PATH QApplication::applicationDirPath() + QString("/icons")
#define APP_MISC_PATH QApplication::applicationDirPath() + QString("/misc") #define APP_MISC_PATH QApplication::applicationDirPath() + QString("/misc")
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/@APP_LOW_NAME@.png") #define APP_ICON_PATH QApplication::applicationDirPath() + QString("/rssguard.png")
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/@APP_LOW_NAME@_plain.png") #define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/rssguard_plain.png")
#define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/initial_feeds") #define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/initial_feeds")
#endif #endif

View File

@ -33,7 +33,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout(
setWindowIcon(qApp->icons()->fromTheme(QSL("help-about"))); setWindowIcon(qApp->icons()->fromTheme(QSL("help-about")));
//: About RSS Guard dialog title. //: About RSS Guard dialog title.
setWindowTitle(tr("About %1").arg(APP_NAME)); setWindowTitle(tr("About %1").arg(STRFY(APP_NAME)));
m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH)); m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
@ -59,7 +59,7 @@ void FormAbout::loadSettingsAndPaths() {
m_ui->m_txtPathsSettingsType->setText(tr("PARTIALLY portable")); m_ui->m_txtPathsSettingsType->setText(tr("PARTIALLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->homeFolderPath() + m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->homeFolderPath() +
QDir::separator() + QDir::separator() +
QString(APP_LOW_H_NAME) + QString(STRFY(APP_LOW_H_NAME)) +
QDir::separator() + QDir::separator() +
QString(APP_DB_SQLITE_PATH))); QString(APP_DB_SQLITE_PATH)));
} }
@ -106,7 +106,7 @@ void FormAbout::loadLicenseAndInformation() {
__TIME__)).toString(Qt::DefaultLocaleShortDate), __TIME__)).toString(Qt::DefaultLocaleShortDate),
qVersion(), qVersion(),
QT_VERSION_STR, QT_VERSION_STR,
APP_NAME)); STRFY(APP_NAME)));
m_ui->m_txtInfo->setText(tr("<body>%5 is a (very) tiny feed reader." m_ui->m_txtInfo->setText(tr("<body>%5 is a (very) tiny feed reader."
"<br><br>This software is distributed under the terms of GNU General Public License, version 3." "<br><br>This software is distributed under the terms of GNU General Public License, version 3."
@ -114,9 +114,9 @@ void FormAbout::loadLicenseAndInformation() {
"<ul><li><a href=\"mailto://%1\">%1</a> ~e-mail</li>" "<ul><li><a href=\"mailto://%1\">%1</a> ~e-mail</li>"
"<li><a href=\"%2\">%2</a> ~website</li></ul>" "<li><a href=\"%2\">%2</a> ~website</li></ul>"
"You can obtain source code for %5 from its website." "You can obtain source code for %5 from its website."
"<br><br><br>Copyright (C) 2011-%3 %4</body>").arg(APP_EMAIL, "<br><br><br>Copyright (C) 2011-%3 %4</body>").arg(STRFY(APP_EMAIL),
APP_URL, STRFY(APP_URL),
QString::number(QDateTime::currentDateTime().date().year()), QString::number(QDateTime::currentDateTime().date().year()),
APP_AUTHOR, STRFY(APP_AUTHOR),
APP_NAME)); STRFY(APP_NAME)));
} }

View File

@ -43,7 +43,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialo
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder())); connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
selectFolder(qApp->documentsFolderPath()); selectFolder(qApp->documentsFolderPath());
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + QL1S("_") + QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm"))); m_ui->m_txtBackupName->lineEdit()->setText(QString(STRFY(APP_LOW_NAME)) + QL1S("_") + QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm")));
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet.")); m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::SQLITE && if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::SQLITE &&

View File

@ -145,9 +145,9 @@ void FormMain::prepareMenus() {
// Setup menu for tray icon. // Setup menu for tray icon.
if (SystemTrayIcon::isSystemTrayAvailable()) { if (SystemTrayIcon::isSystemTrayAvailable()) {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
m_trayMenu = new TrayIconMenu(APP_NAME, this); m_trayMenu = new TrayIconMenu(STRFY(APP_NAME), this);
#else #else
m_trayMenu = new QMenu(APP_NAME, this); m_trayMenu = new QMenu(STRFY(APP_NAME), this);
#endif #endif
// Add needed items to the menu. // Add needed items to the menu.
@ -518,7 +518,7 @@ void FormMain::showUpdates() {
} }
void FormMain::showWiki() { void FormMain::showWiki() {
if (!WebFactory::instance()->openUrlInExternalBrowser(APP_URL_WIKI)) { if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_URL_WIKI))) {
qApp->showGuiMessage(tr("Cannot open external browser"), qApp->showGuiMessage(tr("Cannot open external browser"),
tr("Cannot open external browser. Navigate to application website manually."), tr("Cannot open external browser. Navigate to application website manually."),
QSystemTrayIcon::Warning, this, true); QSystemTrayIcon::Warning, this, true);
@ -533,7 +533,7 @@ void FormMain::showAddAccountDialog() {
} }
void FormMain::reportABugOnGitHub() { void FormMain::reportABugOnGitHub() {
if (!WebFactory::instance()->openUrlInExternalBrowser(APP_URL_ISSUES_NEW_GITHUB)) { if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_URL_ISSUES_NEW_GITHUB))) {
qApp->showGuiMessage(tr("Cannot open external browser"), qApp->showGuiMessage(tr("Cannot open external browser"),
tr("Cannot open external browser. Navigate to application website manually."), tr("Cannot open external browser. Navigate to application website manually."),
QSystemTrayIcon::Warning, this, true); QSystemTrayIcon::Warning, this, true);
@ -541,7 +541,7 @@ void FormMain::reportABugOnGitHub() {
} }
void FormMain::reportABugOnBitBucket() { void FormMain::reportABugOnBitBucket() {
if (!WebFactory::instance()->openUrlInExternalBrowser(APP_URL_ISSUES_NEW_BITBUCKET)) { if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_URL_ISSUES_NEW_BITBUCKET))) {
qApp->showGuiMessage(tr("Cannot open external browser"), qApp->showGuiMessage(tr("Cannot open external browser"),
tr("Cannot open external browser. Navigate to application website manually."), tr("Cannot open external browser. Navigate to application website manually."),
QSystemTrayIcon::Warning, this, true); QSystemTrayIcon::Warning, this, true);
@ -549,7 +549,7 @@ void FormMain::reportABugOnBitBucket() {
} }
void FormMain::donate() { void FormMain::donate() {
if (!WebFactory::instance()->openUrlInExternalBrowser(APP_DONATE_URL)) { if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_DONATE_URL))) {
qApp->showGuiMessage(tr("Cannot open external browser"), qApp->showGuiMessage(tr("Cannot open external browser"),
tr("Cannot open external browser. Navigate to application website manually."), tr("Cannot open external browser. Navigate to application website manually."),
QSystemTrayIcon::Warning, this, true); QSystemTrayIcon::Warning, this, true);

View File

@ -635,7 +635,7 @@ void FormSettings::switchMysqlPasswordVisiblity(bool visible) {
} }
void FormSettings::loadGeneral() { void FormSettings::loadGeneral() {
m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text().arg(APP_NAME)); m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text().arg(STRFY(APP_NAME)));
m_ui->m_checkForUpdatesOnStart->setChecked(m_settings->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool()); m_ui->m_checkForUpdatesOnStart->setChecked(m_settings->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool());
// Load auto-start status. // Load auto-start status.

View File

@ -40,7 +40,7 @@ FormUpdate::FormUpdate(QWidget *parent)
m_ui->setupUi(this); m_ui->setupUi(this);
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole); m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
m_btnUpdate->setToolTip(tr("Download new installation files.")); m_btnUpdate->setToolTip(tr("Download new installation files."));
m_ui->m_lblCurrentRelease->setText(APP_VERSION); m_ui->m_lblCurrentRelease->setText(STRFY(APP_VERSION));
// Set flags and attributes. // Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
@ -86,7 +86,7 @@ void FormUpdate::checkForUpdates() {
const bool is_self_update_for_this_system = isUpdateForThisSystem() && isSelfUpdateSupported(); const bool is_self_update_for_this_system = isUpdateForThisSystem() && isSelfUpdateSupported();
if (!SystemFactory::isVersionNewer(update.first.m_availableVersion, APP_VERSION)) { if (SystemFactory::isVersionNewer(update.first.m_availableVersion, STRFY(APP_VERSION))) {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok, m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok,
tr("New release available."), tr("New release available."),
tr("This is new version which can be\ndownloaded and installed.")); tr("This is new version which can be\ndownloaded and installed."));
@ -177,7 +177,7 @@ void FormUpdate::startUpdate() {
url_file = m_updateInfo.m_urls.value(OS_ID).m_fileUrl; url_file = m_updateInfo.m_urls.value(OS_ID).m_fileUrl;
} }
else { else {
url_file = APP_URL; url_file = STRFY(APP_URL);
} }
if (m_readyToInstall) { if (m_readyToInstall) {

View File

@ -37,7 +37,7 @@ TrayIconMenu::~TrayIconMenu() {
bool TrayIconMenu::event(QEvent *event) { bool TrayIconMenu::event(QEvent *event) {
if (event->type() == QEvent::Show && Application::activeModalWidget() != NULL) { if (event->type() == QEvent::Show && Application::activeModalWidget() != NULL) {
QTimer::singleShot(0, this, SLOT(hide())); QTimer::singleShot(0, this, SLOT(hide()));
qApp->showGuiMessage(QSL(APP_LONG_NAME), qApp->showGuiMessage(QSL(STRFY(APP_LONG_NAME)),
tr("Close opened modal dialogs first."), tr("Close opened modal dialogs first."),
QSystemTrayIcon::Warning, qApp->mainForm(), true); QSystemTrayIcon::Warning, qApp->mainForm(), true);
} }
@ -121,11 +121,11 @@ void SystemTrayIcon::show() {
void SystemTrayIcon::setNumber(int number, bool any_new_message) { void SystemTrayIcon::setNumber(int number, bool any_new_message) {
if (number <= 0) { if (number <= 0) {
setToolTip(QSL(APP_LONG_NAME)); setToolTip(QSL(STRFY(APP_LONG_NAME)));
QSystemTrayIcon::setIcon(QIcon(m_normalIcon)); QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
} }
else { else {
setToolTip(tr("%1\nUnread news: %2").arg(QSL(APP_LONG_NAME), QString::number(number))); setToolTip(tr("%1\nUnread news: %2").arg(QSL(STRFY(APP_LONG_NAME)), QString::number(number)));
QPixmap background(m_plainPixmap); QPixmap background(m_plainPixmap);
QPainter tray_painter; QPainter tray_painter;

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[]) {
qInstallMessageHandler(Debugging::debugHandler); qInstallMessageHandler(Debugging::debugHandler);
// Instantiate base application object. // Instantiate base application object.
Application application(APP_LOW_NAME, argc, argv); Application application(STRFY(APP_LOW_NAME), argc, argv);
qDebug("Instantiated Application class."); qDebug("Instantiated Application class.");
// Check if another instance is running. // Check if another instance is running.
@ -81,11 +81,11 @@ int main(int argc, char *argv[]) {
qApp->localization()->loadActiveLanguage(); qApp->localization()->loadActiveLanguage();
// These settings needs to be set before any QSettings object. // These settings needs to be set before any QSettings object.
Application::setApplicationName(APP_NAME); Application::setApplicationName(STRFY(APP_NAME));
Application::setApplicationVersion(APP_VERSION); Application::setApplicationVersion(STRFY(APP_VERSION));
Application::setOrganizationName(APP_AUTHOR); Application::setOrganizationName(STRFY(APP_AUTHOR));
Application::setOrganizationDomain(APP_URL); Application::setOrganizationDomain(STRFY(APP_URL));
Application::setWindowIcon(QIcon(APP_ICON_PATH)); Application::setWindowIcon(QIcon(STRFY(APP_ICON_PATH)));
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'."; qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
FormMain main_window; FormMain main_window;
// Set correct information for main window. // Set correct information for main window.
main_window.setWindowTitle(APP_LONG_NAME); main_window.setWindowTitle(STRFY(APP_LONG_NAME));
// Now is a good time to initialize dynamic keyboard shortcuts. // Now is a good time to initialize dynamic keyboard shortcuts.
DynamicShortcuts::load(qApp->userActions()); DynamicShortcuts::load(qApp->userActions());
@ -120,13 +120,13 @@ int main(int argc, char *argv[]) {
// Setup single-instance behavior. // Setup single-instance behavior.
QObject::connect(&application, SIGNAL(messageReceived(QString)), &application, SLOT(processExecutionMessage(QString))); QObject::connect(&application, SIGNAL(messageReceived(QString)), &application, SLOT(processExecutionMessage(QString)));
if (qApp->isFirstRun() || qApp->isFirstRun(APP_VERSION)) { if (qApp->isFirstRun() || qApp->isFirstRun(STRFY(APP_VERSION))) {
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1.\n\nPlease, check NEW stuff included in this\n" qApp->showGuiMessage(QSL(STRFY(APP_NAME)), QObject::tr("Welcome to %1.\n\nPlease, check NEW stuff included in this\n"
"version by clicking this popup notification.").arg(APP_LONG_NAME), "version by clicking this popup notification.").arg(STRFY(APP_LONG_NAME)),
QSystemTrayIcon::NoIcon, 0, false, &main_window, SLOT(showAbout())); QSystemTrayIcon::NoIcon, 0, false, &main_window, SLOT(showAbout()));
} }
else { else {
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1.").arg(APP_LONG_NAME), QSystemTrayIcon::NoIcon); qApp->showGuiMessage(QSL(STRFY(APP_NAME)), QObject::tr("Welcome to %1.").arg(STRFY(APP_NAME)), QSystemTrayIcon::NoIcon);
} }
if (qApp->settings()->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool()) { if (qApp->settings()->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool()) {

View File

@ -77,7 +77,7 @@ bool Application::isFirstRun() {
} }
bool Application::isFirstRun(const QString &version) { bool Application::isFirstRun(const QString &version) {
if (version == APP_VERSION) { if (version == STRFY(APP_VERSION)) {
// Check this only if checked version is equal to actual version. // Check this only if checked version is equal to actual version.
return settings()->value(GROUP(General), QString(General::FirstRun) + QL1C('_') + version, true).toBool(); return settings()->value(GROUP(General), QString(General::FirstRun) + QL1C('_') + version, true).toBool();
} }
@ -169,7 +169,7 @@ void Application::processExecutionMessage(const QString &message) {
foreach (const QString &msg, message.split(ARGUMENTS_LIST_SEPARATOR)) { foreach (const QString &msg, message.split(ARGUMENTS_LIST_SEPARATOR)) {
if (msg == APP_IS_RUNNING) { if (msg == APP_IS_RUNNING) {
showGuiMessage(APP_NAME, tr("Application is already running."), QSystemTrayIcon::Information); showGuiMessage(STRFY(APP_NAME), tr("Application is already running."), QSystemTrayIcon::Information);
mainForm()->display(); mainForm()->display();
} }
else if (msg == APP_QUIT_INSTANCE) { else if (msg == APP_QUIT_INSTANCE) {
@ -251,7 +251,7 @@ void Application::onSaveState(QSessionManager &manager) {
void Application::onAboutToQuit() { void Application::onAboutToQuit() {
eliminateFirstRun(); eliminateFirstRun();
eliminateFirstRun(APP_VERSION); eliminateFirstRun(STRFY(APP_VERSION));
// Make sure that we obtain close lock BEFORE even trying to quit the application. // Make sure that we obtain close lock BEFORE even trying to quit the application.
const bool locked_safely = feedUpdateLock()->tryLock(4 * CLOSE_LOCK_TIMEOUT); const bool locked_safely = feedUpdateLock()->tryLock(4 * CLOSE_LOCK_TIMEOUT);

View File

@ -192,7 +192,7 @@ void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
} }
else { else {
m_sqliteDatabaseFilePath = qApp->homeFolderPath() + QDir::separator() + m_sqliteDatabaseFilePath = qApp->homeFolderPath() + QDir::separator() +
QString(APP_LOW_H_NAME) + QDir::separator() + QString(STRFY(APP_LOW_NAME)) + QDir::separator() +
QString(APP_DB_SQLITE_PATH); QString(APP_DB_SQLITE_PATH);
} }
} }
@ -647,7 +647,7 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
determineDriver(); determineDriver();
MessageBox::show(NULL, QMessageBox::Critical, tr("MySQL database not available"), MessageBox::show(NULL, QMessageBox::Critical, tr("MySQL database not available"),
tr("%1 cannot use MySQL storage, it is not available. %1 is now switching to SQLite database. Start your MySQL server " tr("%1 cannot use MySQL storage, it is not available. %1 is now switching to SQLite database. Start your MySQL server "
"and make adjustments in application settings.").arg(APP_NAME), QString(), QString()); "and make adjustments in application settings.").arg(STRFY(APP_NAME)));
return connection(objectName(), FromSettings); return connection(objectName(), FromSettings);
} }

View File

@ -33,11 +33,11 @@ void Debugging::performLog(const char *message, QtMsgType type, const char *file
// Write to console. // Write to console.
if (file == 0 || function == 0 || line < 0) { if (file == 0 || function == 0 || line < 0) {
fprintf(stderr, "[%s] %s: %s\n", APP_LOW_NAME, type_string, message); fprintf(stderr, "[%s] %s: %s\n", STRFY(APP_LOW_NAME), type_string, message);
} }
else { else {
fprintf(stderr, "[%s] %s\n Type: %s\n File: %s (line %d)\n Function: %s\n\n", fprintf(stderr, "[%s] %s\n Type: %s\n File: %s (line %d)\n Function: %s\n\n",
APP_LOW_NAME, message, type_string, file, line, function); STRFY(APP_LOW_NAME), message, type_string, file, line, function);
} }
if (type == QtFatalMsg) { if (type == QtFatalMsg) {

View File

@ -219,7 +219,7 @@ DKEY Database::MySQLPassword = "mysql_password";
DVALUE(QString) Database::MySQLPasswordDef = QString(); DVALUE(QString) Database::MySQLPasswordDef = QString();
DKEY Database::MySQLDatabase = "mysql_database"; DKEY Database::MySQLDatabase = "mysql_database";
DVALUE(char*) Database::MySQLDatabaseDef = APP_LOW_NAME; DVALUE(char*) Database::MySQLDatabaseDef = STRFY(APP_LOW_NAME);
DKEY Database::MySQLPort = "mysql_port"; DKEY Database::MySQLPort = "mysql_port";
DVALUE(int) Database::MySQLPortDef = APP_DB_MYSQL_PORT; DVALUE(int) Database::MySQLPortDef = APP_DB_MYSQL_PORT;
@ -328,7 +328,7 @@ SettingsProperties Settings::determineProperties() {
properties.m_settingsSuffix = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE); properties.m_settingsSuffix = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE);
const QString app_path = qApp->applicationDirPath(); const QString app_path = qApp->applicationDirPath();
const QString home_path = qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME); const QString home_path = qApp->homeFolderPath() + QDir::separator() + QString(STRFY(APP_LOW_H_NAME));
const QString home_path_file = home_path + properties.m_settingsSuffix; const QString home_path_file = home_path + properties.m_settingsSuffix;
const bool portable_settings_available = QFileInfo(app_path).isWritable(); const bool portable_settings_available = QFileInfo(app_path).isWritable();

View File

@ -49,7 +49,7 @@ SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() const {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"), QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
QSettings::NativeFormat); QSettings::NativeFormat);
const bool autostart_enabled = registry_key.value(QSL(APP_LOW_NAME), const bool autostart_enabled = registry_key.value(QSL(STRFY(APP_LOW_NAME)),
QString()).toString().replace(QL1C('\\'), QString()).toString().replace(QL1C('\\'),
QL1C('/')) == QL1C('/')) ==
Application::applicationFilePath(); Application::applicationFilePath();
@ -125,12 +125,12 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
switch (new_status) { switch (new_status) {
case SystemFactory::Enabled: case SystemFactory::Enabled:
registry_key.setValue(APP_LOW_NAME, registry_key.setValue(STRFY(APP_LOW_NAME),
Application::applicationFilePath().replace(QL1C('/'), QL1C('\\'))); Application::applicationFilePath().replace(QL1C('/'), QL1C('\\')));
return true; return true;
case SystemFactory::Disabled: case SystemFactory::Disabled:
registry_key.remove(APP_LOW_NAME); registry_key.remove(STRFY(APP_LOW_NAME));
return true; return true;
default: default:
@ -141,7 +141,8 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
// "rssguard.desktop" desktop file. // "rssguard.desktop" desktop file.
switch (new_status) { switch (new_status) {
case SystemFactory::Enabled: case SystemFactory::Enabled:
QFile::link(QString(APP_DESKTOP_ENTRY_PATH) + '/' + APP_DESKTOP_ENTRY_FILE, getAutostartDesktopFileLocation()); QFile::link(QString(APP_DESKTOP_ENTRY_PATH) + QDir::separator() + APP_DESKTOP_ENTRY_FILE,
getAutostartDesktopFileLocation());
return true; return true;
case SystemFactory::Disabled: case SystemFactory::Disabled:
@ -275,7 +276,7 @@ void SystemFactory::checkForUpdatesOnStartup() {
const UpdateCheck updates = checkForUpdates(); const UpdateCheck updates = checkForUpdates();
if (updates.second == QNetworkReply::NoError && isVersionNewer(updates.first.m_availableVersion, if (updates.second == QNetworkReply::NoError && isVersionNewer(updates.first.m_availableVersion,
APP_VERSION)) { STRFY(APP_VERSION))) {
qApp->showGuiMessage(tr("New version available"), qApp->showGuiMessage(tr("New version available"),
tr("Click the bubble for more information."), tr("Click the bubble for more information."),
QSystemTrayIcon::Information, QSystemTrayIcon::Information,

View File

@ -76,7 +76,7 @@ QNetworkReply *BaseNetworkAccessManager::createRequest(QNetworkAccessManager::Op
new_request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); new_request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
// Setup custom user-agent. // Setup custom user-agent.
new_request.setRawHeader(USER_AGENT_HTTP_HEADER, QString(APP_USERAGENT).toLocal8Bit()); new_request.setRawHeader(USER_AGENT_HTTP_HEADER, QString(STRFY(APP_USERAGENT)).toLocal8Bit());
return QNetworkAccessManager::createRequest(op, new_request, outgoingData); return QNetworkAccessManager::createRequest(op, new_request, outgoingData);
} }

View File

@ -62,11 +62,11 @@ QString OwnCloudServiceEntryPoint::description() const {
} }
QString OwnCloudServiceEntryPoint::version() const { QString OwnCloudServiceEntryPoint::version() const {
return APP_VERSION; return STRFY(APP_VERSION);
} }
QString OwnCloudServiceEntryPoint::author() const { QString OwnCloudServiceEntryPoint::author() const {
return APP_AUTHOR; return STRFY(APP_AUTHOR);
} }
QIcon OwnCloudServiceEntryPoint::icon() const { QIcon OwnCloudServiceEntryPoint::icon() const {

View File

@ -56,7 +56,7 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
QDomElement elem_opml_head = opml_document.createElement(QSL("head")); QDomElement elem_opml_head = opml_document.createElement(QSL("head"));
QDomElement elem_opml_title = opml_document.createElement(QSL("title")); QDomElement elem_opml_title = opml_document.createElement(QSL("title"));
QDomText text_opml_title = opml_document.createTextNode(QString(APP_NAME)); QDomText text_opml_title = opml_document.createTextNode(QString(STRFY(APP_NAME)));
elem_opml_title.appendChild(text_opml_title); elem_opml_title.appendChild(text_opml_title);
elem_opml_head.appendChild(elem_opml_title); elem_opml_head.appendChild(elem_opml_title);

View File

@ -43,11 +43,11 @@ QString StandardServiceEntryPoint::description() const {
} }
QString StandardServiceEntryPoint::version() const { QString StandardServiceEntryPoint::version() const {
return APP_VERSION; return STRFY(APP_VERSION);
} }
QString StandardServiceEntryPoint::author() const { QString StandardServiceEntryPoint::author() const {
return APP_AUTHOR; return STRFY(APP_AUTHOR);
} }
QIcon StandardServiceEntryPoint::icon() const { QIcon StandardServiceEntryPoint::icon() const {

View File

@ -47,7 +47,7 @@ StandardServiceRoot::StandardServiceRoot(RootItem *parent)
m_actionExportFeeds(NULL), m_actionImportFeeds(NULL), m_serviceMenu(QList<QAction*>()), m_actionExportFeeds(NULL), m_actionImportFeeds(NULL), m_serviceMenu(QList<QAction*>()),
m_feedContextMenu(QList<QAction*>()), m_actionFeedFetchMetadata(NULL) { m_feedContextMenu(QList<QAction*>()), m_actionFeedFetchMetadata(NULL) {
setTitle(qApp->system()->getUsername() + QL1S("@") + QL1S(APP_LOW_NAME)); setTitle(qApp->system()->getUsername() + QL1S("@") + QL1S(STRFY(APP_LOW_NAME)));
setIcon(StandardServiceEntryPoint().icon()); setIcon(StandardServiceEntryPoint().icon());
setDescription(tr("This is obligatory service account for standard RSS/RDF/ATOM feeds.")); setDescription(tr("This is obligatory service account for standard RSS/RDF/ATOM feeds."));
} }

View File

@ -51,11 +51,11 @@ QString TtRssServiceEntryPoint::description() const {
} }
QString TtRssServiceEntryPoint::version() const { QString TtRssServiceEntryPoint::version() const {
return APP_VERSION; return STRFY(APP_VERSION);
} }
QString TtRssServiceEntryPoint::author() const { QString TtRssServiceEntryPoint::author() const {
return APP_AUTHOR; return STRFY(APP_AUTHOR);
} }
QIcon TtRssServiceEntryPoint::icon() const { QIcon TtRssServiceEntryPoint::icon() const {