svn_diff_saveGeometryState_v2.patch

tg1311, 01/02/2011 07:25 am

Download (4.1 KB)

 
/data/trunk/client/gui_qt/ConfigGuiOpts.cpp (Arbeitskopie)
279 279
{
280 280
    settings->setValue("options/hide_inactive_connections", hideInactiveConnections);
281 281
}
282

                
283
QByteArray ConfigGuiOpts::getGeometry(QString objectName) const
284
{
285
    return settings->value("View/geometry_"+objectName).toByteArray();
286
}
287

                
288
void ConfigGuiOpts::setGeometry(QString objectName, QByteArray geometry)
289
{
290
    settings->setValue("View/geometry_"+objectName, geometry);
291
}
292

                
293
QByteArray ConfigGuiOpts::getState(QString objectName) const
294
{
295
    return settings->value("View/state_"+objectName).toByteArray();
296
}
297

                
298
void ConfigGuiOpts::setState(QString objectName, QByteArray state)
299
{
300
    settings->setValue("View/state_"+objectName, state);
301
}
302

                
303
int ConfigGuiOpts::getCurrentTabIndex() const
304
{
305
    return settings->value("View/currentTabIndex").toInt();
306
}
307

                
308
void ConfigGuiOpts::setCurrentTabIndex(int index)
309
{
310
    settings->setValue("View/currentTabIndex", index);
311
}
312

                
/data/trunk/client/gui_qt/mainwindow.cpp (Arbeitskopie)
108 108
    }
109 109

                
110 110
    /* Load all plugins which should be loaded automatically */
111
    ConfigGuiOpts opts;
112
    QStringList auto_load_plugins = opts.getAutoLoadPlugins();
111
    QStringList auto_load_plugins = gui_opts.getAutoLoadPlugins();
113 112
    Q_FOREACH(QString plugin_name, auto_load_plugins) {
114 113
        QNNTPGrabGlue::PluginInfo plugin_info;
115 114

                
... ...
133 132
                SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
134 133

                
135 134
        /* Show the tray icon if requested */
136
        if (opts.getShowTrayIcon()) {
135
        if (gui_opts.getShowTrayIcon()) {
137 136
            showTrayIcon();
138 137
        }
139 138
    }
... ...
153 152
            loadNZBFile(arg);
154 153
        }
155 154
    }
155

                
156
    this->restoreState(gui_opts.getState(this->objectName()));
157
    ui->splitterMain->restoreState(gui_opts.getState(ui->splitterMain->objectName()));
158
    ui->splitterBottom->restoreState(gui_opts.getState(ui->splitterBottom->objectName()));
159

                
160
    this->restoreGeometry(gui_opts.getGeometry(this->objectName()));
161
    ui->splitterMain->restoreGeometry(gui_opts.getGeometry(ui->splitterMain->objectName()));
162
    ui->splitterBottom->restoreGeometry(gui_opts.getGeometry(ui->splitterBottom->objectName()));
163

                
164
    ui->tabWidget->setCurrentIndex(gui_opts.getCurrentTabIndex());
156 165
}
157 166

                
158 167
MainWindow::~MainWindow()
... ...
411 420
{
412 421
    Q_UNUSED(event);
413 422

                
423
    gui_opts.setState(this->objectName(), this->saveState());
424
    gui_opts.setState(ui->splitterMain->objectName(), ui->splitterMain->saveState());
425
    gui_opts.setState(ui->splitterBottom->objectName(), ui->splitterBottom->saveState());
426

                
427
    gui_opts.setGeometry(this->objectName(), this->saveGeometry());
428
    gui_opts.setGeometry(ui->splitterMain->objectName(), ui->splitterMain->saveGeometry());
429
    gui_opts.setGeometry(ui->splitterBottom->objectName(), ui->splitterBottom->saveGeometry());
430

                
431
    gui_opts.setCurrentTabIndex(ui->tabWidget->currentIndex());
432

                
414 433
    /* Automatically close any other dialogs if they're open */
415 434
    if (formDebug) {
416 435
        delete formDebug;
/data/trunk/client/gui_qt/ConfigGuiOpts.h (Arbeitskopie)
106 106
    bool getHideInactiveConnections() const;
107 107
    void setHideInactiveConnections(bool hideInactiveConnections);
108 108

                
109
    QByteArray getGeometry(QString objectName) const;
110
    void setGeometry(QString objectName, QByteArray geometry);
111

                
112
    QByteArray getState(QString objectName) const;
113
    void setState(QString objectName, QByteArray state);
114

                
115
    int getCurrentTabIndex() const;
116
    void setCurrentTabIndex(int index);
117

                
109 118
private:
110 119
    QSettings *settings;
111 120
};