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. 543
      src/gui/about.ui
  5. 111
      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. 407
      src/gui/statusbar.cpp
  13. 67
      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>

543
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,250 +89,182 @@
</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> <layout class="QGridLayout" name="gridLayout_4">
<property name="verticalSpacing"> <item row="1" column="1">
<number>6</number> <widget class="QLabel" name="label_18">
</property> <property name="text">
<property name="margin"> <string>Greece</string>
<number>0</number> </property>
</property> </widget>
</item>
<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="openExternalLinks">
<bool>true</bool>
</property>
<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"> <item row="2" column="0">
<spacer name="verticalSpacer"> <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"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>0</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0" colspan="2"> </layout>
<widget class="QFrame" name="frame"> </widget>
<property name="frameShape"> </item>
<enum>QFrame::NoFrame</enum> <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>
</property> </property>
<property name="lineWidth"> </widget>
<number>0</number> </item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">Christophe Dumez</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" 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>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>France</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">Christophe Dumez</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string notr="true">chris@qbittorrent.org</string>
</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">
<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> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="1">
<widget class="QFrame" name="frame_2"> <widget class="QLabel" name="label_6">
<property name="frameShape"> <property name="text">
<enum>QFrame::NoFrame</enum> <string notr="true">&lt;a href=&quot;mailto:chris@qbittorrent.org&quot;&gt;chris@qbittorrent.org&lt;/a&gt;</string>
</property> </property>
<property name="frameShadow"> <property name="openExternalLinks">
<enum>QFrame::Plain</enum> <bool>true</bool>
</property> </property>
<property name="lineWidth"> <property name="textInteractionFlags">
<number>0</number> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="1">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Greece</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">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Current maintainer</string> <string>Name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_5">
<property name="font"> <property name="text">
<font> <string>E-mail:</string>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Original author</string> <string>Nationality:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2">
<spacer name="horizontalSpacer_2">
<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> </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>
</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>

111
src/gui/about_imp.h

@ -33,67 +33,68 @@
#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"); {
} setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
// Title
lb_name->setText("<b><h2>qBittorrent " VERSION "</h2></b>");
// About
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);
// 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));
about(QWidget *parent): QDialog(parent) { show();
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
// 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>");
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();
} }
}; };

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>
<property name="iconSize"> <property name="flow">
<size> <enum>QListView::TopToBottom</enum>
<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> </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);

407
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>
@ -42,225 +48,242 @@
#include "base/logger.h" #include "base/logger.h"
StatusBar::StatusBar(QStatusBar *bar) StatusBar::StatusBar(QStatusBar *bar)
: m_bar(bar) : m_bar(bar)
{ {
Preferences* const pref = Preferences::instance(); qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
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);
container->setLayout(layout); Preferences* const pref = Preferences::instance();
connecStatusLblIcon = new QPushButton(bar); connect(BitTorrent::Session::instance(), SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
connecStatusLblIcon->setFlat(true); container = new QWidget(bar);
connecStatusLblIcon->setFocusPolicy(Qt::NoFocus); layout = new QHBoxLayout(container);
connecStatusLblIcon->setCursor(Qt::PointingHandCursor); layout->setContentsMargins(0, 0, 0, 0);
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>")); container->setLayout(layout);
dlSpeedLbl = new QPushButton(bar); connecStatusLblIcon = new QPushButton(bar);
dlSpeedLbl->setIcon(QIcon(":/icons/skin/download.png")); connecStatusLblIcon->setFlat(true);
connect(dlSpeedLbl, SIGNAL(clicked()), this, SLOT(capDownloadSpeed())); connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
dlSpeedLbl->setFlat(true); connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
dlSpeedLbl->setFocusPolicy(Qt::NoFocus); connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.png"));
dlSpeedLbl->setCursor(Qt::PointingHandCursor); 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()));
dlSpeedLbl->setFlat(true);
dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
dlSpeedLbl->setCursor(Qt::PointingHandCursor);
upSpeedLbl = new QPushButton(bar); upSpeedLbl = new QPushButton(bar);
upSpeedLbl->setIcon(QIcon(":/icons/skin/seeding.png")); upSpeedLbl->setIcon(QIcon(":/icons/skin/seeding.png"));
connect(upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed())); connect(upSpeedLbl, SIGNAL(clicked()), this, SLOT(capUploadSpeed()));
upSpeedLbl->setFlat(true); upSpeedLbl->setFlat(true);
upSpeedLbl->setFocusPolicy(Qt::NoFocus); upSpeedLbl->setFocusPolicy(Qt::NoFocus);
upSpeedLbl->setCursor(Qt::PointingHandCursor); upSpeedLbl->setCursor(Qt::PointingHandCursor);
DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), bar); DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), bar);
DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); DHTLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
altSpeedsBtn = new QPushButton(bar); altSpeedsBtn = new QPushButton(bar);
altSpeedsBtn->setFlat(true); altSpeedsBtn->setFlat(true);
altSpeedsBtn->setFocusPolicy(Qt::NoFocus); altSpeedsBtn->setFocusPolicy(Qt::NoFocus);
altSpeedsBtn->setCursor(Qt::PointingHandCursor); altSpeedsBtn->setCursor(Qt::PointingHandCursor);
updateAltSpeedsBtn(pref->isAltBandwidthEnabled()); updateAltSpeedsBtn(pref->isAltBandwidthEnabled());
connect(altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds())); connect(altSpeedsBtn, SIGNAL(clicked()), this, SLOT(toggleAlternativeSpeeds()));
// Because on some platforms the default icon size is bigger // Because on some platforms the default icon size is bigger
// and it will result in taller/fatter statusbar, even if the // and it will result in taller/fatter statusbar, even if the
// icons are actually 16x16 // icons are actually 16x16
connecStatusLblIcon->setIconSize(QSize(16, 16)); connecStatusLblIcon->setIconSize(QSize(16, 16));
dlSpeedLbl->setIconSize(QSize(16, 16)); dlSpeedLbl->setIconSize(QSize(16, 16));
upSpeedLbl->setIconSize(QSize(16, 16)); upSpeedLbl->setIconSize(QSize(16, 16));
altSpeedsBtn->setIconSize(QSize(28, 16)); altSpeedsBtn->setIconSize(QSize(28, 16));
// Set to the known maximum width(plus some padding) // Set to the known maximum width(plus some padding)
// so the speed widgets will take the rest of the space // so the speed widgets will take the rest of the space
connecStatusLblIcon->setMaximumWidth(16 + 6); connecStatusLblIcon->setMaximumWidth(16 + 6);
altSpeedsBtn->setMaximumWidth(28 + 6); altSpeedsBtn->setMaximumWidth(28 + 6);
statusSep1 = new QFrame(bar); statusSep1 = new QFrame(bar);
statusSep1->setFrameStyle(QFrame::VLine); statusSep1->setFrameStyle(QFrame::VLine);
statusSep1->setFrameShadow(QFrame::Raised); statusSep1->setFrameShadow(QFrame::Raised);
statusSep2 = new QFrame(bar); statusSep2 = new QFrame(bar);
statusSep2->setFrameStyle(QFrame::VLine); statusSep2->setFrameStyle(QFrame::VLine);
statusSep2->setFrameShadow(QFrame::Raised); statusSep2->setFrameShadow(QFrame::Raised);
statusSep3 = new QFrame(bar); statusSep3 = new QFrame(bar);
statusSep3->setFrameStyle(QFrame::VLine); statusSep3->setFrameStyle(QFrame::VLine);
statusSep3->setFrameShadow(QFrame::Raised); statusSep3->setFrameShadow(QFrame::Raised);
statusSep4 = new QFrame(bar); statusSep4 = new QFrame(bar);
statusSep4->setFrameStyle(QFrame::VLine); statusSep4->setFrameStyle(QFrame::VLine);
statusSep4->setFrameShadow(QFrame::Raised); statusSep4->setFrameShadow(QFrame::Raised);
layout->addWidget(DHTLbl); layout->addWidget(DHTLbl);
layout->addWidget(statusSep1); layout->addWidget(statusSep1);
layout->addWidget(connecStatusLblIcon); layout->addWidget(connecStatusLblIcon);
layout->addWidget(statusSep2); layout->addWidget(statusSep2);
layout->addWidget(altSpeedsBtn); layout->addWidget(altSpeedsBtn);
layout->addWidget(statusSep4); layout->addWidget(statusSep4);
layout->addWidget(dlSpeedLbl); layout->addWidget(dlSpeedLbl);
layout->addWidget(statusSep3); layout->addWidget(statusSep3);
layout->addWidget(upSpeedLbl); layout->addWidget(upSpeedLbl);
bar->addPermanentWidget(container); bar->addPermanentWidget(container);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
bar->setStyleSheet("QWidget {margin: 0;}"); bar->setStyleSheet("QWidget {margin: 0;}");
container->adjustSize(); container->adjustSize();
bar->adjustSize(); bar->adjustSize();
// Is DHT enabled // Is DHT enabled
DHTLbl->setVisible(pref->isDHTEnabled()); DHTLbl->setVisible(pref->isDHTEnabled());
refreshTimer = new QTimer(bar); refreshTimer = new QTimer(bar);
refreshStatusBar(); refreshStatusBar();
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));
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 {
const QString restart_text = tr("qBittorrent needs to be restarted"); // Restart required notification
QLabel *restartIconLbl = new QLabel(m_bar); const QString restart_text = tr("qBittorrent needs to be restarted");
restartIconLbl->setPixmap(QPixmap(":/icons/oxygen/dialog-warning.png").scaled(QSize(24,24))); QLabel *restartIconLbl = new QLabel(m_bar);
restartIconLbl->setToolTip(restart_text); restartIconLbl->setPixmap(QPixmap(":/icons/oxygen/dialog-warning.png").scaled(QSize(24, 24)));
m_bar->insertWidget(0,restartIconLbl); restartIconLbl->setToolTip(restart_text);
QLabel *restartLbl = new QLabel(m_bar); m_bar->insertWidget(0, restartIconLbl);
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); QLabel *restartLbl = new QLabel(m_bar);
m_bar->insertWidget(1, restartLbl); restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
QFontMetrics fm(restartLbl->font()); m_bar->insertWidget(1, restartLbl);
restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width())); QFontMetrics fm(restartLbl->font());
Logger::instance()->addMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), Log::CRITICAL); restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width()));
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 {
const BitTorrent::SessionStatus sessionStatus = BitTorrent::Session::instance()->status(); // Update connection status
if (!BitTorrent::Session::instance()->isListening()) { const BitTorrent::SessionStatus sessionStatus = BitTorrent::Session::instance()->status();
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/disconnected.png"))); if (!BitTorrent::Session::instance()->isListening()) {
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->setIcon(QIcon(QString::fromUtf8(":/icons/skin/disconnected.png")));
} 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."));
if (sessionStatus.hasIncomingConnections()) { }
// Connection OK else {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/connected.png"))); if (sessionStatus.hasIncomingConnections()) {
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online")); // Connection OK
}else{ connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/connected.png")));
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/icons/skin/firewalled.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>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>")); }
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>"));
}
} }
} // Update Number of DHT nodes
// Update Number of DHT nodes if (BitTorrent::Session::instance()->isDHTEnabled()) {
if (BitTorrent::Session::instance()->isDHTEnabled()) { 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) { {
altSpeedsBtn->setIcon(QIcon(":/icons/slow.png")); if (alternative) {
altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits")); altSpeedsBtn->setIcon(QIcon(":/icons/slow.png"));
altSpeedsBtn->setDown(true); altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
} else { altSpeedsBtn->setDown(true);
altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.png")); }
altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits")); else {
altSpeedsBtn->setDown(false); altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.png"));
} altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
refreshStatusBar(); altSpeedsBtn->setDown(false);
}
refreshStatusBar();
} }
void StatusBar::toggleAlternativeSpeeds() { void StatusBar::toggleAlternativeSpeeds()
Preferences* const pref = Preferences::instance(); {
if (pref->isSchedulerEnabled()) Preferences* const pref = Preferences::instance();
m_bar->showMessage(tr("Manual change of rate limits mode. The scheduler is disabled."), 5000); if (pref->isSchedulerEnabled())
BitTorrent::Session::instance()->changeSpeedLimitMode(!pref->isAltBandwidthEnabled()); 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(); bool ok = false;
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), cur_limit); int cur_limit = BitTorrent::Session::instance()->downloadRateLimit();
if (ok) { long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), cur_limit);
Preferences* const pref = Preferences::instance(); if (ok) {
bool alt = pref->isAltBandwidthEnabled(); Preferences* const pref = Preferences::instance();
if (new_limit <= 0) { bool alt = pref->isAltBandwidthEnabled();
qDebug("Setting global download rate limit to Unlimited"); if (new_limit <= 0) {
BitTorrent::Session::instance()->setDownloadRateLimit(-1); qDebug("Setting global download rate limit to Unlimited");
if (!alt) BitTorrent::Session::instance()->setDownloadRateLimit(-1);
pref->setGlobalDownloadLimit(-1); if (!alt)
else pref->setGlobalDownloadLimit(-1);
pref->setAltGlobalDownloadLimit(-1); else
} else { pref->setAltGlobalDownloadLimit(-1);
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.); }
BitTorrent::Session::instance()->setDownloadRateLimit(new_limit); else {
if (!alt) qDebug("Setting global download rate limit to %.1fKb/s", new_limit / 1024.);
pref->setGlobalDownloadLimit(new_limit/1024.); BitTorrent::Session::instance()->setDownloadRateLimit(new_limit);
else if (!alt)
pref->setAltGlobalDownloadLimit(new_limit/1024.); pref->setGlobalDownloadLimit(new_limit / 1024.);
else
pref->setAltGlobalDownloadLimit(new_limit / 1024.);
}
refreshStatusBar();
} }
refreshStatusBar();
}
} }
void StatusBar::capUploadSpeed() { void StatusBar::capUploadSpeed()
bool ok = false; {
int cur_limit = BitTorrent::Session::instance()->uploadRateLimit(); bool ok = false;
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), cur_limit); int cur_limit = BitTorrent::Session::instance()->uploadRateLimit();
if (ok) { long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), cur_limit);
Preferences* const pref = Preferences::instance(); if (ok) {
bool alt = pref->isAltBandwidthEnabled(); Preferences* const pref = Preferences::instance();
if (new_limit <= 0) { bool alt = pref->isAltBandwidthEnabled();
qDebug("Setting global upload rate limit to Unlimited"); if (new_limit <= 0) {
BitTorrent::Session::instance()->setUploadRateLimit(-1); qDebug("Setting global upload rate limit to Unlimited");
if (!alt) BitTorrent::Session::instance()->setUploadRateLimit(-1);
Preferences::instance()->setGlobalUploadLimit(-1); if (!alt)
else Preferences::instance()->setGlobalUploadLimit(-1);
Preferences::instance()->setAltGlobalUploadLimit(-1); else
} else { Preferences::instance()->setAltGlobalUploadLimit(-1);
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.); }
BitTorrent::Session::instance()->setUploadRateLimit(new_limit); else {
if (!alt) qDebug("Setting global upload rate limit to %.1fKb/s", new_limit / 1024.);
Preferences::instance()->setGlobalUploadLimit(new_limit/1024.); BitTorrent::Session::instance()->setUploadRateLimit(new_limit);
else if (!alt)
Preferences::instance()->setAltGlobalUploadLimit(new_limit/1024.); Preferences::instance()->setGlobalUploadLimit(new_limit / 1024.);
else
Preferences::instance()->setAltGlobalUploadLimit(new_limit / 1024.);
}
refreshStatusBar();
} }
refreshStatusBar();
}
} }

67
src/gui/statusbar.h

@ -31,47 +31,48 @@
#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;
Q_OBJECT class QFrame;
class QLabel;
class QTimer;
class QPushButton;
class QHBoxLayout;
class StatusBar: public QObject
{
Q_OBJECT
public: public:
StatusBar(QStatusBar *bar); StatusBar(QStatusBar *bar);
~StatusBar(); ~StatusBar();
QPushButton* connectionStatusButton() const; QPushButton* connectionStatusButton() const;
public slots: public slots:
void showRestartRequired(); void showRestartRequired();
void stopTimer(); void stopTimer();
void refreshStatusBar(); void refreshStatusBar();
void updateAltSpeedsBtn(bool alternative); void updateAltSpeedsBtn(bool alternative);
void toggleAlternativeSpeeds(); void toggleAlternativeSpeeds();
void capDownloadSpeed(); void capDownloadSpeed();
void capUploadSpeed(); void capUploadSpeed();
private: private:
QStatusBar *m_bar; QStatusBar *m_bar;
QPushButton *dlSpeedLbl; QPushButton *dlSpeedLbl;
QPushButton *upSpeedLbl; QPushButton *upSpeedLbl;
QLabel *DHTLbl; QLabel *DHTLbl;
QFrame *statusSep1; QFrame *statusSep1;
QFrame *statusSep2; QFrame *statusSep2;
QFrame *statusSep3; QFrame *statusSep3;
QFrame *statusSep4; QFrame *statusSep4;
QPushButton *connecStatusLblIcon; QPushButton *connecStatusLblIcon;
QPushButton *altSpeedsBtn; QPushButton *altSpeedsBtn;
QTimer *refreshTimer; QTimer *refreshTimer;
QWidget *container; QWidget *container;
QHBoxLayout *layout; QHBoxLayout *layout;
}; };
#endif // STATUSBAR_H #endif // STATUSBAR_H

Loading…
Cancel
Save