mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-13 18:17:08 -07:00
Improve main window layout
Improve properties buttons style
This commit is contained in:
parent
7b646018ea
commit
6ae7db4afb
4 changed files with 25 additions and 17 deletions
|
@ -114,6 +114,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
|
||||||
// Tab bar
|
// Tab bar
|
||||||
m_tabBar = new PropTabBar();
|
m_tabBar = new PropTabBar();
|
||||||
verticalLayout->addLayout(m_tabBar);
|
verticalLayout->addLayout(m_tabBar);
|
||||||
|
verticalLayout->setMargin(0);
|
||||||
connect(m_tabBar, SIGNAL(tabChanged(int)), stackedProperties, SLOT(setCurrentIndex(int)));
|
connect(m_tabBar, SIGNAL(tabChanged(int)), stackedProperties, SLOT(setCurrentIndex(int)));
|
||||||
connect(m_tabBar, SIGNAL(visibilityToggled(bool)), SLOT(setVisibility(bool)));
|
connect(m_tabBar, SIGNAL(visibilityToggled(bool)), SLOT(setVisibility(bool)));
|
||||||
// Dynamic data refresher
|
// Dynamic data refresher
|
||||||
|
@ -152,14 +153,15 @@ void PropertiesWidget::showPiecesDownloaded(bool show) {
|
||||||
void PropertiesWidget::setVisibility(bool visible) {
|
void PropertiesWidget::setVisibility(bool visible) {
|
||||||
if(!visible && state == VISIBLE) {
|
if(!visible && state == VISIBLE) {
|
||||||
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
slideSizes = hSplitter->sizes();
|
|
||||||
stackedProperties->setVisible(false);
|
stackedProperties->setVisible(false);
|
||||||
QList<int> sizes;
|
slideSizes = hSplitter->sizes();
|
||||||
sizes << hSplitter->geometry().height()-30 << 30;
|
|
||||||
hSplitter->setSizes(sizes);
|
|
||||||
hSplitter->handle(1)->setVisible(false);
|
hSplitter->handle(1)->setVisible(false);
|
||||||
hSplitter->handle(1)->setDisabled(true);
|
hSplitter->handle(1)->setDisabled(true);
|
||||||
|
QList<int> sizes = QList<int>() << hSplitter->geometry().height()-30 << 30;
|
||||||
|
hSplitter->setSizes(sizes);
|
||||||
|
hSplitter->updateGeometry();
|
||||||
state = REDUCED;
|
state = REDUCED;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(visible && state == REDUCED) {
|
if(visible && state == REDUCED) {
|
||||||
|
@ -365,7 +367,7 @@ void PropertiesWidget::loadDynamicData() {
|
||||||
std::vector<int> avail;
|
std::vector<int> avail;
|
||||||
h.piece_availability(avail);
|
h.piece_availability(avail);
|
||||||
pieces_availability->setAvailability(avail);
|
pieces_availability->setAvailability(avail);
|
||||||
avail_average_lbl->setText(QString::number(h.status().distributed_copies, 'f', 1));
|
avail_average_lbl->setText(QString::number(h.status().distributed_copies, 'f', 3));
|
||||||
} else {
|
} else {
|
||||||
showPiecesAvailability(false);
|
showPiecesAvailability(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>520</width>
|
<width>520</width>
|
||||||
<height>377</height>
|
<height>373</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -557,13 +557,14 @@
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!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">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Ubuntu'; font-size:8pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: none;">
|
<td style="border: none;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"></p>
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"></p>
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';"></p></td></tr></table></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"></p>
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></td></tr></table></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -835,13 +836,13 @@ p, li { white-space: pre-wrap; }
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -37,11 +37,11 @@
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px; margin-left: 8px; margin-right: 8px;}"
|
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid #888;border-radius: 2px; padding: 4px; margin-left: 0px; margin-right: 8px;}"
|
||||||
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 8px; margin-right: 8px;}"
|
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid #888;border-radius: 2px; padding: 4px;background-color: palette(highlight); margin-left: 0px; margin-right: 8px;}"
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px; margin-left: 3px; margin-right: 3px;}"
|
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid #888;border-radius: 2px; padding: 4px; margin-left: 0px; margin-right: 3px;}"
|
||||||
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 3px; margin-right: 3px;}"
|
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid #888;border-radius: 2px; padding: 4px;background-color: palette(highlight); margin-left: 0px; margin-right: 3px;}"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int BTN_ICON_SIZE = 16;
|
const int BTN_ICON_SIZE = 16;
|
||||||
|
@ -50,7 +50,7 @@ PropTabBar::PropTabBar(QWidget *parent) :
|
||||||
QHBoxLayout(parent), m_currentIndex(-1)
|
QHBoxLayout(parent), m_currentIndex(-1)
|
||||||
{
|
{
|
||||||
m_btnGroup = new QButtonGroup(this);
|
m_btnGroup = new QButtonGroup(this);
|
||||||
setContentsMargins(5, 4, 5, 2);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
// General tab
|
// General tab
|
||||||
QPushButton *main_infos_button = new QPushButton(IconProvider::instance()->getIcon("document-properties"), tr("General"), parent);
|
QPushButton *main_infos_button = new QPushButton(IconProvider::instance()->getIcon("document-properties"), tr("General"), parent);
|
||||||
main_infos_button->setShortcut(QKeySequence(QString::fromUtf8("Alt+P")));
|
main_infos_button->setShortcut(QKeySequence(QString::fromUtf8("Alt+P")));
|
||||||
|
@ -86,6 +86,10 @@ PropTabBar::PropTabBar(QWidget *parent) :
|
||||||
addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||||
// SIGNAL/SLOT
|
// SIGNAL/SLOT
|
||||||
connect(m_btnGroup, SIGNAL(buttonClicked(int)), SLOT(setCurrentIndex(int)));
|
connect(m_btnGroup, SIGNAL(buttonClicked(int)), SLOT(setCurrentIndex(int)));
|
||||||
|
// Disable buttons focus
|
||||||
|
foreach(QAbstractButton *btn, m_btnGroup->buttons()) {
|
||||||
|
btn->setFocusPolicy(Qt::NoFocus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PropTabBar::~PropTabBar() {
|
PropTabBar::~PropTabBar() {
|
||||||
|
|
|
@ -206,6 +206,7 @@ public:
|
||||||
TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList): QFrame(parent), transferList(transferList), nb_labeled(0), nb_torrents(0) {
|
TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList): QFrame(parent), transferList(transferList), nb_labeled(0), nb_torrents(0) {
|
||||||
// Construct lists
|
// Construct lists
|
||||||
vLayout = new QVBoxLayout();
|
vLayout = new QVBoxLayout();
|
||||||
|
vLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
statusFilters = new StatusFiltersWidget(this);
|
statusFilters = new StatusFiltersWidget(this);
|
||||||
vLayout->addWidget(statusFilters);
|
vLayout->addWidget(statusFilters);
|
||||||
labelFilters = new LabelFiltersList(this);
|
labelFilters = new LabelFiltersList(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue