From d5f2dddbbd6707f0093561b1c91087d6da0c966c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 15 Jun 2018 14:50:54 +0200 Subject: Clean up globals.* (remove unused, rename constants, prefix) --- src/dialog.cpp | 64 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index 7e22962..6250114 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -141,7 +141,7 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) // Run session if (s->run()) { // Run session start script if the session could be initialized successfully - if (QFile::exists(sessionStartScript)) { + if (QFile::exists(SESSION_START_SCRIPT)) { // Use the current environment variables and add the necessary // information for the startUpScipt. // export session information to the environment of the process to be exec'ed @@ -359,10 +359,10 @@ void Dialog::setTheme() { QString backgroundColor, imageLeft, imageRight; QString themePathBase, themePathIni, themePathImgLeft, themePathImgRight; - if (theme.isEmpty()) return; + if (g_themeName.isEmpty()) return; - themePathBase = QString("%1/%2/").arg(VMCHOOSER_THEME_BASE).arg(theme); - themePathIni = QString("%1%2.ini").arg(themePathBase).arg(theme); + themePathBase = QString("%1/%2/").arg(VMCHOOSER_THEME_BASE).arg(g_themeName); + themePathIni = QString("%1%2.ini").arg(themePathBase).arg(g_themeName); if (!QFile::exists(themePathIni)) return; @@ -395,7 +395,7 @@ void Dialog::onCenterTimer() { QRect desktopRect = QApplication::desktop()->availableGeometry(this); QPoint center = desktopRect.center(); if (center != oldCenter_) { - if (_fullscreen) + if (g_fullscreen) this->resize(desktopRect.width(), desktopRect.height()); this->move(center.x() - this->width() / 2, center.y() - this->height() / 2); oldCenter_ = center; @@ -421,18 +421,18 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { if (reply->error() != QNetworkReply::NoError) { qDebug() << "Error reading from URL: " << reply->error(); - QFile backup_file(xml_filename); + QFile backup_file(TEMP_PATH_XML_LIST); if (!backup_file.open(QIODevice::ReadOnly)) { - qDebug() << "Cannot read backup file " << xml_filename << " either"; + qDebug() << "Cannot read backup file " << TEMP_PATH_XML_LIST << " either"; this->removeStatusString(STR_LOADING); this->addStatusString(STR_URL_ERROR); return; } - qDebug() << "Using backup file " << xml_filename; + qDebug() << "Using backup file " << TEMP_PATH_XML_LIST; backup_file.close(); - temp_filename = xml_filename; + temp_filename = TEMP_PATH_XML_LIST; } else { QByteArray data = reply->readAll(); @@ -644,22 +644,22 @@ void Dialog::on_helpNewsButton_clicked() { void Dialog::addNewsAfterDownload(QNetworkReply* reply) { if (reply->error() != QNetworkReply::NoError) { - if (debugMode) { + if (g_debugMode) { qDebug() << "Could not get news. Try to get cached news."; } // try to get cached news - QFile backup_file(news_backup_filename); + QFile backup_file(TEMP_PATH_NEWS); if (!backup_file.open(QIODevice::ReadOnly)) { - if (debugMode) { - qDebug() << "Cannot read backup file " << news_backup_filename << " either"; + if (g_debugMode) { + qDebug() << "Cannot read backup file " << TEMP_PATH_NEWS << " either"; } this->ui->newsTextBrowser->setText(QCoreApplication::instance()->translate("Dialog", "Could not get news.")); return; } - if (debugMode) { - qDebug() << "Used backup file " << news_backup_filename; + if (g_debugMode) { + qDebug() << "Used backup file " << TEMP_PATH_NEWS; } backup_file.close(); return; @@ -694,10 +694,10 @@ void Dialog::addNewsAfterDownload(QNetworkReply* reply) { ChooserSettings::setSetting("last-news", QString::number(timestamp.toTime_t())); // make backup - QFile file(news_backup_filename); + QFile file(TEMP_PATH_NEWS); if (!file.open(QIODevice::WriteOnly)) { - if (debugMode) { - qDebug() << "Could not write XML to " << news_backup_filename; + if (g_debugMode) { + qDebug() << "Could not write XML to " << TEMP_PATH_NEWS; } return; } @@ -706,8 +706,8 @@ void Dialog::addNewsAfterDownload(QNetworkReply* reply) { return; } if (!file.setPermissions(QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther)) { - if (debugMode) { - qDebug() << "Could not change permissions of file: " << news_backup_filename; + if (g_debugMode) { + qDebug() << "Could not change permissions of file: " << TEMP_PATH_NEWS; } } file.close(); @@ -715,22 +715,22 @@ void Dialog::addNewsAfterDownload(QNetworkReply* reply) { void Dialog::addHelpAfterDownload(QNetworkReply* reply) { if (reply->error() != QNetworkReply::NoError) { - if (debugMode) { + if (g_debugMode) { qDebug() << "Could not get help xml. Try to get cached help..."; } // try to get cached news - QFile backup_file(help_backup_filename); + QFile backup_file(TEMP_PATH_HELP); if (!backup_file.open(QIODevice::ReadOnly)) { - if (debugMode) { - qDebug() << "Cannot read backup file " << help_backup_filename << " either"; + if (g_debugMode) { + qDebug() << "Cannot read backup file " << TEMP_PATH_HELP << " either"; } this->ui->helpTextBrowser->setText(QCoreApplication::instance()->translate("Dialog", "Could not get help.")); return; } - if (debugMode) { - qDebug() << "Used backup file " << help_backup_filename; + if (g_debugMode) { + qDebug() << "Used backup file " << TEMP_PATH_HELP; } backup_file.close(); return; @@ -740,7 +740,7 @@ void Dialog::addHelpAfterDownload(QNetworkReply* reply) { QDomDocument doc; if (!doc.setContent(data)) { - if (debugMode) { + if (g_debugMode) { qDebug() << "Help file contains errors."; } return; @@ -754,10 +754,10 @@ void Dialog::addHelpAfterDownload(QNetworkReply* reply) { } // make backup - QFile file(help_backup_filename); + QFile file(TEMP_PATH_HELP); if (!file.open(QIODevice::WriteOnly)) { - if (debugMode) { - qDebug() << "Could not write XML to " << help_backup_filename; + if (g_debugMode) { + qDebug() << "Could not write XML to " << TEMP_PATH_HELP; } return; } @@ -766,8 +766,8 @@ void Dialog::addHelpAfterDownload(QNetworkReply* reply) { return; } if (!file.setPermissions(QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther)) { - if (debugMode) { - qDebug() << "Could not change permissions of file: " << help_backup_filename; + if (g_debugMode) { + qDebug() << "Could not change permissions of file: " << TEMP_PATH_HELP; } } file.close(); -- cgit v1.2.3-55-g7522