Browse Source

Merge pull request #4251 from Chocobo1/200_scaling

Fix incorrectly displayed UI elements on Windows
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
cd85d00b3b
  1. 3
      dist/windows/qt.conf
  2. 4
      src/app/application.cpp
  3. 1
      src/gui/about.qrc
  4. 455
      src/gui/about.ui
  5. 57
      src/gui/about_imp.h
  6. 26
      src/gui/addnewtorrentdialog.cpp
  7. 1
      src/gui/addnewtorrentdialog.h
  8. 179
      src/gui/addnewtorrentdialog.ui
  9. 1
      src/gui/advancedsettings.cpp
  10. 47
      src/gui/options.ui
  11. 5
      src/gui/options_imp.cpp
  12. 87
      src/gui/statusbar.cpp
  13. 19
      src/gui/statusbar.h

3
dist/windows/qt.conf vendored

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

4
src/app/application.cpp

@ -92,7 +92,9 @@ Application::Application(const QString &id, int &argc, char **argv)
setApplicationName("qBittorrent"); setApplicationName("qBittorrent");
initializeTranslation(); initializeTranslation();
#ifndef DISABLE_GUI #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); setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection); connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);

1
src/gui/about.qrc

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

455
src/gui/about.ui

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

57
src/gui/about_imp.h

@ -33,66 +33,67 @@
#include "ui_about.h" #include "ui_about.h"
#include <QFile> #include <QFile>
#include <QtGlobal>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#include "base/unicodestrings.h" #include "base/unicodestrings.h"
class about : public QDialog, private Ui::AboutDlg{ class about: public QDialog, private Ui::AboutDlg
{
Q_OBJECT Q_OBJECT
public: public:
~about() { about(QWidget *parent) : QDialog(parent)
qDebug("Deleting about dlg"); {
}
about(QWidget *parent): QDialog(parent) {
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
// Title
lb_name->setText("<b><h2>qBittorrent " VERSION "</h2></b>");
// About // About
QString aboutText = QString aboutText = QString(
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;\">") + "<p style=\"white-space: pre-wrap;\">"
tr("An advanced BitTorrent client programmed in <nobr>C++</nobr>, based on Qt toolkit and libtorrent-rasterbar.") + "%1\n\n"
QString::fromUtf8(" <br /><br />") + "%2\n\n"
trUtf8("Copyright %1 2006-2016 The qBittorrent project").arg(QString::fromUtf8(C_COPYRIGHT)) + "<table>"
QString::fromUtf8("<br /><br />") + "<tr><td>%3</td><td><a href=\"http://www.qbittorrent.org\">http://www.qbittorrent.org</a></td></tr>"
tr("Home Page: ") + "<tr><td>%4</td><td><a href=\"http://forum.qbittorrent.org\">http://forum.qbittorrent.org</a></td></tr>"
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><td>%5</td><td><a href=\"http://bugs.qbittorrent.org\">http://bugs.qbittorrent.org</a></td></tr>"
tr("Bug Tracker: ") + "</table>"
QString::fromUtf8("<a href=\"http://bugs.qbittorrent.org\"><span style=\" text-decoration: underline; color:#0000ff;\">http://bugs.qbittorrent.org</span></a><br />") + "</p>")
tr("Forum: ") + .arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar."))
QString::fromUtf8( .arg(tr("Copyright %1 2006-2016 The qBittorrent project").arg(QString::fromUtf8(C_COPYRIGHT)))
"<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;\">") + .arg(tr("Home Page:"))
tr("IRC: #qbittorrent on Freenode") + .arg(tr("Forum:"))
QString::fromUtf8( .arg(tr("Bug Tracker:"));
"</p></body></html>");
lb_about->setText(aboutText); 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 // Thanks
QFile thanksfile(":/thanks.html"); QFile thanksfile(":/thanks.html");
if (thanksfile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (thanksfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_thanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData())); te_thanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData()));
thanksfile.close(); thanksfile.close();
} }
// Translation // Translation
QFile translatorsfile(":/translators.html"); QFile translatorsfile(":/translators.html");
if (translatorsfile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (translatorsfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_translation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData())); te_translation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData()));
translatorsfile.close(); translatorsfile.close();
} }
// License // License
QFile licensefile(":/gpl.html"); QFile licensefile(":/gpl.html");
if (licensefile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (licensefile.open(QIODevice::ReadOnly | QIODevice::Text)) {
te_license->setHtml(QString::fromUtf8(licensefile.readAll().constData())); te_license->setHtml(QString::fromUtf8(licensefile.readAll().constData()));
licensefile.close(); licensefile.close();
} }
// Libraries // Libraries
label_11->setText(QT_VERSION_STR); label_11->setText(QT_VERSION_STR);
label_12->setText(LIBTORRENT_VERSION); label_12->setText(LIBTORRENT_VERSION);
label_13->setText(QString::number(BOOST_VERSION / 100000) + "." + QString::number((BOOST_VERSION / 100) % 1000) + "." + QString::number(BOOST_VERSION % 100)); label_13->setText(QString::number(BOOST_VERSION / 100000) + "." + QString::number((BOOST_VERSION / 100) % 1000) + "." + QString::number(BOOST_VERSION % 100));
show(); show();
} }
}; };

26
src/gui/addnewtorrentdialog.cpp

@ -266,28 +266,28 @@ void AddNewTorrentDialog::showEvent(QShowEvent *event)
void AddNewTorrentDialog::showAdvancedSettings(bool show) void AddNewTorrentDialog::showAdvancedSettings(bool show)
{ {
const int minimumW = minimumWidth();
setMinimumWidth(width()); // to remain the same width
if (show) { if (show) {
ui->adv_button->setText(QString::fromUtf8(C_UP)); ui->adv_button->setText(QString::fromUtf8(C_UP));
ui->settings_group->setVisible(true); ui->settings_group->setVisible(true);
ui->info_group->setVisible(true); ui->infoGroup->setVisible(true);
if (m_hasMetadata && (m_torrentInfo.filesCount() > 1)) { if (m_hasMetadata && (m_torrentInfo.filesCount() > 1)) {
ui->content_tree->setVisible(true); ui->content_tree->setVisible(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
} }
else { else {
ui->content_tree->setVisible(false); 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); static_cast<QVBoxLayout*>(layout())->insertWidget(layout()->indexOf(ui->never_show_cb) + 1, ui->adv_button);
} }
else { else {
ui->adv_button->setText(QString::fromUtf8(C_DOWN)); ui->adv_button->setText(QString::fromUtf8(C_DOWN));
ui->settings_group->setVisible(false); 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()); 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 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.")); QString size_string = torrent_size ? Utils::Misc::friendlyUnit(torrent_size) : QString(tr("Not Available", "This size is unavailable."));
size_string += " ("; 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->itemData(
ui->save_path_combo->currentIndex()).toString()))); ui->save_path_combo->currentIndex()).toString())));
size_string += ")"; size_string += ")";
@ -360,7 +360,6 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
// Toggle default save path setting checkbox visibility // Toggle default save path setting checkbox visibility
ui->default_save_path_cb->setChecked(false); 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())); 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 // Remember index
m_oldIndex = index; m_oldIndex = index;
@ -417,15 +416,6 @@ void AddNewTorrentDialog::browseButton_clicked()
connect(ui->save_path_combo, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int))); 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() void AddNewTorrentDialog::renameSelectedFile()
{ {
const QModelIndexList selectedIndexes = ui->content_tree->selectionModel()->selectedRows(0); const QModelIndexList selectedIndexes = ui->content_tree->selectionModel()->selectedRows(0);
@ -689,7 +679,7 @@ void AddNewTorrentDialog::setupTreeview()
// Set torrent information // Set torrent information
ui->comment_lbl->setText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment())); 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 // Prepare content tree
if (m_torrentInfo.filesCount() > 1) { if (m_torrentInfo.filesCount() > 1) {

1
src/gui/addnewtorrentdialog.h

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

179
src/gui/addnewtorrentdialog.ui

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

1
src/gui/advancedsettings.cpp

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

47
src/gui/options.ui

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

5
src/gui/options_imp.cpp

@ -67,6 +67,7 @@ options_imp::options_imp(QWidget *parent)
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setModal(true); setModal(true);
// Icons // Icons
tabSelection->item(TAB_UI)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop")); tabSelection->item(TAB_UI)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop"));
tabSelection->item(TAB_BITTORRENT)->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network")); 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); tabSelection->item(TAB_WEBUI)->setHidden(true);
#endif #endif
tabSelection->item(TAB_ADVANCED)->setIcon(GuiIconProvider::instance()->getIcon("preferences-other")); 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")); IpFilterRefreshBtn->setIcon(GuiIconProvider::instance()->getIcon("view-refresh"));
hsplitter->setCollapsible(0, false); hsplitter->setCollapsible(0, false);

87
src/gui/statusbar.cpp

@ -30,6 +30,12 @@
#include "statusbar.h" #include "statusbar.h"
#include <QStatusBar>
#include <QFrame>
#include <QLabel>
#include <QTimer>
#include <QPushButton>
#include <QHBoxLayout>
#include <QFontMetrics> #include <QFontMetrics>
#include <QDebug> #include <QDebug>
@ -44,11 +50,13 @@
StatusBar::StatusBar(QStatusBar *bar) StatusBar::StatusBar(QStatusBar *bar)
: m_bar(bar) : m_bar(bar)
{ {
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
connect(BitTorrent::Session::instance(), SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool))); connect(BitTorrent::Session::instance(), SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
container = new QWidget(bar); container = new QWidget(bar);
layout = new QHBoxLayout(container); layout = new QHBoxLayout(container);
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0, 0, 0, 0);
container->setLayout(layout); container->setLayout(layout);
connecStatusLblIcon = new QPushButton(bar); connecStatusLblIcon = new QPushButton(bar);
@ -56,7 +64,7 @@ StatusBar::StatusBar(QStatusBar *bar)
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus); connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
connecStatusLblIcon->setCursor(Qt::PointingHandCursor); connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.png")); 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 = new QPushButton(bar);
dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png")); dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png"));
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed())); connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed()));
@ -128,21 +136,24 @@ StatusBar::StatusBar(QStatusBar *bar)
refreshTimer->start(1500); refreshTimer->start(1500);
} }
StatusBar::~StatusBar() { StatusBar::~StatusBar()
{
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
} }
QPushButton* StatusBar::connectionStatusButton() const { QPushButton* StatusBar::connectionStatusButton() const
{
return connecStatusLblIcon; return connecStatusLblIcon;
} }
void StatusBar::showRestartRequired() { void StatusBar::showRestartRequired()
{
// Restart required notification // Restart required notification
const QString restart_text = tr("qBittorrent needs to be restarted"); const QString restart_text = tr("qBittorrent needs to be restarted");
QLabel *restartIconLbl = new QLabel(m_bar); 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); restartIconLbl->setToolTip(restart_text);
m_bar->insertWidget(0,restartIconLbl); m_bar->insertWidget(0, restartIconLbl);
QLabel *restartLbl = new QLabel(m_bar); QLabel *restartLbl = new QLabel(m_bar);
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
m_bar->insertWidget(1, restartLbl); 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); 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(); refreshTimer->stop();
} }
void StatusBar::refreshStatusBar() { void StatusBar::refreshStatusBar()
{
// Update connection status // Update connection status
const BitTorrent::SessionStatus sessionStatus = BitTorrent::Session::instance()->status(); const BitTorrent::SessionStatus sessionStatus = BitTorrent::Session::instance()->status();
if (!BitTorrent::Session::instance()->isListening()) { if (!BitTorrent::Session::instance()->isListening()) {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/disconnected.png"))); 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.")); 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 { }
else {
if (sessionStatus.hasIncomingConnections()) { if (sessionStatus.hasIncomingConnections()) {
// Connection OK // Connection OK
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/connected.png"))); connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/connected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>") + tr("Connection Status:") + QString::fromUtf8("</b><br>") + tr("Online"));
}else{ }
else {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/firewalled.png"))); 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 // Update Number of DHT nodes
@ -176,29 +191,32 @@ void StatusBar::refreshStatusBar() {
DHTLbl->setVisible(true); DHTLbl->setVisible(true);
//statusSep1->setVisible(true); //statusSep1->setVisible(true);
DHTLbl->setText(tr("DHT: %1 nodes").arg(QString::number(sessionStatus.dhtNodes()))); DHTLbl->setText(tr("DHT: %1 nodes").arg(QString::number(sessionStatus.dhtNodes())));
} else { }
else {
DHTLbl->setVisible(false); DHTLbl->setVisible(false);
//statusSep1->setVisible(false); //statusSep1->setVisible(false);
} }
// Update speed labels // 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(); int speedLimit = BitTorrent::Session::instance()->downloadRateLimit();
if (speedLimit) if (speedLimit)
speedLbl = "["+Utils::Misc::friendlyUnit(speedLimit, true)+"] " + speedLbl; speedLbl = "[" + Utils::Misc::friendlyUnit(speedLimit, true) + "] " + speedLbl;
dlSpeedLbl->setText(speedLbl); dlSpeedLbl->setText(speedLbl);
speedLimit = BitTorrent::Session::instance()->uploadRateLimit(); 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) if (speedLimit)
speedLbl = "["+Utils::Misc::friendlyUnit(speedLimit, true)+"] " + speedLbl; speedLbl = "[" + Utils::Misc::friendlyUnit(speedLimit, true) + "] " + speedLbl;
upSpeedLbl->setText(speedLbl); upSpeedLbl->setText(speedLbl);
} }
void StatusBar::updateAltSpeedsBtn(bool alternative) { void StatusBar::updateAltSpeedsBtn(bool alternative)
{
if (alternative) { if (alternative) {
altSpeedsBtn->setIcon(QIcon(":/icons/slow.png")); altSpeedsBtn->setIcon(QIcon(":/icons/slow.png"));
altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits")); altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
altSpeedsBtn->setDown(true); altSpeedsBtn->setDown(true);
} else { }
else {
altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.png")); altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.png"));
altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits")); altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
altSpeedsBtn->setDown(false); altSpeedsBtn->setDown(false);
@ -206,14 +224,16 @@ void StatusBar::updateAltSpeedsBtn(bool alternative) {
refreshStatusBar(); refreshStatusBar();
} }
void StatusBar::toggleAlternativeSpeeds() { void StatusBar::toggleAlternativeSpeeds()
{
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
if (pref->isSchedulerEnabled()) if (pref->isSchedulerEnabled())
m_bar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000); m_bar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000);
BitTorrent::Session::instance()->changeSpeedLimitMode(!pref->isAltBandwidthEnabled()); BitTorrent::Session::instance()->changeSpeedLimitMode(!pref->isAltBandwidthEnabled());
} }
void StatusBar::capDownloadSpeed() { void StatusBar::capDownloadSpeed()
{
bool ok = false; bool ok = false;
int cur_limit = BitTorrent::Session::instance()->downloadRateLimit(); int cur_limit = BitTorrent::Session::instance()->downloadRateLimit();
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), cur_limit); long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), cur_limit);
@ -227,19 +247,21 @@ void StatusBar::capDownloadSpeed() {
pref->setGlobalDownloadLimit(-1); pref->setGlobalDownloadLimit(-1);
else else
pref->setAltGlobalDownloadLimit(-1); 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); BitTorrent::Session::instance()->setDownloadRateLimit(new_limit);
if (!alt) if (!alt)
pref->setGlobalDownloadLimit(new_limit/1024.); pref->setGlobalDownloadLimit(new_limit / 1024.);
else else
pref->setAltGlobalDownloadLimit(new_limit/1024.); pref->setAltGlobalDownloadLimit(new_limit / 1024.);
} }
refreshStatusBar(); refreshStatusBar();
} }
} }
void StatusBar::capUploadSpeed() { void StatusBar::capUploadSpeed()
{
bool ok = false; bool ok = false;
int cur_limit = BitTorrent::Session::instance()->uploadRateLimit(); int cur_limit = BitTorrent::Session::instance()->uploadRateLimit();
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), cur_limit); long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), cur_limit);
@ -253,13 +275,14 @@ void StatusBar::capUploadSpeed() {
Preferences::instance()->setGlobalUploadLimit(-1); Preferences::instance()->setGlobalUploadLimit(-1);
else else
Preferences::instance()->setAltGlobalUploadLimit(-1); 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); BitTorrent::Session::instance()->setUploadRateLimit(new_limit);
if (!alt) if (!alt)
Preferences::instance()->setGlobalUploadLimit(new_limit/1024.); Preferences::instance()->setGlobalUploadLimit(new_limit / 1024.);
else else
Preferences::instance()->setAltGlobalUploadLimit(new_limit/1024.); Preferences::instance()->setAltGlobalUploadLimit(new_limit / 1024.);
} }
refreshStatusBar(); refreshStatusBar();
} }

19
src/gui/statusbar.h

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

Loading…
Cancel
Save