Browse Source

Improve main window layout

Improve properties buttons style
adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
6ae7db4afb
  1. 12
      src/properties/propertieswidget.cpp
  2. 15
      src/properties/propertieswidget.ui
  3. 14
      src/properties/proptabbar.cpp
  4. 1
      src/transferlistfilterswidget.h

12
src/properties/propertieswidget.cpp

@ -114,6 +114,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra @@ -114,6 +114,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
// Tab bar
m_tabBar = new PropTabBar();
verticalLayout->addLayout(m_tabBar);
verticalLayout->setMargin(0);
connect(m_tabBar, SIGNAL(tabChanged(int)), stackedProperties, SLOT(setCurrentIndex(int)));
connect(m_tabBar, SIGNAL(visibilityToggled(bool)), SLOT(setVisibility(bool)));
// Dynamic data refresher
@ -152,14 +153,15 @@ void PropertiesWidget::showPiecesDownloaded(bool show) { @@ -152,14 +153,15 @@ void PropertiesWidget::showPiecesDownloaded(bool show) {
void PropertiesWidget::setVisibility(bool visible) {
if(!visible && state == VISIBLE) {
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
slideSizes = hSplitter->sizes();
stackedProperties->setVisible(false);
QList<int> sizes;
sizes << hSplitter->geometry().height()-30 << 30;
hSplitter->setSizes(sizes);
slideSizes = hSplitter->sizes();
hSplitter->handle(1)->setVisible(false);
hSplitter->handle(1)->setDisabled(true);
QList<int> sizes = QList<int>() << hSplitter->geometry().height()-30 << 30;
hSplitter->setSizes(sizes);
hSplitter->updateGeometry();
state = REDUCED;
return;
}
if(visible && state == REDUCED) {
@ -365,7 +367,7 @@ void PropertiesWidget::loadDynamicData() { @@ -365,7 +367,7 @@ void PropertiesWidget::loadDynamicData() {
std::vector<int> avail;
h.piece_availability(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 {
showPiecesAvailability(false);
}

15
src/properties/propertieswidget.ui

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<x>0</x>
<y>0</y>
<width>520</width>
<height>377</height>
<height>373</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -557,13 +557,14 @@ @@ -557,13 +557,14 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot;-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';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
@ -835,13 +836,13 @@ p, li { white-space: pre-wrap; } @@ -835,13 +836,13 @@ p, li { white-space: pre-wrap; }
<number>5</number>
</property>
<property name="topMargin">
<number>4</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>2</number>
<number>0</number>
</property>
</layout>
</item>

14
src/properties/proptabbar.cpp

@ -37,11 +37,11 @@ @@ -37,11 +37,11 @@
#include "iconprovider.h"
#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 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 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 #888;border-radius: 2px; padding: 4px;background-color: palette(highlight); margin-left: 0px; margin-right: 8px;}"
#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 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 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 #888;border-radius: 2px; padding: 4px;background-color: palette(highlight); margin-left: 0px; margin-right: 3px;}"
#endif
const int BTN_ICON_SIZE = 16;
@ -50,7 +50,7 @@ PropTabBar::PropTabBar(QWidget *parent) : @@ -50,7 +50,7 @@ PropTabBar::PropTabBar(QWidget *parent) :
QHBoxLayout(parent), m_currentIndex(-1)
{
m_btnGroup = new QButtonGroup(this);
setContentsMargins(5, 4, 5, 2);
setContentsMargins(0, 0, 0, 0);
// General tab
QPushButton *main_infos_button = new QPushButton(IconProvider::instance()->getIcon("document-properties"), tr("General"), parent);
main_infos_button->setShortcut(QKeySequence(QString::fromUtf8("Alt+P")));
@ -86,6 +86,10 @@ PropTabBar::PropTabBar(QWidget *parent) : @@ -86,6 +86,10 @@ PropTabBar::PropTabBar(QWidget *parent) :
addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
// SIGNAL/SLOT
connect(m_btnGroup, SIGNAL(buttonClicked(int)), SLOT(setCurrentIndex(int)));
// Disable buttons focus
foreach(QAbstractButton *btn, m_btnGroup->buttons()) {
btn->setFocusPolicy(Qt::NoFocus);
}
}
PropTabBar::~PropTabBar() {

1
src/transferlistfilterswidget.h

@ -206,6 +206,7 @@ public: @@ -206,6 +206,7 @@ public:
TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList): QFrame(parent), transferList(transferList), nb_labeled(0), nb_torrents(0) {
// Construct lists
vLayout = new QVBoxLayout();
vLayout->setContentsMargins(0, 0, 0, 0);
statusFilters = new StatusFiltersWidget(this);
vLayout->addWidget(statusFilters);
labelFilters = new LabelFiltersList(this);

Loading…
Cancel
Save