Browse Source

Coding style changes

adaptive-webui-19844
Christophe Dumez 13 years ago
parent
commit
06ccae591e
  1. 2
      src/mainwindow.cpp
  2. 50
      src/preferences/options_imp.cpp
  3. 2
      src/previewlistdelegate.h
  4. 2
      src/properties/peerlistdelegate.h
  5. 4
      src/properties/proplistdelegate.h
  6. 16
      src/qtlibtorrent/qbtsession.cpp
  7. 2
      src/qtlibtorrent/qtorrenthandle.cpp
  8. 2
      src/rss/feedlistwidget.cpp
  9. 26
      src/rss/rssfeed.cpp
  10. 2
      src/searchengine/searchlistdelegate.h
  11. 2
      src/transferlistdelegate.h
  12. 2
      src/transferlistwidget.cpp

2
src/mainwindow.cpp

@ -602,7 +602,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h @@ -602,7 +602,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h
}
}
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const{
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const {
// Display a message box
showNotificationBaloon(tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason));
}

50
src/preferences/options_imp.cpp

@ -498,11 +498,11 @@ void options_imp::saveOptions() { @@ -498,11 +498,11 @@ void options_imp::saveOptions() {
advancedSettings->saveAdvancedSettings();
}
bool options_imp::isFilteringEnabled() const{
bool options_imp::isFilteringEnabled() const {
return checkIPFilter->isChecked();
}
int options_imp::getProxyType() const{
int options_imp::getProxyType() const {
switch(comboProxyType->currentIndex()) {
case 1:
return Proxy::SOCKS4;
@ -757,7 +757,7 @@ void options_imp::loadOptions() { @@ -757,7 +757,7 @@ void options_imp::loadOptions() {
// return min & max ports
// [min, max]
int options_imp::getPort() const{
int options_imp::getPort() const {
return spinPort->value();
}
@ -766,7 +766,7 @@ void options_imp::on_randomButton_clicked() { @@ -766,7 +766,7 @@ void options_imp::on_randomButton_clicked() {
spinPort->setValue(rand() % 64512 + 1024);
}
int options_imp::getEncryptionSetting() const{
int options_imp::getEncryptionSetting() const {
return comboEncryption->currentIndex();
}
@ -782,12 +782,12 @@ int options_imp::getMaxActiveTorrents() const { @@ -782,12 +782,12 @@ int options_imp::getMaxActiveTorrents() const {
return spinMaxActiveTorrents->value();
}
bool options_imp::minimizeToTray() const{
bool options_imp::minimizeToTray() const {
if (!checkShowSystray->isChecked()) return false;
return checkMinimizeToSysTray->isChecked();
}
bool options_imp::closeToTray() const{
bool options_imp::closeToTray() const {
if (!checkShowSystray->isChecked()) return false;
return checkCloseToSystray->isChecked();
}
@ -796,21 +796,21 @@ bool options_imp::isQueueingSystemEnabled() const { @@ -796,21 +796,21 @@ bool options_imp::isQueueingSystemEnabled() const {
return checkEnableQueueing->isChecked();
}
bool options_imp::isDHTEnabled() const{
bool options_imp::isDHTEnabled() const {
return checkDHT->isChecked();
}
bool options_imp::isLSDEnabled() const{
bool options_imp::isLSDEnabled() const {
return checkLSD->isChecked();
}
bool options_imp::isUPnPEnabled() const{
bool options_imp::isUPnPEnabled() const {
return checkUPnP->isChecked();
}
// Return Download & Upload limits in kbps
// [download,upload]
QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
QPair<int,int> options_imp::getGlobalBandwidthLimits() const {
int DL = -1, UP = -1;
if (checkDownloadLimit->isChecked()) {
DL = spinDownloadLimit->value();
@ -826,7 +826,7 @@ bool options_imp::startMinimized() const { @@ -826,7 +826,7 @@ bool options_imp::startMinimized() const {
return checkStartMinimized->isChecked();
}
bool options_imp::systrayIntegration() const{
bool options_imp::systrayIntegration() const {
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return checkShowSystray->isChecked();
}
@ -836,7 +836,7 @@ int options_imp::getDHTPort() const { @@ -836,7 +836,7 @@ int options_imp::getDHTPort() const {
}
// Return Share ratio
qreal options_imp::getMaxRatio() const{
qreal options_imp::getMaxRatio() const {
if (checkMaxRatio->isChecked()) {
return spinMaxRatio->value();
}
@ -844,7 +844,7 @@ qreal options_imp::getMaxRatio() const{ @@ -844,7 +844,7 @@ qreal options_imp::getMaxRatio() const{
}
// Return Save Path
QString options_imp::getSavePath() const{
QString options_imp::getSavePath() const {
if (textSavePath->text().trimmed().isEmpty()) {
QString save_path = Preferences().getSavePath();
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
@ -864,7 +864,7 @@ bool options_imp::isTempPathEnabled() const { @@ -864,7 +864,7 @@ bool options_imp::isTempPathEnabled() const {
}
// Return max connections number
int options_imp::getMaxConnecs() const{
int options_imp::getMaxConnecs() const {
if (!checkMaxConnecs->isChecked()) {
return -1;
}else{
@ -872,7 +872,7 @@ int options_imp::getMaxConnecs() const{ @@ -872,7 +872,7 @@ int options_imp::getMaxConnecs() const{
}
}
int options_imp::getMaxConnecsPerTorrent() const{
int options_imp::getMaxConnecsPerTorrent() const {
if (!checkMaxConnecsPerTorrent->isChecked()) {
return -1;
}else{
@ -880,7 +880,7 @@ int options_imp::getMaxConnecsPerTorrent() const{ @@ -880,7 +880,7 @@ int options_imp::getMaxConnecsPerTorrent() const{
}
}
int options_imp::getMaxUploadsPerTorrent() const{
int options_imp::getMaxUploadsPerTorrent() const {
if (!checkMaxUploadsPerTorrent->isChecked()) {
return -1;
}else{
@ -916,7 +916,7 @@ void options_imp::on_buttonBox_rejected() { @@ -916,7 +916,7 @@ void options_imp::on_buttonBox_rejected() {
reject();
}
bool options_imp::useAdditionDialog() const{
bool options_imp::useAdditionDialog() const {
return checkAdditionDialog->isChecked();
}
@ -971,36 +971,36 @@ bool options_imp::isDHTPortSameAsBT() const { @@ -971,36 +971,36 @@ bool options_imp::isDHTPortSameAsBT() const {
}
// Proxy settings
bool options_imp::isProxyEnabled() const{
bool options_imp::isProxyEnabled() const {
return comboProxyType->currentIndex();
}
bool options_imp::isProxyAuthEnabled() const{
bool options_imp::isProxyAuthEnabled() const {
return checkProxyAuth->isChecked();
}
QString options_imp::getProxyIp() const{
QString options_imp::getProxyIp() const {
return textProxyIP->text().trimmed();
}
unsigned short options_imp::getProxyPort() const{
unsigned short options_imp::getProxyPort() const {
return spinProxyPort->value();
}
QString options_imp::getProxyUsername() const{
QString options_imp::getProxyUsername() const {
QString username = textProxyUsername->text();
username = username.trimmed();
return username;
}
QString options_imp::getProxyPassword() const{
QString options_imp::getProxyPassword() const {
QString password = textProxyPassword->text();
password = password.trimmed();
return password;
}
// Locale Settings
QString options_imp::getLocale() const{
QString options_imp::getLocale() const {
return comboI18n->itemData(comboI18n->currentIndex(), Qt::UserRole).toString();
}
@ -1145,7 +1145,7 @@ void options_imp::on_browseTempDirButton_clicked() { @@ -1145,7 +1145,7 @@ void options_imp::on_browseTempDirButton_clicked() {
}
// Return Filter object to apply to BT session
QString options_imp::getFilter() const{
QString options_imp::getFilter() const {
return textFilterPath->text();
}

2
src/previewlistdelegate.h

@ -49,7 +49,7 @@ class PreviewListDelegate: public QItemDelegate { @@ -49,7 +49,7 @@ class PreviewListDelegate: public QItemDelegate {
~PreviewListDelegate() {}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);

2
src/properties/peerlistdelegate.h

@ -47,7 +47,7 @@ public: @@ -47,7 +47,7 @@ public:
~PeerListDelegate() {}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()) {

4
src/properties/proplistdelegate.h

@ -65,7 +65,7 @@ public: @@ -65,7 +65,7 @@ public:
~PropListDelegate() {}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()) {
@ -131,7 +131,7 @@ public: @@ -131,7 +131,7 @@ public:
painter->restore();
}
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {
QVariant value = index.data(Qt::FontRole);
QFont fnt = value.isValid() ? qvariant_cast<QFont>(value) : option.font;
QFontMetrics fontMetrics(fnt);

16
src/qtlibtorrent/qbtsession.cpp

@ -709,7 +709,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) { @@ -709,7 +709,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
}
// Return the torrent handle, given its hash
QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{
QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const {
return QTorrentHandle(s->find_torrent(QStringToSha1(hash)));
}
@ -1545,7 +1545,7 @@ bool QBtSession::enableDHT(bool b) { @@ -1545,7 +1545,7 @@ bool QBtSession::enableDHT(bool b) {
return true;
}
qreal QBtSession::getRealRatio(const QString &hash) const{
qreal QBtSession::getRealRatio(const QString &hash) const {
QTorrentHandle h = getTorrentHandle(hash);
if (!h.is_valid()) {
return 0.;
@ -1690,7 +1690,7 @@ void QBtSession::addPeerBanMessage(QString ip, bool from_ipfilter) { @@ -1690,7 +1690,7 @@ void QBtSession::addPeerBanMessage(QString ip, bool from_ipfilter) {
emit newBanMessage(msg);
}
bool QBtSession::isFilePreviewPossible(const QString &hash) const{
bool QBtSession::isFilePreviewPossible(const QString &hash) const {
// See if there are supported files in the torrent
const QTorrentHandle h = getTorrentHandle(hash);
if (!h.is_valid() || !h.has_metadata()) {
@ -2550,16 +2550,16 @@ void QBtSession::recheckTorrent(const QString &hash) { @@ -2550,16 +2550,16 @@ void QBtSession::recheckTorrent(const QString &hash) {
}
}
QHash<QString, TrackerInfos> QBtSession::getTrackersInfo(const QString &hash) const{
QHash<QString, TrackerInfos> QBtSession::getTrackersInfo(const QString &hash) const {
return trackersInfos.value(hash, QHash<QString, TrackerInfos>());
}
int QBtSession::getListenPort() const{
int QBtSession::getListenPort() const {
qDebug() << Q_FUNC_INFO << s->listen_port();
return s->listen_port();
}
session_status QBtSession::getSessionStatus() const{
session_status QBtSession::getSessionStatus() const {
return s->status();
}
@ -2674,14 +2674,14 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) { @@ -2674,14 +2674,14 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) {
// Return current download rate for the BT
// session. Payload means that it only take into
// account "useful" part of the rate
qreal QBtSession::getPayloadDownloadRate() const{
qreal QBtSession::getPayloadDownloadRate() const {
return s->status().payload_download_rate;
}
// Return current upload rate for the BT
// session. Payload means that it only take into
// account "useful" part of the rate
qreal QBtSession::getPayloadUploadRate() const{
qreal QBtSession::getPayloadUploadRate() const {
return s->status().payload_upload_rate;
}

2
src/qtlibtorrent/qtorrenthandle.cpp

@ -807,7 +807,7 @@ void QTorrentHandle::rename_file(int index, QString name) const { @@ -807,7 +807,7 @@ void QTorrentHandle::rename_file(int index, QString name) const {
// Operators
//
bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const{
bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const {
const QString hash = misc::toQString(torrent_handle::info_hash());
return (hash == new_h.hash());
}

2
src/rss/feedlistwidget.cpp

@ -149,7 +149,7 @@ QString FeedListWidget::getItemID(QTreeWidgetItem *item) const { @@ -149,7 +149,7 @@ QString FeedListWidget::getItemID(QTreeWidgetItem *item) const {
return m_rssMapping.value(item)->id();
}
QTreeWidgetItem* FeedListWidget::getTreeItemFromUrl(const QString &url) const{
QTreeWidgetItem* FeedListWidget::getTreeItemFromUrl(const QString &url) const {
return m_feedsItems.value(url, 0);
}

26
src/rss/rssfeed.cpp

@ -132,7 +132,7 @@ bool RssFeed::isLoading() const { @@ -132,7 +132,7 @@ bool RssFeed::isLoading() const {
return m_loading;
}
QString RssFeed::title() const{
QString RssFeed::title() const {
return m_title;
}
@ -143,29 +143,24 @@ void RssFeed::rename(const QString &new_name) { @@ -143,29 +143,24 @@ void RssFeed::rename(const QString &new_name) {
// Return the alias if the stream has one, the url if it has no alias
QString RssFeed::displayName() const {
if (!m_alias.isEmpty()) {
//qDebug("getName() returned alias: %s", (const char*)alias.toLocal8Bit());
if (!m_alias.isEmpty())
return m_alias;
}
if (!m_title.isEmpty()) {
//qDebug("getName() returned title: %s", (const char*)title.toLocal8Bit());
if (!m_title.isEmpty())
return m_title;
}
//qDebug("getName() returned url: %s", (const char*)url.toLocal8Bit());
return m_url;
}
QString RssFeed::url() const{
QString RssFeed::url() const {
return m_url;
}
QString RssFeed::icon() const{
QString RssFeed::icon() const {
if (m_downloadFailure)
return ":/Icons/oxygen/unavailable.png";
return m_icon;
}
bool RssFeed::hasCustomIcon() const{
bool RssFeed::hasCustomIcon() const {
return !m_icon.startsWith(":/");
}
@ -178,7 +173,7 @@ RssArticlePtr RssFeed::getItem(const QString &guid) const { @@ -178,7 +173,7 @@ RssArticlePtr RssFeed::getItem(const QString &guid) const {
return m_articles.value(guid);
}
uint RssFeed::count() const{
uint RssFeed::count() const {
return m_articles.size();
}
@ -189,7 +184,7 @@ void RssFeed::markAsRead() { @@ -189,7 +184,7 @@ void RssFeed::markAsRead() {
m_manager->forwardFeedInfosChanged(m_url, displayName(), 0);
}
uint RssFeed::unreadCount() const{
uint RssFeed::unreadCount() const {
uint nbUnread = 0;
for (RssArticleHash::ConstIterator it=m_articles.begin(); it != m_articles.end(); it++) {
if (!it.value()->isRead())
@ -198,7 +193,7 @@ uint RssFeed::unreadCount() const{ @@ -198,7 +193,7 @@ uint RssFeed::unreadCount() const{
return nbUnread;
}
RssArticleList RssFeed::articleList() const{
RssArticleList RssFeed::articleList() const {
return m_articles.values();
}
@ -213,9 +208,8 @@ RssArticleList RssFeed::unreadArticleList() const { @@ -213,9 +208,8 @@ RssArticleList RssFeed::unreadArticleList() const {
// download the icon from the adress
QString RssFeed::iconUrl() const {
const QUrl siteUrl(m_url);
// XXX: This works for most sites but it is not perfect
return QString("http://")+siteUrl.host()+QString("/favicon.ico");
return QString("http://")+QUrl(m_url).host()+QString("/favicon.ico");
}
void RssFeed::parseRSSChannel(QXmlStreamReader& xml)

2
src/searchengine/searchlistdelegate.h

@ -48,7 +48,7 @@ class SearchListDelegate: public QItemDelegate { @@ -48,7 +48,7 @@ class SearchListDelegate: public QItemDelegate {
~SearchListDelegate() {}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()) {

2
src/transferlistdelegate.h

@ -57,7 +57,7 @@ public: @@ -57,7 +57,7 @@ public:
~TransferListDelegate() {}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
painter->save();
switch(index.column()) {

2
src/transferlistwidget.cpp

@ -155,7 +155,7 @@ void TransferListWidget::setRefreshInterval(int t) { @@ -155,7 +155,7 @@ void TransferListWidget::setRefreshInterval(int t) {
listModel->setRefreshInterval(t);
}
int TransferListWidget::getRowFromHash(QString hash) const{
int TransferListWidget::getRowFromHash(QString hash) const {
return listModel->torrentRow(hash);
}

Loading…
Cancel
Save