1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 04:54:18 +00:00

Made preferences columns resizable

This commit is contained in:
Christophe Dumez 2010-03-13 14:10:26 +00:00
parent bd292076e3
commit 6431343ad7
2 changed files with 2961 additions and 2967 deletions

View File

@ -56,6 +56,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
QString savePath; QString savePath;
setupUi(this); setupUi(this);
hsplitter->setCollapsible(0, false);
hsplitter->setCollapsible(1, false);
// Get apply button in button box // Get apply button in button box
QList<QAbstractButton *> buttons = buttonBox->buttons(); QList<QAbstractButton *> buttons = buttonBox->buttons();
foreach(QAbstractButton *button, buttons){ foreach(QAbstractButton *button, buttons){
@ -284,8 +286,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
scrollArea_advanced->setLayout(adv_layout); scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton())); connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
// Adapt size // Adapt size
loadWindowState();
show(); show();
loadWindowState();
} }
// Main destructor // Main destructor
@ -313,12 +315,29 @@ void options_imp::loadWindowState() {
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint(); QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
if(!p.isNull()) if(!p.isNull())
move(p); move(p);
// Load slider size
const QStringList &sizes_str = settings.value("Preferences/State/hSplitterSizes", QStringList()).toStringList();
// Splitter size
QList<int> sizes;
if(sizes_str.size() == 2) {
sizes << sizes_str.first().toInt();
sizes << sizes_str.last().toInt();
} else {
sizes << 130;
sizes << hsplitter->width()-130;
}
hsplitter->setSizes(sizes);
} }
void options_imp::saveWindowState() const { void options_imp::saveWindowState() const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue(QString::fromUtf8("Preferences/State/size"), size()); settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos()); settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
// Splitter size
QStringList sizes_str;
sizes_str << QString::number(hsplitter->sizes().first());
sizes_str << QString::number(hsplitter->sizes().last());
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
} }
QSize options_imp::sizeFittingScreen() { QSize options_imp::sizeFittingScreen() {

File diff suppressed because it is too large Load Diff