diff --git a/src/about_imp.h b/src/about_imp.h index 03ffee7ff..7df1ebdae 100644 --- a/src/about_imp.h +++ b/src/about_imp.h @@ -45,7 +45,7 @@ class about : public QDialog, private Ui::AboutDlg{ qDebug("Deleting about dlg"); } - about(QWidget *parent): QDialog(parent){ + about(QWidget *parent): QDialog(parent) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); // Set icons diff --git a/src/downloadfromurldlg.h b/src/downloadfromurldlg.h index 370431d9a..8e0728e88 100644 --- a/src/downloadfromurldlg.h +++ b/src/downloadfromurldlg.h @@ -43,7 +43,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{ Q_OBJECT public: - downloadFromURL(QWidget *parent): QDialog(parent){ + downloadFromURL(QWidget *parent): QDialog(parent) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); setModal(true); @@ -55,26 +55,26 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{ } } - ~downloadFromURL(){} + ~downloadFromURL() {} signals: void urlsReadyToBeDownloaded(const QStringList& torrent_urls); public slots: - void on_downloadButton_clicked(){ + void on_downloadButton_clicked() { QString urls = textUrls->toPlainText(); QStringList url_list = urls.split(QString::fromUtf8("\n")); QString url; QStringList url_list_cleaned; - foreach (url, url_list){ + foreach (url, url_list) { url = url.trimmed(); - if (!url.isEmpty()){ - if (url_list_cleaned.indexOf(QRegExp(url, Qt::CaseInsensitive, QRegExp::FixedString)) < 0){ + if (!url.isEmpty()) { + if (url_list_cleaned.indexOf(QRegExp(url, Qt::CaseInsensitive, QRegExp::FixedString)) < 0) { url_list_cleaned << url; } } } - if (!url_list_cleaned.size()){ + if (!url_list_cleaned.size()) { QMessageBox::critical(0, tr("No URL entered"), tr("Please type at least one URL.")); return; } @@ -83,7 +83,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{ close(); } - void on_cancelButton_clicked(){ + void on_cancelButton_clicked() { close(); } }; diff --git a/src/downloadthread.cpp b/src/downloadthread.cpp index ed58bf179..c0e5d17dd 100644 --- a/src/downloadthread.cpp +++ b/src/downloadthread.cpp @@ -133,7 +133,7 @@ void DownloadThread::downloadTorrentUrl(const QString &url) { connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64))); } -QNetworkReply* DownloadThread::downloadUrl(const QString &url){ +QNetworkReply* DownloadThread::downloadUrl(const QString &url) { // Update proxy settings applyProxySettings(); #ifndef DISABLE_GUI @@ -208,7 +208,7 @@ void DownloadThread::applyProxySettings() { } QString DownloadThread::errorCodeToString(QNetworkReply::NetworkError status) { - switch(status){ + switch(status) { case QNetworkReply::HostNotFoundError: return tr("The remote host name was not found (invalid hostname)"); case QNetworkReply::OperationCanceledError: diff --git a/src/main.cpp b/src/main.cpp index a45998b2e..13b2e6e20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -154,7 +154,7 @@ void sigabrtHandler(int) { #endif // Main -int main(int argc, char *argv[]){ +int main(int argc, char *argv[]) { // Create Application QString uid = misc::getUserIDString(); #ifdef DISABLE_GUI @@ -192,19 +192,19 @@ int main(int argc, char *argv[]){ QString locale = pref.getLocale(); QTranslator qtTranslator; QTranslator translator; - if (locale.isEmpty()){ + if (locale.isEmpty()) { locale = QLocale::system().name(); pref.setLocale(locale); } if (qtTranslator.load( QString::fromUtf8("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath) - )){ + )) { qDebug("Qt %s locale recognized, using translation.", qPrintable(locale)); }else{ qDebug("Qt %s locale unrecognized, using default (en_GB).", qPrintable(locale)); } app.installTranslator(&qtTranslator); - if (translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){ + if (translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qPrintable(locale)); }else{ qDebug("%s locale unrecognized, using default (en_GB).", qPrintable(locale)); @@ -221,12 +221,12 @@ int main(int argc, char *argv[]){ app.setApplicationName(QString::fromUtf8("qBittorrent")); // Check for executable parameters - if (argc > 1){ - if (QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--version")){ + if (argc > 1) { + if (QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--version")) { std::cout << "qBittorrent " << VERSION << '\n'; return 0; } - if (QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--help")){ + if (QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--help")) { UsageDisplay::displayUsage(argv[0]); return 0; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6c40bc8f5..624e8bf7f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -584,7 +584,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h QString torrent_name; try { torrent_name = h.name(); - } catch(invalid_handle&){ + } catch(invalid_handle&) { return; } QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(torrent_name)); @@ -897,7 +897,7 @@ void MainWindow::dropEvent(QDropEvent *event) { // Decode if we accept drag 'n drop or not void MainWindow::dragEnterEvent(QDragEnterEvent *event) { - foreach (const QString &mime, event->mimeData()->formats()){ + foreach (const QString &mime, event->mimeData()->formats()) { qDebug("mimeData: %s", mime.toLocal8Bit().data()); } if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) { diff --git a/src/misc.cpp b/src/misc.cpp index 1e1ef5148..436d40b11 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -622,7 +622,7 @@ QString misc::friendlyUnit(qreal val) { return QString::number(val, 'f', 1) + " " + tr(units[i].source, units[i].comment); } -bool misc::isPreviewable(QString extension){ +bool misc::isPreviewable(QString extension) { if (extension.isEmpty()) return false; extension = extension.toUpper(); if (extension == "AVI") return true; @@ -911,7 +911,7 @@ QString misc::parseHtmlLinks(const QString &raw_text) ")" "|" "(" // case 2b no scheme, no TLD, must have at least 2 aphanum strings plus uncommon TLD string --> del.icio.us - "([a-zA-Z0-9_-]+\\.){2,}" //2 or more domainpart. --> del.icio. + "([a-zA-Z0-9_-]+\\.) {2,}" //2 or more domainpart. --> del.icio. "[a-zA-Z]{2,}" //one ab (2 char or longer) --> us "([a-zA-Z0-9\\?%=&/_\\.:#;-]*)" // everything to 1st non-URI char, maybe nothing in case of del.icio.us/path ")" diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 6620953b1..0ca397727 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -81,8 +81,8 @@ options_imp::options_imp(QWidget *parent): hsplitter->setCollapsible(1, false); // Get apply button in button box QList buttons = buttonBox->buttons(); - foreach (QAbstractButton *button, buttons){ - if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole){ + foreach (QAbstractButton *button, buttons) { + if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) { applyButton = button; break; } @@ -109,7 +109,7 @@ options_imp::options_imp(QWidget *parent): // Load options loadOptions(); // Disable systray integration if it is not supported by the system - if (!QSystemTrayIcon::isSystemTrayAvailable()){ + if (!QSystemTrayIcon::isSystemTrayAvailable()) { checkShowSystray->setChecked(false); checkShowSystray->setEnabled(false); } @@ -279,7 +279,7 @@ void options_imp::initializeLanguageCombo() } // Main destructor -options_imp::~options_imp(){ +options_imp::~options_imp() { qDebug("-> destructing Options"); foreach (const QString &path, addedScanDirs) ScanFoldersModel::instance()->removePath(path); @@ -343,14 +343,14 @@ QSize options_imp::sizeFittingScreen() const { return size(); } -void options_imp::saveOptions(){ +void options_imp::saveOptions() { applyButton->setEnabled(false); Preferences pref; // Load the translation QString locale = getLocale(); if (pref.getLocale() != locale) { QTranslator *translator = new QTranslator; - if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){ + if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qPrintable(locale)); }else{ qDebug("%s locale unrecognized, using default (en_GB).", qPrintable(locale)); @@ -454,7 +454,7 @@ void options_imp::saveOptions(){ // Misc preferences // * IPFilter pref.setFilteringEnabled(isFilteringEnabled()); - if (isFilteringEnabled()){ + if (isFilteringEnabled()) { QString filter_path = textFilterPath->text(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) filter_path.replace("\\", "/"); @@ -508,12 +508,12 @@ int options_imp::getProxyType() const{ return Proxy::SOCKS4; break; case 2: - if (isProxyAuthEnabled()){ + if (isProxyAuthEnabled()) { return Proxy::SOCKS5_PW; } return Proxy::SOCKS5; case 3: - if (isProxyAuthEnabled()){ + if (isProxyAuthEnabled()) { return Proxy::HTTP_PW; } return Proxy::HTTP; @@ -522,7 +522,7 @@ int options_imp::getProxyType() const{ } } -void options_imp::loadOptions(){ +void options_imp::loadOptions() { int intValue; qreal floatValue; QString strValue; @@ -812,10 +812,10 @@ bool options_imp::isUPnPEnabled() const{ // [download,upload] QPair options_imp::getGlobalBandwidthLimits() const{ int DL = -1, UP = -1; - if (checkDownloadLimit->isChecked()){ + if (checkDownloadLimit->isChecked()) { DL = spinDownloadLimit->value(); } - if (checkUploadLimit->isChecked()){ + if (checkUploadLimit->isChecked()) { UP = spinUploadLimit->value(); } return qMakePair(DL, UP); @@ -837,7 +837,7 @@ int options_imp::getDHTPort() const { // Return Share ratio qreal options_imp::getMaxRatio() const{ - if (checkMaxRatio->isChecked()){ + if (checkMaxRatio->isChecked()) { return spinMaxRatio->value(); } return -1; @@ -845,7 +845,7 @@ qreal options_imp::getMaxRatio() const{ // Return Save Path QString options_imp::getSavePath() const{ - if (textSavePath->text().trimmed().isEmpty()){ + if (textSavePath->text().trimmed().isEmpty()) { QString save_path = Preferences().getSavePath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) save_path.replace("/", "\\"); @@ -865,7 +865,7 @@ bool options_imp::isTempPathEnabled() const { // Return max connections number int options_imp::getMaxConnecs() const{ - if (!checkMaxConnecs->isChecked()){ + if (!checkMaxConnecs->isChecked()) { return -1; }else{ return spinMaxConnec->value(); @@ -873,7 +873,7 @@ int options_imp::getMaxConnecs() const{ } int options_imp::getMaxConnecsPerTorrent() const{ - if (!checkMaxConnecsPerTorrent->isChecked()){ + if (!checkMaxConnecsPerTorrent->isChecked()) { return -1; }else{ return spinMaxConnecPerTorrent->value(); @@ -881,15 +881,15 @@ int options_imp::getMaxConnecsPerTorrent() const{ } int options_imp::getMaxUploadsPerTorrent() const{ - if (!checkMaxUploadsPerTorrent->isChecked()){ + if (!checkMaxUploadsPerTorrent->isChecked()) { return -1; }else{ return spinMaxUploadsPerTorrent->value(); } } -void options_imp::on_buttonBox_accepted(){ - if (applyButton->isEnabled()){ +void options_imp::on_buttonBox_accepted() { + if (applyButton->isEnabled()) { saveOptions(); applyButton->setEnabled(false); this->hide(); @@ -900,18 +900,18 @@ void options_imp::on_buttonBox_accepted(){ } void options_imp::applySettings(QAbstractButton* button) { - if (button == applyButton){ + if (button == applyButton) { saveOptions(); emit status_changed(); } } -void options_imp::closeEvent(QCloseEvent *e){ +void options_imp::closeEvent(QCloseEvent *e) { setAttribute(Qt::WA_DeleteOnClose); e->accept(); } -void options_imp::on_buttonBox_rejected(){ +void options_imp::on_buttonBox_rejected() { setAttribute(Qt::WA_DeleteOnClose); reject(); } @@ -920,12 +920,12 @@ bool options_imp::useAdditionDialog() const{ return checkAdditionDialog->isChecked(); } -void options_imp::enableApplyButton(){ +void options_imp::enableApplyButton() { applyButton->setEnabled(true); } -void options_imp::enableProxy(int index){ - if (index){ +void options_imp::enableProxy(int index) { + if (index) { //enable lblProxyIP->setEnabled(true); textProxyIP->setEnabled(true); @@ -1084,7 +1084,7 @@ void options_imp::on_browseExportDirButton_clicked() { } else { dir = QFileDialog::getExistingDirectory(this, tr("Choose export directory"), QDir::homePath()); } - if (!dir.isNull()){ + if (!dir.isNull()) { #if defined(Q_WS_WIN) || defined(Q_OS_OS2) dir.replace("/", "\\"); #endif @@ -1101,7 +1101,7 @@ void options_imp::on_browseFilterButton_clicked() { } else { ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); } - if (!ipfilter.isNull()){ + if (!ipfilter.isNull()) { #if defined(Q_WS_WIN) || defined(Q_OS_OS2) ipfilter.replace("/", "\\"); #endif @@ -1110,7 +1110,7 @@ void options_imp::on_browseFilterButton_clicked() { } // Display dialog to choose save dir -void options_imp::on_browseSaveDirButton_clicked(){ +void options_imp::on_browseSaveDirButton_clicked() { const QString save_path = misc::expandPath(textSavePath->text()); QDir saveDir(save_path); QString dir; @@ -1119,7 +1119,7 @@ void options_imp::on_browseSaveDirButton_clicked(){ } else { dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); } - if (!dir.isNull()){ + if (!dir.isNull()) { #if defined(Q_WS_WIN) || defined(Q_OS_OS2) dir.replace("/", "\\"); #endif @@ -1127,7 +1127,7 @@ void options_imp::on_browseSaveDirButton_clicked(){ } } -void options_imp::on_browseTempDirButton_clicked(){ +void options_imp::on_browseTempDirButton_clicked() { const QString temp_path = misc::expandPath(textTempPath->text()); QDir tempDir(temp_path); QString dir; @@ -1136,7 +1136,7 @@ void options_imp::on_browseTempDirButton_clicked(){ } else { dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); } - if (!dir.isNull()){ + if (!dir.isNull()) { #if defined(Q_WS_WIN) || defined(Q_OS_OS2) dir.replace("/", "\\"); #endif diff --git a/src/previewlistdelegate.h b/src/previewlistdelegate.h index b489a5d55..7f2f24632 100644 --- a/src/previewlistdelegate.h +++ b/src/previewlistdelegate.h @@ -45,15 +45,15 @@ class PreviewListDelegate: public QItemDelegate { Q_OBJECT public: - PreviewListDelegate(QObject *parent=0) : QItemDelegate(parent){} + PreviewListDelegate(QObject *parent=0) : QItemDelegate(parent) {} - ~PreviewListDelegate(){} + ~PreviewListDelegate() {} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); - switch(index.column()){ + switch(index.column()) { case PreviewSelect::SIZE: QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); diff --git a/src/previewselect.cpp b/src/previewselect.cpp index e14cc4473..1867430dc 100644 --- a/src/previewselect.cpp +++ b/src/previewselect.cpp @@ -40,7 +40,7 @@ #include "previewlistdelegate.h" #include "previewselect.h" -PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent), h(h){ +PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent), h(h) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); // Preview list @@ -56,7 +56,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent) std::vector fp; h.file_progress(fp); unsigned int nbFiles = h.num_files(); - for (unsigned int i=0; iselectionModel()->select(previewListModel->index(0, NAME), QItemSelectionModel::Select); previewList->selectionModel()->select(previewListModel->index(0, SIZE), QItemSelectionModel::Select); previewList->selectionModel()->select(previewListModel->index(0, PROGRESS), QItemSelectionModel::Select); - if (!previewListModel->rowCount()){ + if (!previewListModel->rowCount()) { QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file")); close(); } connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString))); - if (previewListModel->rowCount() == 1){ + if (previewListModel->rowCount() == 1) { qDebug("Torrent file only contains one file, no need to display selection dialog before preview"); // Only one file : no choice on_previewButton_clicked(); @@ -86,13 +86,13 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent) } } -PreviewSelect::~PreviewSelect(){ +PreviewSelect::~PreviewSelect() { delete previewListModel; delete listDelegate; } -void PreviewSelect::on_previewButton_clicked(){ +void PreviewSelect::on_previewButton_clicked() { QModelIndex index; QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME); if (selectedIndexes.size() == 0) return; @@ -100,10 +100,10 @@ void PreviewSelect::on_previewButton_clicked(){ h.flush_cache(); QString path; - foreach (index, selectedIndexes){ + foreach (index, selectedIndexes) { path = h.absolute_files_path().at(indexes.at(index.row())); // File - if (QFile::exists(path)){ + if (QFile::exists(path)) { emit readyToPreviewFile(path); } else { QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file")); @@ -116,6 +116,6 @@ void PreviewSelect::on_previewButton_clicked(){ close(); } -void PreviewSelect::on_cancelButton_clicked(){ +void PreviewSelect::on_cancelButton_clicked() { close(); } diff --git a/src/properties/peeraddition.h b/src/properties/peeraddition.h index 8232f9d6e..7c5709292 100644 --- a/src/properties/peeraddition.h +++ b/src/properties/peeraddition.h @@ -55,7 +55,7 @@ public: connect(buttonBox, SIGNAL(accepted()), this, SLOT(validateInput())); } - ~PeerAdditionDlg(){} + ~PeerAdditionDlg() {} QString getIP() const { QHostAddress ip(lineIP->text()); diff --git a/src/properties/peerlistdelegate.h b/src/properties/peerlistdelegate.h index e48931a90..3312e0f59 100644 --- a/src/properties/peerlistdelegate.h +++ b/src/properties/peerlistdelegate.h @@ -43,14 +43,14 @@ public: TOT_DOWN, TOT_UP, IP_HIDDEN, COL_COUNT}; public: - PeerListDelegate(QObject *parent) : QItemDelegate(parent){} + PeerListDelegate(QObject *parent) : QItemDelegate(parent) {} - ~PeerListDelegate(){} + ~PeerListDelegate() {} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); - switch(index.column()){ + switch(index.column()) { case TOT_DOWN: case TOT_UP: QItemDelegate::drawBackground(painter, opt, index); diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 9be0fc8e3..9f389beec 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -400,12 +400,12 @@ void PropertiesWidget::loadDynamicData() { } catch(invalid_handle e) {} } -void PropertiesWidget::loadUrlSeeds(){ +void PropertiesWidget::loadUrlSeeds() { listWebSeeds->clear(); qDebug("Loading URL seeds"); const QStringList hc_seeds = h.url_seeds(); // Add url seeds - foreach (const QString &hc_seed, hc_seeds){ + foreach (const QString &hc_seed, hc_seeds) { qDebug("Loading URL seed: %s", qPrintable(hc_seed)); new QListWidgetItem(hc_seed, listWebSeeds); } @@ -450,7 +450,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) { } } -void PropertiesWidget::displayFilesListMenu(const QPoint&){ +void PropertiesWidget::displayFilesListMenu(const QPoint&) { QMenu myFilesLlistMenu; QModelIndexList selectedRows = filesList->selectionModel()->selectedRows(0); QAction *actRename = 0; @@ -616,7 +616,7 @@ void PropertiesWidget::renameSelectedFile() { } } -void PropertiesWidget::askWebSeed(){ +void PropertiesWidget::askWebSeed() { bool ok; // Ask user for a new url seed const QString url_seed = QInputDialog::getText(this, tr("New url seed", "New HTTP source"), @@ -635,15 +635,15 @@ void PropertiesWidget::askWebSeed(){ loadUrlSeeds(); } -void PropertiesWidget::deleteSelectedUrlSeeds(){ +void PropertiesWidget::deleteSelectedUrlSeeds() { const QList selectedItems = listWebSeeds->selectedItems(); bool change = false; - foreach (const QListWidgetItem *item, selectedItems){ + foreach (const QListWidgetItem *item, selectedItems) { QString url_seed = item->text(); h.remove_url_seed(url_seed); change = true; } - if (change){ + if (change) { // Refresh list loadUrlSeeds(); } @@ -674,7 +674,7 @@ void PropertiesWidget::on_changeSavePathButton_clicked() { new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(), QFileDialog::DontConfirmOverwrite|QFileDialog::ShowDirsOnly|QFileDialog::HideNameFilterDetails); } - if (!new_path.isEmpty()){ + if (!new_path.isEmpty()) { // Check if savePath exists QString save_path_dir = new_path.replace("\\", "/"); QString new_file_name; diff --git a/src/properties/proplistdelegate.h b/src/properties/proplistdelegate.h index b33e1eff5..7530f682e 100644 --- a/src/properties/proplistdelegate.h +++ b/src/properties/proplistdelegate.h @@ -60,15 +60,15 @@ signals: void filteredFilesChanged() const; public: - PropListDelegate(PropertiesWidget* properties=0, QObject *parent=0) : QItemDelegate(parent), properties(properties){ + PropListDelegate(PropertiesWidget* properties=0, QObject *parent=0) : QItemDelegate(parent), properties(properties) { } - ~PropListDelegate(){} + ~PropListDelegate() {} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); - switch(index.column()){ + switch(index.column()) { case PCSIZE: QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); diff --git a/src/properties/trackerlist.cpp b/src/properties/trackerlist.cpp index 20e1d77e8..7b1758ca5 100644 --- a/src/properties/trackerlist.cpp +++ b/src/properties/trackerlist.cpp @@ -108,7 +108,7 @@ void TrackerList::moveSelectionUp() { QList selected_items = getSelectedTrackerItems(); if (selected_items.isEmpty()) return; bool change = false; - foreach (QTreeWidgetItem *item, selected_items){ + foreach (QTreeWidgetItem *item, selected_items) { int index = indexOfTopLevelItem(item); if (index > NB_STICKY_ITEM) { insertTopLevelItem(index-1, takeTopLevelItem(index)); @@ -273,7 +273,7 @@ void TrackerList::loadTrackers() { } // Ask the user for new trackers and add them to the torrent -void TrackerList::askForTrackers(){ +void TrackerList::askForTrackers() { QTorrentHandle h = properties->getCurrentTorrent(); if (!h.is_valid()) return; QStringList trackers = TrackersAdditionDlg::askForTrackers(h); @@ -291,7 +291,7 @@ void TrackerList::askForTrackers(){ } } -void TrackerList::deleteSelectedTrackers(){ +void TrackerList::deleteSelectedTrackers() { QTorrentHandle h = properties->getCurrentTorrent(); if (!h.is_valid()) { clear(); @@ -300,7 +300,7 @@ void TrackerList::deleteSelectedTrackers(){ QList selected_items = getSelectedTrackerItems(); if (selected_items.isEmpty()) return; QStringList urls_to_remove; - foreach (QTreeWidgetItem *item, selected_items){ + foreach (QTreeWidgetItem *item, selected_items) { QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString(); urls_to_remove << tracker_url; tracker_items.remove(tracker_url); diff --git a/src/properties/trackersadditiondlg.h b/src/properties/trackersadditiondlg.h index 624551a58..70e80d1ff 100644 --- a/src/properties/trackersadditiondlg.h +++ b/src/properties/trackersadditiondlg.h @@ -58,7 +58,7 @@ public: list_url->setCursorPosition(0); } - ~TrackersAdditionDlg(){} + ~TrackersAdditionDlg() {} QStringList newTrackers() const { return trackers_list->toPlainText().trimmed().split("\n"); diff --git a/src/qtlibtorrent/filterparserthread.h b/src/qtlibtorrent/filterparserthread.h index 2bd04dddd..3384a3384 100644 --- a/src/qtlibtorrent/filterparserthread.h +++ b/src/qtlibtorrent/filterparserthread.h @@ -59,7 +59,7 @@ public: } - ~FilterParserThread(){ + ~FilterParserThread() { abort = true; wait(); } @@ -68,8 +68,8 @@ public: int parseDATFilterFile(QString filePath) { int ruleCount = 0; QFile file(filePath); - if (file.exists()){ - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + if (file.exists()) { + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { std::cerr << "I/O Error: Could not open ip filer file in read mode." << std::endl; return ruleCount; } @@ -141,7 +141,7 @@ public: try { filter.add_rule(startAddr, endAddr, libtorrent::ip_filter::blocked); ++ruleCount; - }catch(exception){ + }catch(exception) { qDebug("Bad line in filter file, avoided crash..."); } } @@ -154,8 +154,8 @@ public: int parseP2PFilterFile(QString filePath) { int ruleCount = 0; QFile file(filePath); - if (file.exists()){ - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + if (file.exists()) { + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { std::cerr << "I/O Error: Could not open ip filer file in read mode." << std::endl; return ruleCount; } @@ -168,7 +168,7 @@ public: if (line.startsWith('#') || line.startsWith("//")) continue; // Line is splitted by : QList partsList = line.split(':'); - if (partsList.size() < 2){ + if (partsList.size() < 2) { qDebug("p2p file: line %d is malformed.", nbLine); continue; } @@ -246,8 +246,8 @@ public: int parseP2BFilterFile(QString filePath) { int ruleCount = 0; QFile file(filePath); - if (file.exists()){ - if (!file.open(QIODevice::ReadOnly)){ + if (file.exists()) { + if (!file.open(QIODevice::ReadOnly)) { std::cerr << "I/O Error: Could not open ip filer file in read mode." << std::endl; return ruleCount; } @@ -351,7 +351,7 @@ public: // * eMule IP list (DAT): http://wiki.phoenixlabs.org/wiki/DAT_Format // * PeerGuardian Text (P2P): http://wiki.phoenixlabs.org/wiki/P2P_Format // * PeerGuardian Binary (P2B): http://wiki.phoenixlabs.org/wiki/P2B_Format - void processFilterFile(QString _filePath){ + void processFilterFile(QString _filePath) { // First, import current filter filter = s->get_ip_filter(); if (isRunning()) { @@ -392,7 +392,7 @@ protected: return ip.toString(); } - void run(){ + void run() { qDebug("Processing filter file"); int ruleCount = 0; if (filePath.endsWith(".p2p", Qt::CaseInsensitive)) { @@ -412,7 +412,7 @@ protected: try { s->set_ip_filter(filter); emit IPFilterParsed(ruleCount); - } catch(std::exception&){ + } catch(std::exception&) { emit IPFilterError(); } qDebug("IP Filter thread: finished parsing, filter applied"); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 0781ed69f..02de601c2 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -922,7 +922,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) { // Adding torrent to Bittorrent session try { h = QTorrentHandle(add_magnet_uri(*s, magnet_uri.toStdString(), p)); - }catch(std::exception e){ + }catch(std::exception e) { qDebug("Error: %s", e.what()); } // Check if it worked @@ -1114,7 +1114,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr // Adding torrent to Bittorrent session try { h = QTorrentHandle(s->add_torrent(p)); - }catch(std::exception e){ + }catch(std::exception e) { qDebug("Error: %s", e.what()); } // Check if it worked @@ -1585,7 +1585,7 @@ void QBtSession::saveTempFastResumeData() { if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue; qDebug("Saving fastresume data for %s", qPrintable(h.name())); h.save_resume_data(); - }catch(std::exception e){} + }catch(std::exception e) {} } } @@ -1630,7 +1630,7 @@ void QBtSession::saveFastResumeData() { // Remove torrent from session if (rda->handle.is_valid()) s->remove_torrent(rda->handle); - }catch(libtorrent::libtorrent_exception){} + }catch(libtorrent::libtorrent_exception) {} continue; } save_resume_data_alert const* rd = dynamic_cast(a); @@ -1659,7 +1659,7 @@ void QBtSession::saveFastResumeData() { // Remove torrent from session s->remove_torrent(rd->handle); s->pop_alert(); - } catch(libtorrent::invalid_handle&){} + } catch(libtorrent::invalid_handle&) {} } } @@ -2405,7 +2405,7 @@ void QBtSession::readAlerts() { else if (tracker_error_alert* p = dynamic_cast(a.get())) { // Level: fatal QTorrentHandle h(p->handle); - if (h.is_valid()){ + if (h.is_valid()) { // Authentication if (p->status_code != 401) { qDebug("Received a tracker error for %s: %s", p->url.c_str(), p->msg.c_str()); @@ -2422,7 +2422,7 @@ void QBtSession::readAlerts() { } else if (tracker_reply_alert* p = dynamic_cast(a.get())) { const QTorrentHandle h(p->handle); - if (h.is_valid()){ + if (h.is_valid()) { qDebug("Received a tracker reply from %s (Num_peers=%d)", p->url.c_str(), p->num_peers); // Connection was successful now. Remove possible old errors QHash trackers_data = trackersInfos.value(h.hash(), QHash()); @@ -2435,7 +2435,7 @@ void QBtSession::readAlerts() { } } else if (tracker_warning_alert* p = dynamic_cast(a.get())) { const QTorrentHandle h(p->handle); - if (h.is_valid()){ + if (h.is_valid()) { // Connection was successful now but there is a warning message QHash trackers_data = trackersInfos.value(h.hash(), QHash()); const QString tracker_url = misc::toQString(p->url); @@ -2504,7 +2504,7 @@ void QBtSession::readAlerts() { } else if (torrent_checked_alert* p = dynamic_cast(a.get())) { QTorrentHandle h(p->handle); - if (h.is_valid()){ + if (h.is_valid()) { const QString hash = h.hash(); qDebug("%s have just finished checking", qPrintable(hash)); // Save seed status diff --git a/src/qtlibtorrent/torrentspeedmonitor.cpp b/src/qtlibtorrent/torrentspeedmonitor.cpp index f94c621dc..561925bdd 100644 --- a/src/qtlibtorrent/torrentspeedmonitor.cpp +++ b/src/qtlibtorrent/torrentspeedmonitor.cpp @@ -41,7 +41,7 @@ using namespace libtorrent; class SpeedSample { public: - SpeedSample(){} + SpeedSample() {} void addSample(int s); qreal average() const; void clear(); @@ -106,7 +106,7 @@ void TorrentSpeedMonitor::removeSamples(const QString &hash) void TorrentSpeedMonitor::removeSamples(const QTorrentHandle& h) { try { m_samples.remove(h.hash()); - } catch(invalid_handle&){} + } catch(invalid_handle&) {} } qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const @@ -133,6 +133,6 @@ void TorrentSpeedMonitor::getSamples() if (!it->is_paused()) m_samples[misc::toQString(it->info_hash())].addSample(it->status().download_payload_rate); #endif - } catch(invalid_handle&){} + } catch(invalid_handle&) {} } } diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index 8db1c8d50..5a5d2bebe 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -62,7 +62,7 @@ enum ArticleRoles { } // display a right-click menu -void RSSImp::displayRSSListMenu(const QPoint& pos){ +void RSSImp::displayRSSListMenu(const QPoint& pos) { if (!m_feedList->indexAt(pos).isValid()) { // No item under the mouse, clear selection m_feedList->clearSelection(); @@ -99,7 +99,7 @@ void RSSImp::displayRSSListMenu(const QPoint& pos){ myRSSListMenu.exec(QCursor::pos()); } -void RSSImp::displayItemsListMenu(const QPoint&){ +void RSSImp::displayItemsListMenu(const QPoint&) { QMenu myItemListMenu(this); QList selectedItems = listArticles->selectedItems(); if (selectedItems.size() > 0) { @@ -203,7 +203,7 @@ void RSSImp::on_newFeedButton_clicked() { QString newUrl = QInputDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok); if (ok) { newUrl = newUrl.trimmed(); - if (!newUrl.isEmpty()){ + if (!newUrl.isEmpty()) { if (m_feedList->hasFeed(newUrl)) { QMessageBox::warning(this, tr("qBittorrent"), tr("This rss feed is already in the list."), @@ -242,8 +242,8 @@ void RSSImp::deleteSelectedItems() { tr("&Yes"), tr("&No"), QString(), 0, 1); if (!ret) { - foreach (QTreeWidgetItem *item, selectedItems){ - if (m_feedList->currentFeed() == item){ + foreach (QTreeWidgetItem *item, selectedItems) { + if (m_feedList->currentFeed() == item) { textBrowser->clear(); m_currentArticle = 0; listArticles->clear(); @@ -374,7 +374,7 @@ void RSSImp::renameFiles() { //right-click on stream : refresh it void RSSImp::refreshSelectedItems() { QList selectedItems = m_feedList->selectedItems(); - foreach (QTreeWidgetItem* item, selectedItems){ + foreach (QTreeWidgetItem* item, selectedItems) { RssFilePtr file = m_feedList->getRSSItem(item); // Update icons if (item == m_feedList->stickyUnreadItem()) { @@ -402,7 +402,7 @@ void RSSImp::copySelectedFeedsURL() { QStringList URLs; QList selectedItems = m_feedList->selectedItems(); QTreeWidgetItem* item; - foreach (item, selectedItems){ + foreach (item, selectedItems) { if (m_feedList->isFeed(item)) URLs << m_feedList->getItemID(item); } @@ -412,7 +412,7 @@ void RSSImp::copySelectedFeedsURL() { void RSSImp::on_markReadButton_clicked() { QList selectedItems = m_feedList->selectedItems(); QTreeWidgetItem* item; - foreach (item, selectedItems){ + foreach (item, selectedItems) { RssFilePtr rss_item = m_feedList->getRSSItem(item); rss_item->markAsRead(); updateItemInfos(item); @@ -428,7 +428,7 @@ void RSSImp::fillFeedsList(QTreeWidgetItem *parent, const RssFolderPtr& rss_pare } else { children = m_rssManager->getContent(); } - foreach (const RssFilePtr& rss_child, children){ + foreach (const RssFilePtr& rss_child, children) { QTreeWidgetItem* item; if (!parent) item = new QTreeWidgetItem(m_feedList); @@ -471,12 +471,12 @@ void RSSImp::refreshArticleList(QTreeWidgetItem* item) { m_currentArticle = 0; listArticles->clear(); qDebug("Got the list of news"); - foreach (const RssArticlePtr &article, news){ + foreach (const RssArticlePtr &article, news) { QListWidgetItem* it = new QListWidgetItem(listArticles); it->setData(Article::TitleRole, article->title()); it->setData(Article::FeedUrlRole, article->parent()->url()); it->setData(Article::IdRole, article->guid()); - if (article->isRead()){ + if (article->isRead()) { it->setData(Article::ColorRole, QVariant(QColor("grey"))); it->setData(Article::IconRole, QVariant(QIcon(":/Icons/sphere.png"))); }else{ @@ -571,12 +571,12 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item) { updateItemInfos(item->parent()); } -void RSSImp::updateFeedIcon(const QString &url, const QString &icon_path){ +void RSSImp::updateFeedIcon(const QString &url, const QString &icon_path) { QTreeWidgetItem *item = m_feedList->getTreeItemFromUrl(url); item->setData(0,Qt::DecorationRole, QVariant(QIcon(icon_path))); } -void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, uint nbUnread){ +void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, uint nbUnread) { qDebug() << Q_FUNC_INFO << display_name; QTreeWidgetItem *item = m_feedList->getTreeItemFromUrl(url); RssFeedPtr stream = qSharedPointerCast(m_feedList->getRSSItem(item)); @@ -589,7 +589,7 @@ void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, ui // Update Unread item updateItemInfos(m_feedList->stickyUnreadItem()); // If the feed is selected, update the displayed news - if (m_feedList->currentItem() == item ){ + if (m_feedList->currentItem() == item ) { refreshArticleList(item); } else { // Update unread items @@ -670,7 +670,7 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent), m_rssManager(new RssManager) qDebug("RSSImp constructed"); } -RSSImp::~RSSImp(){ +RSSImp::~RSSImp() { qDebug("Deleting RSSImp..."); saveFoldersOpenState(); delete m_feedList; diff --git a/src/rss/rssarticle.cpp b/src/rss/rssarticle.cpp index 2ae9538f3..9091a6483 100644 --- a/src/rss/rssarticle.cpp +++ b/src/rss/rssarticle.cpp @@ -315,7 +315,7 @@ bool RssArticle::isRead() const{ return m_read; } -void RssArticle::markAsRead(){ +void RssArticle::markAsRead() { m_read = true; } diff --git a/src/rss/rssdownloadrulelist.h b/src/rss/rssdownloadrulelist.h index 21df2b6e8..3a133e889 100644 --- a/src/rss/rssdownloadrulelist.h +++ b/src/rss/rssdownloadrulelist.h @@ -34,9 +34,8 @@ #include #include #include - #include "rssdownloadrule.h" - +s // This class is not thread-safe (not required) class RssDownloadRuleList { diff --git a/src/rss/rssfeed.cpp b/src/rss/rssfeed.cpp index 0fa5e4e95..707bd5e90 100644 --- a/src/rss/rssfeed.cpp +++ b/src/rss/rssfeed.cpp @@ -55,7 +55,7 @@ RssFeed::RssFeed(RssManager* manager, RssFolder* parent, const QString &url): loadItemsFromDisk(); } -RssFeed::~RssFeed(){ +RssFeed::~RssFeed() { if (!m_icon.startsWith(":/") && QFile::exists(m_icon)) QFile::remove(m_icon); } @@ -136,7 +136,7 @@ QString RssFeed::title() const{ return m_title; } -void RssFeed::rename(const QString &new_name){ +void RssFeed::rename(const QString &new_name) { qDebug() << "Renaming stream to" << new_name; m_alias = new_name; } @@ -321,14 +321,14 @@ void RssFeed::resizeList() { RssArticleList listItems = m_articles.values(); RssManager::sortNewsList(listItems); const int excess = nb_articles - max_articles; - for (uint i=nb_articles-excess; iguid()); } } } // existing and opening test after download -bool RssFeed::parseXmlFile(const QString &file_path){ +bool RssFeed::parseXmlFile(const QString &file_path) { qDebug("openRss() called"); QFile fileRss(file_path); if (!fileRss.open(QIODevice::ReadOnly | QIODevice::Text)) { diff --git a/src/rss/rssfeed.h b/src/rss/rssfeed.h index ea43ba30e..f3badb54a 100644 --- a/src/rss/rssfeed.h +++ b/src/rss/rssfeed.h @@ -41,7 +41,7 @@ class RssManager; typedef QHash RssArticleHash; typedef QSharedPointer RssFeedPtr; -typedef QList RssFeedList; +typedef RssFeedList RssFeedList; class RssFeed: public QObject, public RssFile { Q_OBJECT diff --git a/src/rss/rssmanager.cpp b/src/rss/rssmanager.cpp index 0816f8220..e454c2142 100644 --- a/src/rss/rssmanager.cpp +++ b/src/rss/rssmanager.cpp @@ -45,7 +45,7 @@ RssManager::RssManager(): m_refreshTimer.start(m_refreshInterval*60000); } -RssManager::~RssManager(){ +RssManager::~RssManager() { qDebug("Deleting RSSManager..."); delete m_rssDownloader; delete m_downloadRules; @@ -54,7 +54,7 @@ RssManager::~RssManager(){ qDebug("RSSManager deleted"); } -void RssManager::updateRefreshInterval(uint val){ +void RssManager::updateRefreshInterval(uint val) { if (m_refreshInterval != val) { m_refreshInterval = val; m_refreshTimer.start(m_refreshInterval*60000); @@ -66,13 +66,13 @@ void RssManager::loadStreamList() { RssSettings settings; const QStringList streamsUrl = settings.getRssFeedsUrls(); const QStringList aliases = settings.getRssFeedsAliases(); - if (streamsUrl.size() != aliases.size()){ + if (streamsUrl.size() != aliases.size()) { std::cerr << "Corrupted Rss list, not loading it\n"; return; } uint i = 0; qDebug() << Q_FUNC_INFO << streamsUrl; - foreach (QString s, streamsUrl){ + foreach (QString s, streamsUrl) { QStringList path = s.split("\\", QString::SkipEmptyParts); if (path.empty()) continue; const QString feed_url = path.takeLast(); diff --git a/src/searchengine/engineselectdlg.cpp b/src/searchengine/engineselectdlg.cpp index bf43628c6..f105dcf86 100644 --- a/src/searchengine/engineselectdlg.cpp +++ b/src/searchengine/engineselectdlg.cpp @@ -96,7 +96,7 @@ void engineSelectDlg::dropEvent(QDropEvent *event) { // Decode if we accept drag 'n drop or not void engineSelectDlg::dragEnterEvent(QDragEnterEvent *event) { QString mime; - foreach (mime, event->mimeData()->formats()){ + foreach (mime, event->mimeData()->formats()) { qDebug("mimeData: %s", qPrintable(mime)); } if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) { @@ -195,14 +195,14 @@ void engineSelectDlg::enableSelection(bool enable) { } // Set the color of a row in data model -void engineSelectDlg::setRowColor(int row, QString color){ +void engineSelectDlg::setRowColor(int row, QString color) { QTreeWidgetItem *item = pluginsTree->topLevelItem(row); - for (int i=0; icolumnCount(); ++i){ + for (int i=0; icolumnCount(); ++i) { item->setData(i, Qt::ForegroundRole, QVariant(QColor(color))); } } -QList engineSelectDlg::findItemsWithUrl(QString url){ +QList engineSelectDlg::findItemsWithUrl(QString url) { QList res; for (int i=0; itopLevelItemCount(); ++i) { QTreeWidgetItem *item = pluginsTree->topLevelItem(i); @@ -212,7 +212,7 @@ QList engineSelectDlg::findItemsWithUrl(QString url){ return res; } -QTreeWidgetItem* engineSelectDlg::findItemWithID(QString id){ +QTreeWidgetItem* engineSelectDlg::findItemWithID(QString id) { QList res; for (int i=0; itopLevelItemCount(); ++i) { QTreeWidgetItem *item = pluginsTree->topLevelItem(i); @@ -353,7 +353,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) { qDebug("Checking if update is needed"); bool file_correct = false; QFile versions(versions_file); - if (!versions.open(QIODevice::ReadOnly | QIODevice::Text)){ + if (!versions.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug("* Error: Could not read versions.txt file"); return false; } @@ -398,13 +398,13 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) { void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { setCursor(QCursor(Qt::ArrowCursor)); qDebug("engineSelectDlg received %s", qPrintable(url)); - if (url.endsWith("favicon.ico", Qt::CaseInsensitive)){ + if (url.endsWith("favicon.ico", Qt::CaseInsensitive)) { // Icon downloaded QImage fileIcon; if (fileIcon.load(filePath)) { QList items = findItemsWithUrl(url); QTreeWidgetItem *item; - foreach (item, items){ + foreach (item, items) { QString id = item->text(ENGINE_ID); QString iconPath; QFile icon(filePath); @@ -439,7 +439,7 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { void engineSelectDlg::handleDownloadFailure(QString url, QString reason) { setCursor(QCursor(Qt::ArrowCursor)); - if (url.endsWith("favicon.ico", Qt::CaseInsensitive)){ + if (url.endsWith("favicon.ico", Qt::CaseInsensitive)) { qDebug("Could not download favicon: %s, reason: %s", qPrintable(url), qPrintable(reason)); return; } diff --git a/src/searchengine/pluginsource.h b/src/searchengine/pluginsource.h index 514a3ea71..aea63711b 100644 --- a/src/searchengine/pluginsource.h +++ b/src/searchengine/pluginsource.h @@ -53,13 +53,13 @@ class pluginSourceDlg: public QDialog, private Ui::pluginSourceDlg { } public: - pluginSourceDlg(QWidget* parent): QDialog(parent){ + pluginSourceDlg(QWidget* parent): QDialog(parent) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); show(); } - ~pluginSourceDlg(){} + ~pluginSourceDlg() {} }; #endif diff --git a/src/searchengine/searchengine.cpp b/src/searchengine/searchengine.cpp index fc5485275..5381168c2 100644 --- a/src/searchengine/searchengine.cpp +++ b/src/searchengine/searchengine.cpp @@ -183,7 +183,7 @@ QString SearchEngine::selectedCategory() const { return comboCategory->itemData(comboCategory->currentIndex()).toString(); } -SearchEngine::~SearchEngine(){ +SearchEngine::~SearchEngine() { qDebug("Search destruction"); // save the searchHistory for later uses saveSearchHistory(); @@ -273,7 +273,7 @@ void SearchEngine::on_enginesButton_clicked() { } // get the last searchs from a QIniSettings to a QStringList -void SearchEngine::startSearchHistory(){ +void SearchEngine::startSearchHistory() { QIniSettings settings("qBittorrent", "qBittorrent"); searchHistory.setStringList(settings.value("Search/searchHistory",QStringList()).toStringList()); } @@ -294,7 +294,7 @@ void SearchEngine::giveFocusToSearchInput() { } // Function called when we click on search button -void SearchEngine::on_search_button_clicked(){ +void SearchEngine::on_search_button_clicked() { #ifdef Q_WS_WIN if (!has_python) { if (QMessageBox::question(this, tr("Missing Python Interpreter"), @@ -306,7 +306,7 @@ void SearchEngine::on_search_button_clicked(){ return; } #endif - if (searchProcess->state() != QProcess::NotRunning){ + if (searchProcess->state() != QProcess::NotRunning) { #ifdef Q_WS_WIN searchProcess->kill(); #else @@ -327,7 +327,7 @@ void SearchEngine::on_search_button_clicked(){ const QString pattern = search_pattern->text().trimmed(); // No search pattern entered - if (pattern.isEmpty()){ + if (pattern.isEmpty()) { QMessageBox::critical(0, tr("Empty search pattern"), tr("Please type a search pattern first")); return; } @@ -344,7 +344,7 @@ void SearchEngine::on_search_button_clicked(){ #endif // if the pattern is not in the pattern QStringList wordList = searchHistory.stringList(); - if (wordList.indexOf(pattern) == -1){ + if (wordList.indexOf(pattern) == -1) { //update the searchHistory list wordList.append(pattern); // verify the max size of the history @@ -399,7 +399,7 @@ void SearchEngine::saveResultsColumnsWidth() { if (!line.isEmpty()) { width_list = line.split(' '); } - for (short i=0; icolumnWidth(i)<1 && width_list.size() == nbColumns && width_list.at(i).toInt()>=1) { // load the former width new_width_list << width_list.at(i); @@ -439,7 +439,7 @@ void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) { } } -void SearchEngine::searchStarted(){ +void SearchEngine::searchStarted() { // Update SearchEngine widgets search_status->setText(tr("Searching...")); search_status->repaint(); @@ -449,16 +449,16 @@ void SearchEngine::searchStarted(){ // search Qprocess return output as soon as it gets new // stuff to read. We split it into lines and add each // line to search results calling appendSearchResult(). -void SearchEngine::readSearchOutput(){ +void SearchEngine::readSearchOutput() { QByteArray output = searchProcess->readAllStandardOutput(); output.replace("\r", ""); QList lines_list = output.split('\n'); - if (!search_result_line_truncated.isEmpty()){ + if (!search_result_line_truncated.isEmpty()) { QByteArray end_of_line = lines_list.takeFirst(); lines_list.prepend(search_result_line_truncated+end_of_line); } search_result_line_truncated = lines_list.takeLast().trimmed(); - foreach (const QByteArray &line, lines_list){ + foreach (const QByteArray &line, lines_list) { appendSearchResult(QString::fromUtf8(line)); } if (currentSearchTab) @@ -490,7 +490,7 @@ void SearchEngine::updateNova() { QFile package_file(search_dir.absoluteFilePath("__init__.py")); package_file.open(QIODevice::WriteOnly | QIODevice::Text); package_file.close(); - if (!search_dir.exists("engines")){ + if (!search_dir.exists("engines")) { search_dir.mkdir("engines"); } QFile package_file2(search_dir.absolutePath().replace("\\", "/")+"/engines/__init__.py"); @@ -508,7 +508,7 @@ void SearchEngine::updateNova() { filePath = search_dir.absoluteFilePath("nova2dl.py"); if (getPluginVersion(":/"+nova_folder+"/nova2dl.py") > getPluginVersion(filePath)) { - if (QFile::exists(filePath)){ + if (QFile::exists(filePath)) { QFile::remove(filePath); QFile::remove(filePath+"c"); } @@ -517,7 +517,7 @@ void SearchEngine::updateNova() { filePath = search_dir.absoluteFilePath("novaprinter.py"); if (getPluginVersion(":/"+nova_folder+"/novaprinter.py") > getPluginVersion(filePath)) { - if (QFile::exists(filePath)){ + if (QFile::exists(filePath)) { QFile::remove(filePath); QFile::remove(filePath+"c"); } @@ -526,7 +526,7 @@ void SearchEngine::updateNova() { filePath = search_dir.absoluteFilePath("helpers.py"); if (getPluginVersion(":/"+nova_folder+"/helpers.py") > getPluginVersion(filePath)) { - if (QFile::exists(filePath)){ + if (QFile::exists(filePath)) { QFile::remove(filePath); QFile::remove(filePath+"c"); } @@ -534,7 +534,7 @@ void SearchEngine::updateNova() { } filePath = search_dir.absoluteFilePath("socks.py"); - if (QFile::exists(filePath)){ + if (QFile::exists(filePath)) { QFile::remove(filePath); QFile::remove(filePath+"c"); } @@ -542,7 +542,7 @@ void SearchEngine::updateNova() { if (nova_folder == "nova3") { filePath = search_dir.absoluteFilePath("sgmllib3.py"); - if (QFile::exists(filePath)){ + if (QFile::exists(filePath)) { QFile::remove(filePath); QFile::remove(filePath+"c"); } @@ -551,7 +551,7 @@ void SearchEngine::updateNova() { QDir destDir(QDir(misc::searchEngineLocation()).absoluteFilePath("engines")); QDir shipped_subDir(":/"+nova_folder+"/engines/"); QStringList files = shipped_subDir.entryList(); - foreach (const QString &file, files){ + foreach (const QString &file, files) { QString shipped_file = shipped_subDir.absoluteFilePath(file); // Copy python classes if (file.endsWith(".py")) { @@ -580,7 +580,7 @@ void SearchEngine::updateNova() { // Slot called when search is Finished // Search can be finished for 3 reasons : // Error | Stopped by user | Finished normally -void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ +void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus) { if (searchTimeout->isActive()) { searchTimeout->stop(); } @@ -589,17 +589,17 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ if (useNotificationBalloons && mp_mainWindow->getCurrentTabWidget() != this) { mp_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished")); } - if (exitcode){ + if (exitcode) { #ifdef Q_WS_WIN search_status->setText(tr("Search aborted")); #else search_status->setText(tr("An error occured during search...")); #endif }else{ - if (search_stopped){ + if (search_stopped) { search_status->setText(tr("Search aborted")); }else{ - if (no_search_results){ + if (no_search_results) { search_status->setText(tr("Search returned no results")); }else{ search_status->setText(tr("Search has finished")); @@ -614,9 +614,9 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ // SLOT to append one line to search results list // Line is in the following form : // file url | file name | file size | nb seeds | nb leechers | Search engine url -void SearchEngine::appendSearchResult(const QString &line){ +void SearchEngine::appendSearchResult(const QString &line) { if (!currentSearchTab) { - if (searchProcess->state() != QProcess::NotRunning){ + if (searchProcess->state() != QProcess::NotRunning) { searchProcess->terminate(); } if (searchTimeout->isActive()) { @@ -627,7 +627,7 @@ void SearchEngine::appendSearchResult(const QString &line){ } const QStringList parts = line.split("|"); const int nb_fields = parts.size(); - if (nb_fields < NB_PLUGIN_COLUMNS-1){ //-1 because desc_link is optional + if (nb_fields < NB_PLUGIN_COLUMNS-1) { //-1 because desc_link is optional return; } Q_ASSERT(currentSearchTab); @@ -669,7 +669,7 @@ void SearchEngine::appendSearchResult(const QString &line){ void SearchEngine::closeTab(int index) { if (index == tabWidget->indexOf(currentSearchTab)) { qDebug("Deleted current search Tab"); - if (searchProcess->state() != QProcess::NotRunning){ + if (searchProcess->state() != QProcess::NotRunning) { searchProcess->terminate(); } if (searchTimeout->isActive()) { @@ -686,13 +686,13 @@ void SearchEngine::closeTab(int index) { } #else // Clear search results list -void SearchEngine::closeTab_button_clicked(){ +void SearchEngine::closeTab_button_clicked() { if (all_tab.size()) { qDebug("currentTab rank: %d", tabWidget->currentIndex()); qDebug("currentSearchTab rank: %d", tabWidget->indexOf(currentSearchTab)); if (tabWidget->currentIndex() == tabWidget->indexOf(currentSearchTab)) { qDebug("Deleted current search Tab"); - if (searchProcess->state() != QProcess::NotRunning){ + if (searchProcess->state() != QProcess::NotRunning) { searchProcess->terminate(); } if (searchTimeout->isActive()) { @@ -711,11 +711,11 @@ void SearchEngine::closeTab_button_clicked(){ #endif // Download selected items in search results list -void SearchEngine::on_download_button_clicked(){ +void SearchEngine::on_download_button_clicked() { //QModelIndexList selectedIndexes = currentSearchTab->getCurrentTreeView()->selectionModel()->selectedIndexes(); QModelIndexList selectedIndexes = all_tab.at(tabWidget->currentIndex())->getCurrentTreeView()->selectionModel()->selectedIndexes(); - foreach (const QModelIndex &index, selectedIndexes){ - if (index.column() == NAME){ + foreach (const QModelIndex &index, selectedIndexes) { + if (index.column() == NAME) { // Get Item url QSortFilterProxyModel* model = all_tab.at(tabWidget->currentIndex())->getCurrentSearchListProxy(); QString torrent_url = model->data(model->index(index.row(), URL_COLUMN)).toString(); @@ -729,7 +729,7 @@ void SearchEngine::on_download_button_clicked(){ void SearchEngine::on_goToDescBtn_clicked() { QModelIndexList selectedIndexes = all_tab.at(tabWidget->currentIndex())->getCurrentTreeView()->selectionModel()->selectedIndexes(); - foreach (const QModelIndex &index, selectedIndexes){ + foreach (const QModelIndex &index, selectedIndexes) { if (index.column() == NAME) { QSortFilterProxyModel* model = all_tab.at(tabWidget->currentIndex())->getCurrentSearchListProxy(); const QString desc_url = model->data(model->index(index.row(), DESC_LINK)).toString(); diff --git a/src/searchengine/searchengine.h b/src/searchengine/searchengine.h index 44f86e359..ef92427b3 100644 --- a/src/searchengine/searchengine.h +++ b/src/searchengine/searchengine.h @@ -65,17 +65,17 @@ public: static qreal getPluginVersion(QString filePath) { QFile plugin(filePath); - if (!plugin.exists()){ + if (!plugin.exists()) { qDebug("%s plugin does not exist, returning 0.0", qPrintable(filePath)); return 0.0; } - if (!plugin.open(QIODevice::ReadOnly | QIODevice::Text)){ + if (!plugin.open(QIODevice::ReadOnly | QIODevice::Text)) { return 0.0; } qreal version = 0.0; - while (!plugin.atEnd()){ + while (!plugin.atEnd()) { QByteArray line = plugin.readLine(); - if (line.startsWith("#VERSION: ")){ + if (line.startsWith("#VERSION: ")) { line = line.split(' ').last().trimmed(); version = line.toFloat(); qDebug("plugin %s version: %.2f", qPrintable(filePath), version); diff --git a/src/searchengine/searchlistdelegate.h b/src/searchengine/searchlistdelegate.h index 3e3804cb8..5b7e956ae 100644 --- a/src/searchengine/searchlistdelegate.h +++ b/src/searchengine/searchlistdelegate.h @@ -44,14 +44,14 @@ class SearchListDelegate: public QItemDelegate { Q_OBJECT public: - SearchListDelegate(QObject *parent=0) : QItemDelegate(parent){} + SearchListDelegate(QObject *parent=0) : QItemDelegate(parent) {} - ~SearchListDelegate(){} + ~SearchListDelegate() {} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); - switch(index.column()){ + switch(index.column()) { case SearchEngine::SIZE: QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); diff --git a/src/searchengine/searchtab.cpp b/src/searchengine/searchtab.cpp index 2f26780b4..097b0831a 100644 --- a/src/searchengine/searchtab.cpp +++ b/src/searchengine/searchtab.cpp @@ -77,7 +77,7 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget(), parent(parent) connect(resultsBrowser, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(downloadSelectedItem(const QModelIndex&))); // Load last columns width for search results list - if (!loadColWidthResultsList()){ + if (!loadColWidthResultsList()) { resultsBrowser->header()->resizeSection(0, 275); } @@ -114,7 +114,7 @@ bool SearchTab::loadColWidthResultsList() { if (width_list.size() < SearchListModel->columnCount()) return false; unsigned int listSize = width_list.size(); - for (unsigned int i=0; iheader()->resizeSection(i, width_list.at(i).toInt()); } return true; @@ -141,9 +141,9 @@ QStandardItemModel* SearchTab::getCurrentSearchListModel() const } // Set the color of a row in data model -void SearchTab::setRowColor(int row, QString color){ +void SearchTab::setRowColor(int row, QString color) { proxyModel->setDynamicSortFilter(false); - for (int i=0; icolumnCount(); ++i){ + for (int i=0; icolumnCount(); ++i) { proxyModel->setData(proxyModel->index(row, i), QVariant(QColor(color)), Qt::ForegroundRole); } proxyModel->setDynamicSortFilter(true); diff --git a/src/speedlimitdlg.h b/src/speedlimitdlg.h index 31cf58570..7e4cd8da8 100644 --- a/src/speedlimitdlg.h +++ b/src/speedlimitdlg.h @@ -50,7 +50,7 @@ class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg { move(misc::screenCenter(this)); } - ~SpeedLimitDialog(){ + ~SpeedLimitDialog() { qDebug("Deleting bandwidth allocation dialog"); } @@ -75,7 +75,7 @@ class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg { protected slots: void updateSpinValue(int val) const { qDebug("Called updateSpinValue with %d", val); - if (val <= 0){ + if (val <= 0) { spinBandwidth->setValue(0); spinBandwidth->setSpecialValueText(QString::fromUtf8("∞")); spinBandwidth->setSuffix(QString::fromUtf8("")); diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index c215e29af..58de2b425 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -253,7 +253,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { throw std::exception(); } catch(std::exception&) { qDebug("Caught error loading torrent"); - if (!from_url.isNull()){ + if (!from_url.isNull()) { QBtSession::instance()->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red")); QFile::remove(filePath); }else{ @@ -278,7 +278,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { hash = misc::toQString(t->info_hash()); // Use left() to remove .old extension QString newFileName; - if (fileName.endsWith(QString::fromUtf8(".old"))){ + if (fileName.endsWith(QString::fromUtf8(".old"))) { newFileName = fileName.left(fileName.size()-4); }else{ newFileName = fileName; @@ -526,7 +526,7 @@ void torrentAdditionDialog::updateDiskSpaceLabels() { } } -void torrentAdditionDialog::on_browseButton_clicked(){ +void torrentAdditionDialog::on_browseButton_clicked() { Q_ASSERT(!is_magnet); QString new_path; QString root_folder; @@ -546,7 +546,7 @@ void torrentAdditionDialog::on_browseButton_clicked(){ } } else { QString truncated_path = getCurrentTruncatedSavePath(&root_folder); - if (!truncated_path.isEmpty() && QDir(truncated_path).exists()){ + if (!truncated_path.isEmpty() && QDir(truncated_path).exists()) { new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), truncated_path); }else{ new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath()); @@ -583,7 +583,7 @@ void torrentAdditionDialog::on_browseButton_clicked(){ } } -void torrentAdditionDialog::on_CancelButton_clicked(){ +void torrentAdditionDialog::on_CancelButton_clicked() { close(); } @@ -592,17 +592,17 @@ bool torrentAdditionDialog::allFiltered() const { return PropListModel->model()->allFiltered(); } -void torrentAdditionDialog::savePiecesPriorities(){ +void torrentAdditionDialog::savePiecesPriorities() { qDebug("Saving pieces priorities"); Q_ASSERT(!is_magnet); const std::vector priorities = PropListModel->model()->getFilesPriorities(t->num_files()); TorrentTempData::setFilesPriority(hash, priorities); } -void torrentAdditionDialog::on_OkButton_clicked(){ +void torrentAdditionDialog::on_OkButton_clicked() { Preferences pref; qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER"; - if (savePathTxt->currentText().trimmed().isEmpty()){ + if (savePathTxt->currentText().trimmed().isEmpty()) { QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path")); return; } @@ -671,7 +671,7 @@ void torrentAdditionDialog::on_OkButton_clicked(){ } } // Check if there is at least one selected file - if (!is_magnet && t->num_files() > 1 && allFiltered()){ + if (!is_magnet && t->num_files() > 1 && allFiltered()) { QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent")); return; } @@ -683,8 +683,8 @@ void torrentAdditionDialog::on_OkButton_clicked(){ pref.setSavePath(getCurrentTruncatedSavePath()); // Check if savePath exists - if (!savePath.exists()){ - if (!savePath.mkpath(savePath.path())){ + if (!savePath.exists()) { + if (!savePath.mkpath(savePath.path())) { QMessageBox::critical(0, tr("Save path creation error"), tr("Could not create the save path")); return; } diff --git a/src/torrentcreator/torrentcreatordlg.cpp b/src/torrentcreator/torrentcreatordlg.cpp index 8d0bf7960..d8c04aff5 100644 --- a/src/torrentcreator/torrentcreatordlg.cpp +++ b/src/torrentcreator/torrentcreatordlg.cpp @@ -67,7 +67,7 @@ TorrentCreatorDlg::~TorrentCreatorDlg() { delete creatorThread; } -void TorrentCreatorDlg::on_addFolder_button_clicked(){ +void TorrentCreatorDlg::on_addFolder_button_clicked() { QIniSettings settings("qBittorrent", "qBittorrent"); QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString(); QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), last_path, QFileDialog::ShowDirsOnly); @@ -83,7 +83,7 @@ void TorrentCreatorDlg::on_addFolder_button_clicked(){ } } -void TorrentCreatorDlg::on_addFile_button_clicked(){ +void TorrentCreatorDlg::on_addFile_button_clicked() { QIniSettings settings("qBittorrent", "qBittorrent"); QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString(); QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), last_path); @@ -104,11 +104,11 @@ int TorrentCreatorDlg::getPieceSize() const { } // Main function that create a .torrent file -void TorrentCreatorDlg::on_createButton_clicked(){ +void TorrentCreatorDlg::on_createButton_clicked() { QString input = textInputPath->text().trimmed(); if (input.endsWith(QDir::separator())) input.chop(1); - if (input.isEmpty()){ + if (input.isEmpty()) { QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first")); return; } diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index 2d2a5c966..dbd9d7a98 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -89,7 +89,7 @@ void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStri start(); } -void sendProgressUpdateSignal(int i, int num, TorrentCreatorThread *parent){ +void sendProgressUpdateSignal(int i, int num, TorrentCreatorThread *parent) { parent->sendProgressSignal((int)(i*100./(float)num)); } @@ -108,7 +108,7 @@ void TorrentCreatorThread::run() { create_torrent t(fs, piece_size); // Add url seeds - foreach (const QString &seed, url_seeds){ + foreach (const QString &seed, url_seeds) { t.add_url_seed(seed.trimmed().toStdString()); } foreach (const QString &tracker, trackers) { @@ -138,7 +138,7 @@ void TorrentCreatorThread::run() { } else { throw std::exception(); } - } catch (std::exception& e){ + } catch (std::exception& e) { emit creationFailure(QString::fromLocal8Bit(e.what())); } } diff --git a/src/torrentpersistentdata.h b/src/torrentpersistentdata.h index 6ab919d80..072a169a6 100644 --- a/src/torrentpersistentdata.h +++ b/src/torrentpersistentdata.h @@ -118,7 +118,7 @@ public: return data.value("sequential", false).toBool(); } - static void setSeedingMode(QString hash,bool seed){ + static void setSeedingMode(QString hash,bool seed) { QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QHash all_data = settings.value("torrents-tmp").toHash(); QHash data = all_data.value(hash).toHash(); @@ -127,7 +127,7 @@ public: settings.setValue("torrents-tmp", all_data); } - static bool isSeedingMode(QString hash){ + static bool isSeedingMode(QString hash) { QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); const QHash all_data = settings.value("torrents-tmp").toHash(); const QHash data = all_data.value(hash).toHash(); diff --git a/src/trackerlogin.h b/src/trackerlogin.h index 59249d2a2..7572d7d09 100644 --- a/src/trackerlogin.h +++ b/src/trackerlogin.h @@ -44,7 +44,7 @@ class trackerLogin : public QDialog, private Ui::authentication{ QTorrentHandle h; public: - trackerLogin(QWidget *parent, QTorrentHandle h): QDialog(parent), h(h){ + trackerLogin(QWidget *parent, QTorrentHandle h): QDialog(parent), h(h) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); login_logo->setPixmap(QPixmap(QString::fromUtf8(":/Icons/oxygen/encrypted.png"))); @@ -53,19 +53,19 @@ class trackerLogin : public QDialog, private Ui::authentication{ show(); } - ~trackerLogin(){} + ~trackerLogin() {} signals: void trackerLoginCancelled(QPair tracker); public slots: - void on_loginButton_clicked(){ + void on_loginButton_clicked() { // login h.set_tracker_login(lineUsername->text(), linePasswd->text()); close(); } - void on_cancelButton_clicked(){ + void on_cancelButton_clicked() { // Emit a signal to GUI to stop asking for authentication emit trackerLoginCancelled(QPair(h, h.current_tracker())); close(); diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index c2a8d2eb9..b5720c165 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -53,14 +53,14 @@ class TransferListDelegate: public QItemDelegate { Q_OBJECT public: - TransferListDelegate(QObject *parent) : QItemDelegate(parent){} + TransferListDelegate(QObject *parent) : QItemDelegate(parent) {} - ~TransferListDelegate(){} + ~TransferListDelegate() {} void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); painter->save(); - switch(index.column()){ + switch(index.column()) { case TorrentModelItem::TR_AMOUNT_DOWNLOADED: case TorrentModelItem::TR_AMOUNT_LEFT: case TorrentModelItem::TR_SIZE:{ diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 232e1066a..4b6cb1591 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -323,7 +323,7 @@ void TransferListWidget::increasePrioSelectedTorrents() { if (!h.is_seed()) { torrent_queue.push(qMakePair(h.queue_position(), h)); } - }catch(invalid_handle&){} + }catch(invalid_handle&) {} } // Increase torrents priority (starting with the ones with highest priority) while(!torrent_queue.empty()) { @@ -347,7 +347,7 @@ void TransferListWidget::decreasePrioSelectedTorrents() { if (!h.is_seed()) { torrent_queue.push(qMakePair(h.queue_position(), h)); } - }catch(invalid_handle&){} + }catch(invalid_handle&) {} } // Decrease torrents priority (starting with the ones with lowest priority) while(!torrent_queue.empty()) { @@ -520,7 +520,7 @@ void TransferListWidget::recheckSelectedTorrents() { } // hide/show columns menu -void TransferListWidget::displayDLHoSMenu(const QPoint&){ +void TransferListWidget::displayDLHoSMenu(const QPoint&) { QMenu hideshowColumn(this); hideshowColumn.setTitle(tr("Column visibility")); QList actions; diff --git a/src/webui/eventmanager.cpp b/src/webui/eventmanager.cpp index 434888854..99011d903 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/eventmanager.cpp @@ -120,7 +120,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) { QString locale = m["locale"].toString(); if (pref.getLocale() != locale) { QTranslator *translator = new QTranslator; - if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){ + if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qPrintable(locale)); }else{ qDebug("%s locale unrecognized, using default (en_GB).", qPrintable(locale)); diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 9a78a6516..e61c9bbf1 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -394,9 +394,9 @@ void HttpConnection::respondCommand(const QString& command) { if (command == "download") { QString urls = m_parser.post("urls"); QStringList list = urls.split('\n'); - foreach (QString url, list){ + foreach (QString url, list) { url = url.trimmed(); - if (!url.isEmpty()){ + if (!url.isEmpty()) { if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) { qDebug("Converting bc link to magnet link"); url = misc::bcLinkToMagnet(url); @@ -600,7 +600,7 @@ void HttpConnection::respondCommand(const QString& command) { } return; } - if (command == "recheck"){ + if (command == "recheck") { QBtSession::instance()->recheckTorrent(m_parser.post("hash")); return; } @@ -618,7 +618,7 @@ void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) { if (!h.is_seed()) { torrent_queue.push(qMakePair(h.queue_position(), h)); } - }catch(invalid_handle&){} + }catch(invalid_handle&) {} } // Decrease torrents priority (starting with the ones with lowest priority) while(!torrent_queue.empty()) { @@ -643,7 +643,7 @@ void HttpConnection::increaseTorrentsPriority(const QStringList &hashes) if (!h.is_seed()) { torrent_queue.push(qMakePair(h.queue_position(), h)); } - }catch(invalid_handle&){} + }catch(invalid_handle&) {} } // Increase torrents priority (starting with the ones with highest priority) while(!torrent_queue.empty()) {