mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #3323 from Chocobo1/prop_bar
Availability bar, progress bar, button group improvements
This commit is contained in:
commit
787b824d90
@ -34,7 +34,7 @@
|
||||
|
||||
DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent)
|
||||
{
|
||||
setFixedHeight(BAR_HEIGHT);
|
||||
setToolTip(QString("%1\n%2\n%3").arg(tr("White: Missing pieces")).arg(tr("Green: Partial pieces")).arg(tr("Blue: Completed pieces")));
|
||||
|
||||
m_bgColor = 0xffffff;
|
||||
m_borderColor = palette().color(QPalette::Dark).rgb();
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include <QBitArray>
|
||||
#include <QVector>
|
||||
|
||||
#define BAR_HEIGHT 18
|
||||
|
||||
class DownloadedPiecesBar: public QWidget {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DownloadedPiecesBar)
|
||||
|
@ -36,7 +36,7 @@
|
||||
PieceAvailabilityBar::PieceAvailabilityBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setFixedHeight(BAR_HEIGHT);
|
||||
setToolTip(QString("%1\n%2").arg(tr("White: Unavailable pieces")).arg(tr("Blue: Available pieces")));
|
||||
|
||||
m_bgColor = 0xffffff;
|
||||
m_borderColor = palette().color(QPalette::Dark).rgb();
|
||||
|
@ -35,9 +35,6 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
|
||||
#define BAR_HEIGHT 18
|
||||
|
||||
|
||||
class PieceAvailabilityBar: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -66,10 +66,7 @@
|
||||
PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, TransferListWidget *transferList):
|
||||
QWidget(parent), transferList(transferList), main_window(main_window), m_torrent(0) {
|
||||
setupUi(this);
|
||||
|
||||
// Icons
|
||||
trackerUpButton->setIcon(GuiIconProvider::instance()->getIcon("go-up"));
|
||||
trackerDownButton->setIcon(GuiIconProvider::instance()->getIcon("go-down"));
|
||||
setAutoFillBackground(true);
|
||||
|
||||
state = VISIBLE;
|
||||
|
||||
@ -102,14 +99,34 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
|
||||
connect(filesList->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings()));
|
||||
connect(filesList->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings()));
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
// set bar height relative to screen dpi
|
||||
int barHeight = devicePixelRatio() * 18;
|
||||
#else
|
||||
// set bar height relative to font height
|
||||
QFont defFont;
|
||||
QFontMetrics fMetrics(defFont, 0); // need to be device-dependent
|
||||
int barHeight = fMetrics.height() * 5 / 4;
|
||||
#endif
|
||||
|
||||
// Downloaded pieces progress bar
|
||||
tempProgressBarArea->setVisible(false);
|
||||
downloaded_pieces = new DownloadedPiecesBar(this);
|
||||
ProgressHLayout->insertWidget(1, downloaded_pieces);
|
||||
groupBarLayout->addWidget(downloaded_pieces, 0, 1);
|
||||
downloaded_pieces->setFixedHeight(barHeight);
|
||||
downloaded_pieces->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
|
||||
// Pieces availability bar
|
||||
tempAvailabilityBarArea->setVisible(false);
|
||||
pieces_availability = new PieceAvailabilityBar(this);
|
||||
ProgressHLayout_2->insertWidget(1, pieces_availability);
|
||||
groupBarLayout->addWidget(pieces_availability, 1, 1);
|
||||
pieces_availability->setFixedHeight(barHeight);
|
||||
pieces_availability->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
|
||||
// Tracker list
|
||||
trackerList = new TrackerList(this);
|
||||
trackerUpButton->setIcon(GuiIconProvider::instance()->getIcon("go-up"));
|
||||
trackerDownButton->setIcon(GuiIconProvider::instance()->getIcon("go-down"));
|
||||
connect(trackerUpButton, SIGNAL(clicked()), trackerList, SLOT(moveSelectionUp()));
|
||||
connect(trackerDownButton, SIGNAL(clicked()), trackerList, SLOT(moveSelectionDown()));
|
||||
horizontalLayout_trackers->insertWidget(0, trackerList);
|
||||
@ -127,6 +144,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
|
||||
speed_layout->addWidget(speedWidget);
|
||||
// Tab bar
|
||||
m_tabBar = new PropTabBar();
|
||||
m_tabBar->setContentsMargins(0, 5, 0, 0);
|
||||
verticalLayout->addLayout(m_tabBar);
|
||||
connect(m_tabBar, SIGNAL(tabChanged(int)), stackedProperties, SLOT(setCurrentIndex(int)));
|
||||
connect(m_tabBar, SIGNAL(tabChanged(int)), this, SLOT(saveSettings()));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,8 @@
|
||||
PropTabBar::PropTabBar(QWidget *parent) :
|
||||
QHBoxLayout(parent), m_currentIndex(-1)
|
||||
{
|
||||
setSpacing(2);
|
||||
setAlignment(Qt::AlignLeft | Qt::AlignCenter);
|
||||
setSpacing(3);
|
||||
m_btnGroup = new QButtonGroup(this);
|
||||
// General tab
|
||||
QPushButton *main_infos_button = new QPushButton(GuiIconProvider::instance()->getIcon("document-properties"), tr("General"), parent);
|
||||
@ -63,7 +64,7 @@ PropTabBar::PropTabBar(QWidget *parent) :
|
||||
addWidget(files_button);
|
||||
m_btnGroup->addButton(files_button, FILES_TAB);
|
||||
// Spacer
|
||||
addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
// Speed tab
|
||||
QPushButton *speed_button = new QPushButton(GuiIconProvider::instance()->getIcon("office-chart-line"), tr("Speed"), parent);
|
||||
addWidget(speed_button);
|
||||
|
Loading…
Reference in New Issue
Block a user