Merge pull request #4251 from Chocobo1/200_scaling

Fix incorrectly displayed UI elements on Windows
This commit is contained in:
sledgehammer999 2016-02-16 15:12:54 -06:00
commit cd85d00b3b
13 changed files with 742 additions and 777 deletions

View file

@ -1,2 +1,5 @@
[Paths]
Translations = translations
[Platforms]
WindowsArguments = dpiawareness=1

View file

@ -92,7 +92,9 @@ Application::Application(const QString &id, int &argc, char **argv)
setApplicationName("qBittorrent");
initializeTranslation();
#ifndef DISABLE_GUI
setStyleSheet("QStatusBar::item { border-width: 0; }");
#ifdef QBT_USES_QT5
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
#endif // QBT_USES_QT5
setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WIN
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);

View file

@ -5,4 +5,3 @@
<file>translators.html</file>
</qresource>
</RCC>

View file

@ -7,66 +7,39 @@
<rect>
<x>0</x>
<y>0</y>
<width>504</width>
<height>320</height>
<width>545</width>
<height>295</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>504</width>
<height>320</height>
</size>
</property>
<property name="windowTitle">
<string>About qBittorrent</string>
</property>
<layout class="QVBoxLayout">
<layout class="QVBoxLayout" name="aboutDlgLayout">
<item>
<layout class="QHBoxLayout">
<layout class="QHBoxLayout" name="titleHBoxLayout">
<item>
<widget class="QLabel" name="logo">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/skin/qbittorrent32.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lb_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;h3&gt;&lt;b&gt;qBittorrent&lt;/b&gt;&lt;/h3&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
<string notr="true">qBittorrent</string>
</property>
</widget>
</item>
<item>
<spacer>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@ -78,16 +51,13 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab6">
<widget class="QWidget" name="aboutTab">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="aboutTabLayout">
<item row="0" column="0">
<widget class="QLabel" name="mascot_lbl">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/skin/mascot.png</pixmap>
</property>
@ -101,18 +71,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
@ -123,62 +89,88 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab5">
<widget class="QWidget" name="authorTab">
<attribute name="title">
<string>Author</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<layout class="QVBoxLayout" name="authorTabLayout">
<item>
<widget class="QFrame" name="te_authors">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Current maintainer</string>
</property>
<property name="verticalSpacing">
<number>6</number>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="1">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Greece</string>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<item row="2" column="1">
<widget class="QLabel" name="label_19">
<property name="text">
<string notr="true">&lt;a href=&quot;mailto:sledgehammer999@qbittorrent.org&quot;&gt;sledgehammer999@qbittorrent.org&lt;/a&gt;</string>
</property>
<property name="lineWidth">
<number>0</number>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="2">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Nationality:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>E-mail:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_17">
<property name="text">
<string notr="true">Sledgehammer999</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Original author</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="1" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>France</string>
@ -192,136 +184,49 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="2" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string notr="true">chris@qbittorrent.org</string>
<string notr="true">&lt;a href=&quot;mailto:chris@qbittorrent.org&quot;&gt;chris@qbittorrent.org&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>E-mail:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Country:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="1">
<widget class="QLabel" name="label_18">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Greece</string>
<string>Nationality:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_19">
<property name="text">
<string notr="true">sledgehammer999@qbittorrent.org</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Country:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_17">
<property name="text">
<string notr="true">Sledgehammer999</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_16">
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>E-mail:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="2" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@ -329,44 +234,37 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_21">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>Current maintainer</string>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_20">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Original author</string>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab4">
<widget class="QWidget" name="thanksTab">
<attribute name="title">
<string>Thanks to</string>
<string>Special Thanks</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
<layout class="QVBoxLayout" name="thanksTabLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="te_thanks">
@ -377,13 +275,22 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab3">
<widget class="QWidget" name="translationTab">
<attribute name="title">
<string>Translation</string>
<string>Translators</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
<layout class="QVBoxLayout" name="translationTabLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="te_translation">
@ -394,102 +301,40 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab2">
<widget class="QWidget" name="licenseTab">
<attribute name="title">
<string>License</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
<layout class="QVBoxLayout" name="licenseTabLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="te_license"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab1">
<widget class="QWidget" name="librariesTab">
<attribute name="title">
<string>Libraries</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="librariesTabLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>This version of qBittorrent was built against the following libraries:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<string>qBittorrent was built with the following libraries:</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string notr="true">Qt:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string notr="true">Boost:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_11">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_13">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_12">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string notr="true">Libtorrent:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
@ -497,14 +342,108 @@
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<widget class="QLabel" name="label_13">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string notr="true">Qt:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string notr="true">Libtorrent:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string notr="true">Boost:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_11">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_12">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>

View file

@ -33,66 +33,67 @@
#include "ui_about.h"
#include <QFile>
#include <QtGlobal>
#include <libtorrent/version.hpp>
#include <boost/version.hpp>
#include "base/unicodestrings.h"
class about : public QDialog, private Ui::AboutDlg{
class about: public QDialog, private Ui::AboutDlg
{
Q_OBJECT
public:
~about() {
qDebug("Deleting about dlg");
}
about(QWidget *parent): QDialog(parent) {
public:
about(QWidget *parent) : QDialog(parent)
{
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
// Title
lb_name->setText("<b><h2>qBittorrent " VERSION "</h2></b>");
// About
QString aboutText =
QString::fromUtf8("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\"><html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">p, li { white-space: pre-wrap; }</style></head><body style=\" font-size:11pt; font-weight:400; font-style:normal;\"><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">") +
tr("An advanced BitTorrent client programmed in <nobr>C++</nobr>, based on Qt toolkit and libtorrent-rasterbar.") +
QString::fromUtf8(" <br /><br />") +
trUtf8("Copyright %1 2006-2016 The qBittorrent project").arg(QString::fromUtf8(C_COPYRIGHT)) +
QString::fromUtf8("<br /><br />") +
tr("Home Page: ") +
QString::fromUtf8("<a href=\"http://www.qbittorrent.org\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.qbittorrent.org</span></a></p><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">") +
tr("Bug Tracker: ") +
QString::fromUtf8("<a href=\"http://bugs.qbittorrent.org\"><span style=\" text-decoration: underline; color:#0000ff;\">http://bugs.qbittorrent.org</span></a><br />") +
tr("Forum: ") +
QString::fromUtf8(
"<a href=\"http://forum.qbittorrent.org\"><span style=\" text-decoration: underline; color:#0000ff;\">http://forum.qbittorrent.org</span></a></p><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">") +
tr("IRC: #qbittorrent on Freenode") +
QString::fromUtf8(
"</p></body></html>");
QString aboutText = QString(
"<p style=\"white-space: pre-wrap;\">"
"%1\n\n"
"%2\n\n"
"<table>"
"<tr><td>%3</td><td><a href=\"http://www.qbittorrent.org\">http://www.qbittorrent.org</a></td></tr>"
"<tr><td>%4</td><td><a href=\"http://forum.qbittorrent.org\">http://forum.qbittorrent.org</a></td></tr>"
"<tr><td>%5</td><td><a href=\"http://bugs.qbittorrent.org\">http://bugs.qbittorrent.org</a></td></tr>"
"</table>"
"</p>")
.arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar."))
.arg(tr("Copyright %1 2006-2016 The qBittorrent project").arg(QString::fromUtf8(C_COPYRIGHT)))
.arg(tr("Home Page:"))
.arg(tr("Forum:"))
.arg(tr("Bug Tracker:"));
lb_about->setText(aboutText);
// Set icons
logo->setPixmap(QPixmap(QString::fromUtf8(":/icons/skin/qbittorrent22.png")));
//Title
lb_name->setText(QString::fromUtf8("<b><h1>qBittorrent")+QString::fromUtf8(" " VERSION"</h1></b>"));
// Thanks
QFile thanksfile(":/thanks.html");
if (thanksfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_thanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData()));
thanksfile.close();
}
// Translation
QFile translatorsfile(":/translators.html");
if (translatorsfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_translation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData()));
translatorsfile.close();
}
// License
QFile licensefile(":/gpl.html");
if (licensefile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_license->setHtml(QString::fromUtf8(licensefile.readAll().constData()));
licensefile.close();
}
// Libraries
label_11->setText(QT_VERSION_STR);
label_12->setText(LIBTORRENT_VERSION);
label_13->setText(QString::number(BOOST_VERSION / 100000) + "." + QString::number((BOOST_VERSION / 100) % 1000) + "." + QString::number(BOOST_VERSION % 100));
show();
}
};

View file

@ -266,28 +266,28 @@ void AddNewTorrentDialog::showEvent(QShowEvent *event)
void AddNewTorrentDialog::showAdvancedSettings(bool show)
{
const int minimumW = minimumWidth();
setMinimumWidth(width()); // to remain the same width
if (show) {
ui->adv_button->setText(QString::fromUtf8(C_UP));
ui->settings_group->setVisible(true);
ui->info_group->setVisible(true);
ui->infoGroup->setVisible(true);
if (m_hasMetadata && (m_torrentInfo.filesCount() > 1)) {
ui->content_tree->setVisible(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
}
else {
ui->content_tree->setVisible(false);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}
static_cast<QVBoxLayout*>(layout())->insertWidget(layout()->indexOf(ui->never_show_cb) + 1, ui->adv_button);
}
else {
ui->adv_button->setText(QString::fromUtf8(C_DOWN));
ui->settings_group->setVisible(false);
ui->info_group->setVisible(false);
ui->infoGroup->setVisible(false);
ui->buttonsHLayout->insertWidget(0, layout()->takeAt(layout()->indexOf(ui->never_show_cb) + 1)->widget());
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}
relayout();
adjustSize();
setMinimumWidth(minimumW);
}
void AddNewTorrentDialog::saveSavePathHistory() const
@ -348,7 +348,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
QString size_string = torrent_size ? Utils::Misc::friendlyUnit(torrent_size) : QString(tr("Not Available", "This size is unavailable."));
size_string += " (";
size_string += tr("Free disk space: %1").arg(Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath(
size_string += tr("Free space on disk: %1").arg(Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath(
ui->save_path_combo->itemData(
ui->save_path_combo->currentIndex()).toString())));
size_string += ")";
@ -360,7 +360,6 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
// Toggle default save path setting checkbox visibility
ui->default_save_path_cb->setChecked(false);
ui->default_save_path_cb->setVisible(QDir(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString()) != QDir(Preferences::instance()->getSavePath()));
relayout();
// Remember index
m_oldIndex = index;
@ -417,15 +416,6 @@ void AddNewTorrentDialog::browseButton_clicked()
connect(ui->save_path_combo, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int)));
}
void AddNewTorrentDialog::relayout()
{
qApp->processEvents();
int min_width = minimumWidth();
setMinimumWidth(width());
adjustSize();
setMinimumWidth(min_width);
}
void AddNewTorrentDialog::renameSelectedFile()
{
const QModelIndexList selectedIndexes = ui->content_tree->selectionModel()->selectedRows(0);
@ -689,7 +679,7 @@ void AddNewTorrentDialog::setupTreeview()
// Set torrent information
ui->comment_lbl->setText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment()));
ui->date_lbl->setText(!m_torrentInfo.creationDate().isNull() ? m_torrentInfo.creationDate().toString(Qt::DefaultLocaleLongDate) : tr("Not available"));
ui->date_lbl->setText(!m_torrentInfo.creationDate().isNull() ? m_torrentInfo.creationDate().toString(Qt::DefaultLocaleShortDate) : tr("Not available"));
// Prepare content tree
if (m_torrentInfo.filesCount() > 1) {

View file

@ -68,7 +68,6 @@ private slots:
void displayContentTreeMenu(const QPoint&);
void updateDiskSpaceLabel();
void onSavePathChanged(int);
void relayout();
void renameSelectedFile();
void setdialogPosition();
void updateMetadata(const BitTorrent::TorrentInfo &info);

View file

@ -10,23 +10,11 @@
<height>590</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="AddNewTorrentDialogLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Save as</string>
<string>Save at</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -34,21 +22,18 @@
<item>
<widget class="QComboBox" name="save_path_combo">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="browse_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse...</string>
</property>
@ -88,28 +73,37 @@
<property name="title">
<string>Torrent settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
<item row="0" column="0">
<widget class="QCheckBox" name="start_torrent_cb">
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="2">
<widget class="QCheckBox" name="defaultLabel">
<property name="text">
<string>Start torrent</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Set as default label</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
<item row="0" column="0">
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Label:</string>
<string>Set label:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QComboBox" name="label_combo">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
@ -120,6 +114,16 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="start_torrent_cb">
<property name="text">
<string>Start torrent</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="skip_check_cb">
<property name="text">
@ -127,24 +131,43 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="defaultLabel">
<property name="text">
<string>Set as default label</string>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="info_group">
<widget class="QGroupBox" name="infoGroup">
<property name="title">
<string>Torrent Information</string>
<string>Torrent information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="infoGroupLayout">
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0" columnstretch="0,1">
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -153,27 +176,23 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="size_lbl">
<property name="text">
<string notr="true">xx GB (xx GB available)</string>
</property>
</widget>
<widget class="QLabel" name="size_lbl"/>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Comment:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QLabel" name="comment_lbl">
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
@ -185,28 +204,24 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Date:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="date_lbl">
<property name="text">
<string notr="true">02/03/2012 20:30</string>
</property>
</widget>
<item row="1" column="1">
<widget class="QLabel" name="date_lbl"/>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Info Hash:</string>
<string>Hash:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QLabel" name="lblhash">
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
@ -231,12 +246,25 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="buttonsHLayout">
<item>
<widget class="QProgressBar" name="progMetaLoading">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -256,33 +284,10 @@
</widget>
</item>
<item>
<widget class="QLabel" name="lblMetaLoading">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLabel" name="lblMetaLoading"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>

View file

@ -97,6 +97,7 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
verticalHeader()->setVisible(false);
// etc.
setAlternatingRowColors(true);
setSelectionMode(QAbstractItemView::NoSelection);
setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals
connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int)));

View file

@ -23,29 +23,11 @@
<bool>false</bool>
</property>
<widget class="QListWidget" name="tabSelection">
<property name="autoScroll">
<bool>false</bool>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="spacing">
<number>4</number>
</property>
<property name="gridSize">
<size>
<width>110</width>
<height>60</height>
</size>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
@ -143,6 +125,9 @@
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
@ -162,7 +147,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<width>486</width>
<height>702</height>
</rect>
</property>
@ -545,6 +530,9 @@
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
@ -1058,6 +1046,9 @@
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
@ -1972,6 +1963,9 @@
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
@ -2358,14 +2352,17 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabOptionPage7">
<layout class="QVBoxLayout">
<widget class="QWidget" name="tabWebuiPage">
<layout class="QVBoxLayout" name="tabWebuiPageLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>

View file

@ -67,6 +67,7 @@ options_imp::options_imp(QWidget *parent)
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
// Icons
tabSelection->item(TAB_UI)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop"));
tabSelection->item(TAB_BITTORRENT)->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
@ -79,6 +80,10 @@ options_imp::options_imp(QWidget *parent)
tabSelection->item(TAB_WEBUI)->setHidden(true);
#endif
tabSelection->item(TAB_ADVANCED)->setIcon(GuiIconProvider::instance()->getIcon("preferences-other"));
for (int i = 0; i < tabSelection->count(); ++i) {
tabSelection->item(i)->setSizeHint(QSize(96, 64)); // uniform size for all icons
}
IpFilterRefreshBtn->setIcon(GuiIconProvider::instance()->getIcon("view-refresh"));
hsplitter->setCollapsible(0, false);

View file

@ -30,6 +30,12 @@
#include "statusbar.h"
#include <QStatusBar>
#include <QFrame>
#include <QLabel>
#include <QTimer>
#include <QPushButton>
#include <QHBoxLayout>
#include <QFontMetrics>
#include <QDebug>
@ -44,11 +50,13 @@
StatusBar::StatusBar(QStatusBar *bar)
: m_bar(bar)
{
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
Preferences* const pref = Preferences::instance();
connect(BitTorrent::Session::instance(), SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
container = new QWidget(bar);
layout = new QHBoxLayout(container);
layout->setContentsMargins(0,0,0,0);
layout->setContentsMargins(0, 0, 0, 0);
container->setLayout(layout);
connecStatusLblIcon = new QPushButton(bar);
@ -56,7 +64,7 @@ StatusBar::StatusBar(QStatusBar *bar)
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.png"));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection status:") + QString::fromUtf8("</b><br>") + QString::fromUtf8("<i>") + tr("No direct connections. This may indicate network configuration problems.") + QString::fromUtf8("</i>"));
dlSpeedLbl = new QPushButton(bar);
dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png"));
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed()));
@ -128,21 +136,24 @@ StatusBar::StatusBar(QStatusBar *bar)
refreshTimer->start(1500);
}
StatusBar::~StatusBar() {
StatusBar::~StatusBar()
{
qDebug() << Q_FUNC_INFO;
}
QPushButton* StatusBar::connectionStatusButton() const {
QPushButton* StatusBar::connectionStatusButton() const
{
return connecStatusLblIcon;
}
void StatusBar::showRestartRequired() {
void StatusBar::showRestartRequired()
{
// Restart required notification
const QString restart_text = tr("qBittorrent needs to be restarted");
QLabel *restartIconLbl = new QLabel(m_bar);
restartIconLbl->setPixmap(QPixmap(":/icons/oxygen/dialog-warning.png").scaled(QSize(24,24)));
restartIconLbl->setPixmap(QPixmap(":/icons/oxygen/dialog-warning.png").scaled(QSize(24, 24)));
restartIconLbl->setToolTip(restart_text);
m_bar->insertWidget(0,restartIconLbl);
m_bar->insertWidget(0, restartIconLbl);
QLabel *restartLbl = new QLabel(m_bar);
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
m_bar->insertWidget(1, restartLbl);
@ -151,24 +162,28 @@ void StatusBar::showRestartRequired() {
Logger::instance()->addMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), Log::CRITICAL);
}
void StatusBar::stopTimer() {
void StatusBar::stopTimer()
{
refreshTimer->stop();
}
void StatusBar::refreshStatusBar() {
void StatusBar::refreshStatusBar()
{
// Update connection status
const BitTorrent::SessionStatus sessionStatus = BitTorrent::Session::instance()->status();
if (!BitTorrent::Session::instance()->isListening()) {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/disconnected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
} else {
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection Status:") + QString::fromUtf8("</b><br>") + tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
}
else {
if (sessionStatus.hasIncomingConnections()) {
// Connection OK
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/connected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online"));
}else{
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection Status:") + QString::fromUtf8("</b><br>") + tr("Online"));
}
else {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/firewalled.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection status:") + QString::fromUtf8("</b><br>") + QString::fromUtf8("<i>") + tr("No direct connections. This may indicate network configuration problems.") + QString::fromUtf8("</i>"));
}
}
// Update Number of DHT nodes
@ -176,29 +191,32 @@ void StatusBar::refreshStatusBar() {
DHTLbl->setVisible(true);
//statusSep1->setVisible(true);
DHTLbl->setText(tr("DHT: %1 nodes").arg(QString::number(sessionStatus.dhtNodes())));
} else {
}
else {
DHTLbl->setVisible(false);
//statusSep1->setVisible(false);
}
// Update speed labels
QString speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadDownloadRate(), true)+" ("+Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload())+")";
QString speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadDownloadRate(), true) + " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload()) + ")";
int speedLimit = BitTorrent::Session::instance()->downloadRateLimit();
if (speedLimit)
speedLbl = "["+Utils::Misc::friendlyUnit(speedLimit, true)+"] " + speedLbl;
speedLbl = "[" + Utils::Misc::friendlyUnit(speedLimit, true) + "] " + speedLbl;
dlSpeedLbl->setText(speedLbl);
speedLimit = BitTorrent::Session::instance()->uploadRateLimit();
speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadUploadRate(), true)+" ("+Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload())+")";
speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadUploadRate(), true) + " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload()) + ")";
if (speedLimit)
speedLbl = "["+Utils::Misc::friendlyUnit(speedLimit, true)+"] " + speedLbl;
speedLbl = "[" + Utils::Misc::friendlyUnit(speedLimit, true) + "] " + speedLbl;
upSpeedLbl->setText(speedLbl);
}
void StatusBar::updateAltSpeedsBtn(bool alternative) {
void StatusBar::updateAltSpeedsBtn(bool alternative)
{
if (alternative) {
altSpeedsBtn->setIcon(QIcon(":/icons/slow.png"));
altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
altSpeedsBtn->setDown(true);
} else {
}
else {
altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.png"));
altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
altSpeedsBtn->setDown(false);
@ -206,14 +224,16 @@ void StatusBar::updateAltSpeedsBtn(bool alternative) {
refreshStatusBar();
}
void StatusBar::toggleAlternativeSpeeds() {
void StatusBar::toggleAlternativeSpeeds()
{
Preferences* const pref = Preferences::instance();
if (pref->isSchedulerEnabled())
m_bar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000);
BitTorrent::Session::instance()->changeSpeedLimitMode(!pref->isAltBandwidthEnabled());
}
void StatusBar::capDownloadSpeed() {
void StatusBar::capDownloadSpeed()
{
bool ok = false;
int cur_limit = BitTorrent::Session::instance()->downloadRateLimit();
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), cur_limit);
@ -227,19 +247,21 @@ void StatusBar::capDownloadSpeed() {
pref->setGlobalDownloadLimit(-1);
else
pref->setAltGlobalDownloadLimit(-1);
} else {
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
}
else {
qDebug("Setting global download rate limit to %.1fKb/s", new_limit / 1024.);
BitTorrent::Session::instance()->setDownloadRateLimit(new_limit);
if (!alt)
pref->setGlobalDownloadLimit(new_limit/1024.);
pref->setGlobalDownloadLimit(new_limit / 1024.);
else
pref->setAltGlobalDownloadLimit(new_limit/1024.);
pref->setAltGlobalDownloadLimit(new_limit / 1024.);
}
refreshStatusBar();
}
}
void StatusBar::capUploadSpeed() {
void StatusBar::capUploadSpeed()
{
bool ok = false;
int cur_limit = BitTorrent::Session::instance()->uploadRateLimit();
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), cur_limit);
@ -253,13 +275,14 @@ void StatusBar::capUploadSpeed() {
Preferences::instance()->setGlobalUploadLimit(-1);
else
Preferences::instance()->setAltGlobalUploadLimit(-1);
} else {
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
}
else {
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit / 1024.);
BitTorrent::Session::instance()->setUploadRateLimit(new_limit);
if (!alt)
Preferences::instance()->setGlobalUploadLimit(new_limit/1024.);
Preferences::instance()->setGlobalUploadLimit(new_limit / 1024.);
else
Preferences::instance()->setAltGlobalUploadLimit(new_limit/1024.);
Preferences::instance()->setAltGlobalUploadLimit(new_limit / 1024.);
}
refreshStatusBar();
}

View file

@ -31,15 +31,17 @@
#ifndef STATUSBAR_H
#define STATUSBAR_H
#include <QStatusBar>
#include <QFrame>
#include <QLabel>
#include <QTimer>
#include <QGridLayout>
#include <QPushButton>
#include <QHBoxLayout>
#include <QObject>
class StatusBar: public QObject {
class QStatusBar;
class QFrame;
class QLabel;
class QTimer;
class QPushButton;
class QHBoxLayout;
class StatusBar: public QObject
{
Q_OBJECT
public:
@ -71,7 +73,6 @@ private:
QTimer *refreshTimer;
QWidget *container;
QHBoxLayout *layout;
};
#endif // STATUSBAR_H