diff --git a/src/gui/properties/downloadedpiecesbar.cpp b/src/gui/properties/downloadedpiecesbar.cpp index fdb97671e..3c44e5f5d 100644 --- a/src/gui/properties/downloadedpiecesbar.cpp +++ b/src/gui/properties/downloadedpiecesbar.cpp @@ -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(); diff --git a/src/gui/properties/downloadedpiecesbar.h b/src/gui/properties/downloadedpiecesbar.h index 7f4af7c83..74ce1a5cf 100644 --- a/src/gui/properties/downloadedpiecesbar.h +++ b/src/gui/properties/downloadedpiecesbar.h @@ -37,8 +37,6 @@ #include #include -#define BAR_HEIGHT 18 - class DownloadedPiecesBar: public QWidget { Q_OBJECT Q_DISABLE_COPY(DownloadedPiecesBar) diff --git a/src/gui/properties/pieceavailabilitybar.cpp b/src/gui/properties/pieceavailabilitybar.cpp index 0b968ea15..830810a02 100644 --- a/src/gui/properties/pieceavailabilitybar.cpp +++ b/src/gui/properties/pieceavailabilitybar.cpp @@ -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(); diff --git a/src/gui/properties/pieceavailabilitybar.h b/src/gui/properties/pieceavailabilitybar.h index 52e78dc3f..6d8e2142b 100644 --- a/src/gui/properties/pieceavailabilitybar.h +++ b/src/gui/properties/pieceavailabilitybar.h @@ -35,9 +35,6 @@ #include #include -#define BAR_HEIGHT 18 - - class PieceAvailabilityBar: public QWidget { Q_OBJECT diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index c738673c4..b673d1285 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -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())); diff --git a/src/gui/properties/propertieswidget.ui b/src/gui/properties/propertieswidget.ui index 2340f5e32..920f003ec 100644 --- a/src/gui/properties/propertieswidget.ui +++ b/src/gui/properties/propertieswidget.ui @@ -10,14 +10,20 @@ 452 - - Form - 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -25,22 +31,25 @@ 0 - + 0 - + + 0 + + + 0 + + + 0 + + 0 - - - 0 - 0 - - true @@ -50,120 +59,93 @@ 0 0 549 - 447 + 450 - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - Progress: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - Qt::PlainText - - - Qt::AlignLeading - - - 0 - - - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - Availability: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - Qt::PlainText - - - Qt::AlignLeading - - - - + + + + 4 + + + 4 + + + + + + 0 + 0 + + + + Progress: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Availability: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + Qt::PlainText + + + + + + + Qt::PlainText + + + + + @@ -173,225 +155,17 @@ - - - - 0 - 0 - - + Transfer - - - - - 0 - 0 - - - - Time Active: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - ETA: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Connections: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Downloaded: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Uploaded: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Seeds: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Download Speed: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + 4 + + + 4 + @@ -400,9 +174,6 @@ 0 - - - Qt::PlainText @@ -432,9 +203,6 @@ 0 - - - Qt::PlainText @@ -456,16 +224,42 @@ - - + + + + + 0 + 0 + + + + Connections: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + 0 0 - - + + Qt::PlainText + + + + + + + + 0 + 0 + Qt::PlainText @@ -488,22 +282,64 @@ - - + + + + + 0 + 0 + + + + Share Ratio: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + 0 0 - - + + Qt::PlainText + + + + + + + + 0 + 0 + Qt::PlainText + + + + + 0 + 0 + + + + Downloaded: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -520,24 +356,8 @@ - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - + + 0 @@ -545,55 +365,33 @@ - Wasted: + Last Seen Complete: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Share Ratio: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - + + 0 0 - - + + Qt::PlainText + + + + + + + + 0 + 0 + Qt::PlainText @@ -616,38 +414,6 @@ - - - - - 0 - 0 - - - - - - - Qt::PlainText - - - - - - - - 0 - 0 - - - - Last Seen Complete: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -656,29 +422,200 @@ 0 + + Qt::PlainText + + + + + + + + 0 + 0 + + - + Seeds: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Download Speed: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + Qt::PlainText + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Uploaded: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Time Active: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + ETA: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Wasted: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + - - - - 0 - 0 - - + Information + + 4 + + + 2 + @@ -703,9 +640,6 @@ 0 - - - Qt::PlainText @@ -735,9 +669,6 @@ 0 - - - Qt::PlainText @@ -767,9 +698,6 @@ 0 - - - Qt::PlainText @@ -799,9 +727,6 @@ 0 - - - Qt::PlainText @@ -831,9 +756,6 @@ 0 - - - Qt::PlainText @@ -863,9 +785,6 @@ 0 - - - Qt::PlainText @@ -895,9 +814,6 @@ 0 - - - Qt::PlainText @@ -930,15 +846,9 @@ 0 - - - Qt::PlainText - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - true @@ -1000,7 +910,7 @@ - + @@ -1169,18 +1079,10 @@ - - + - - - - Qt::Horizontal - - - diff --git a/src/gui/properties/proptabbar.cpp b/src/gui/properties/proptabbar.cpp index 5b0b2c591..11be20734 100644 --- a/src/gui/properties/proptabbar.cpp +++ b/src/gui/properties/proptabbar.cpp @@ -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);