Browse Source

Follow project coding style. Issue #2192.

--HG--
branch : magao-dev
Tim Delaney 8 years ago
parent
commit
2e66ddb0a0
  1. 20
      src/gui/mainwindow.cpp

20
src/gui/mainwindow.cpp

@ -118,7 +118,10 @@ namespace
const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon"); const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon");
// just a shortcut // just a shortcut
inline SettingsStorage *settings() { return SettingsStorage::instance(); } inline SettingsStorage *settings()
{
return SettingsStorage::instance();
}
} }
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@ -609,7 +612,6 @@ void MainWindow::displayRSSTab(bool enable)
else if (m_rssWidget) { else if (m_rssWidget) {
delete m_rssWidget; delete m_rssWidget;
} }
} }
void MainWindow::updateRSSTabLabel(int count) void MainWindow::updateRSSTabLabel(int count)
@ -630,7 +632,6 @@ void MainWindow::displaySearchTab(bool enable)
else if (m_searchWidget) { else if (m_searchWidget) {
delete m_searchWidget; delete m_searchWidget;
} }
} }
void MainWindow::updateNbTorrents() void MainWindow::updateNbTorrents()
@ -854,10 +855,9 @@ void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
void MainWindow::on_actionExit_triggered() void MainWindow::on_actionExit_triggered()
{ {
// UI locking enforcement. // UI locking enforcement.
if (isHidden() && m_uiLocked) { if (isHidden() && m_uiLocked)
// Ask for UI lock password // Ask for UI lock password
if (!unlockUI()) return; if (!unlockUI()) return;
}
m_forceExit = true; m_forceExit = true;
close(); close();
@ -999,12 +999,11 @@ void MainWindow::closeEvent(QCloseEvent *e)
m_forceExit = false; m_forceExit = false;
return; return;
} }
if (confirmBox.clickedButton() == alwaysBtn) { if (confirmBox.clickedButton() == alwaysBtn)
// Remember choice // Remember choice
Preferences::instance()->setConfirmOnExit(false); Preferences::instance()->setConfirmOnExit(false);
} }
} }
}
// abort search if any // abort search if any
if (m_searchWidget) if (m_searchWidget)
@ -1348,8 +1347,8 @@ void MainWindow::downloadFromURLList(const QStringList& urlList)
{ {
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled(); const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
foreach (QString url, urlList) { foreach (QString url, urlList) {
if ((url.size() == 40 && !url.contains(QRegExp("[^0-9A-Fa-f]"))) if (((url.size() == 40) && !url.contains(QRegExp("[^0-9A-Fa-f]")))
|| (url.size() == 32 && !url.contains(QRegExp("[^2-7A-Za-z]")))) || ((url.size() == 32) && !url.contains(QRegExp("[^2-7A-Za-z]"))))
url = "magnet:?xt=urn:btih:" + url; url = "magnet:?xt=urn:btih:" + url;
if (useTorrentAdditionDialog) if (useTorrentAdditionDialog)
@ -1590,6 +1589,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers
if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes)) if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes))
m_programUpdateTimer->start(); m_programUpdateTimer->start();
} }
#endif #endif
void MainWindow::on_actionDonateMoney_triggered() void MainWindow::on_actionDonateMoney_triggered()
@ -1734,6 +1734,7 @@ void MainWindow::checkProgramUpdate()
connect(updater, SIGNAL(updateCheckFinished(bool,QString,bool)), SLOT(handleUpdateCheckFinished(bool,QString,bool))); connect(updater, SIGNAL(updateCheckFinished(bool,QString,bool)), SLOT(handleUpdateCheckFinished(bool,QString,bool)));
updater->checkForUpdates(); updater->checkForUpdates();
} }
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -1812,4 +1813,5 @@ void MainWindow::pythonDownloadFailure(const QString &url, const QString &error)
setCursor(QCursor(Qt::ArrowCursor)); setCursor(QCursor(Qt::ArrowCursor));
QMessageBox::warning(this, tr("Download error"), tr("Python setup could not be downloaded, reason: %1.\nPlease install it manually.").arg(error)); QMessageBox::warning(this, tr("Download error"), tr("Python setup could not be downloaded, reason: %1.\nPlease install it manually.").arg(error));
} }
#endif #endif

Loading…
Cancel
Save