#include <QAction>
#include <QApplication>
#include <QButtonGroup>
+#include <QCloseEvent>
#include <QFileDialog>
#include <QMessageBox>
#include <QMenu>
_session(device_manager)
{
setup_ui();
+ restore_ui_settings();
if (open_file_name) {
const QString s(QString::fromUtf8(open_file_name));
QMetaObject::invokeMethod(this, "load_file",
{
setObjectName(QString::fromUtf8("MainWindow"));
- resize(1024, 768);
-
// Set the window icon
QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/sigrok-logo-notext.png"),
}
+void MainWindow::save_ui_settings()
+{
+ QSettings settings("sigrok", "PulseView");
+
+ settings.beginGroup("MainWindow");
+ settings.setValue("state", saveState());
+ settings.setValue("geometry", saveGeometry());
+ settings.endGroup();
+}
+
+void MainWindow::restore_ui_settings()
+{
+ QSettings settings("sigrok", "PulseView");
+
+ settings.beginGroup("MainWindow");
+
+ if (settings.contains("geometry")) {
+ restoreGeometry(settings.value("geometry").toByteArray());
+ restoreState(settings.value("state").toByteArray());
+ } else
+ resize(1000, 720);
+
+ settings.endGroup();
+}
+
void MainWindow::session_error(
const QString text, const QString info_text)
{
_sampling_bar->set_device_list(devices, selected_device);
}
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+ save_ui_settings();
+ event->accept();
+}
+
void MainWindow::load_file(QString file_name)
{
const QString errorMessage(
private:
void setup_ui();
+ void save_ui_settings();
+
+ void restore_ui_settings();
+
void session_error(const QString text, const QString info_text);
/**
*/
void update_device_list();
+ void closeEvent(QCloseEvent *event);
+
private Q_SLOTS:
void load_file(QString file_name);
-
void show_session_error(
const QString text, const QString info_text);