mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Save 'Unlock Panels' and 'Show Tabs on Top' settings (#223)
* 'Unlock Panels' and 'Show Tabs on Top' now saved to settings * added saveSettings method and renamed doLock to panelLock
This commit is contained in:
parent
5ef204d3b8
commit
0abcf20566
@ -107,7 +107,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
sectionsDock(nullptr),
|
||||
consoleDock(nullptr)
|
||||
{
|
||||
doLock = false;
|
||||
panelLock = false;
|
||||
tabsOnTop = false;
|
||||
configuration = new Configuration();
|
||||
}
|
||||
|
||||
@ -439,11 +440,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (saveProject(true))
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("size", size());
|
||||
settings.setValue("pos", pos());
|
||||
settings.setValue("state", saveState());
|
||||
saveSettings();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
else
|
||||
@ -453,11 +450,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
else if (ret == QMessageBox::Discard)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("size", size());
|
||||
settings.setValue("pos", pos());
|
||||
settings.setValue("state", saveState());
|
||||
saveSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -473,6 +466,59 @@ void MainWindow::readSettings()
|
||||
QByteArray state = settings.value("state", QByteArray()).toByteArray();
|
||||
restoreState(state);
|
||||
this->responsive = settings.value("responsive").toBool();
|
||||
panelLock = settings.value("panelLock").toBool();
|
||||
setPanelLock();
|
||||
tabsOnTop = settings.value("tabsOnTop").toBool();
|
||||
setTabLocation();
|
||||
}
|
||||
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("size", size());
|
||||
settings.setValue("pos", pos());
|
||||
settings.setValue("state", saveState());
|
||||
settings.setValue("panelLock", panelLock);
|
||||
settings.setValue("tabsOnTop", tabsOnTop);
|
||||
}
|
||||
|
||||
void MainWindow::setPanelLock()
|
||||
{
|
||||
if (panelLock)
|
||||
{
|
||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||
{
|
||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
|
||||
ui->actionLock->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||
{
|
||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
}
|
||||
|
||||
ui->actionLock->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setTabLocation()
|
||||
{
|
||||
if (tabsOnTop)
|
||||
{
|
||||
ui->centralTabWidget->setTabPosition(QTabWidget::North);
|
||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
|
||||
ui->actionTabs_on_Top->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->centralTabWidget->setTabPosition(QTabWidget::South);
|
||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
|
||||
ui->actionTabs_on_Top->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setDarkTheme()
|
||||
@ -493,21 +539,8 @@ void MainWindow::refreshAll()
|
||||
|
||||
void MainWindow::on_actionLock_triggered()
|
||||
{
|
||||
doLock = !doLock;
|
||||
if (doLock)
|
||||
{
|
||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||
{
|
||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||
{
|
||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
}
|
||||
}
|
||||
panelLock = !panelLock;
|
||||
setPanelLock();
|
||||
}
|
||||
|
||||
void MainWindow::lockUnlock_Docks(bool what)
|
||||
@ -551,16 +584,8 @@ void MainWindow::on_actionLockUnlock_triggered()
|
||||
|
||||
void MainWindow::on_actionTabs_triggered()
|
||||
{
|
||||
if (ui->centralTabWidget->tabPosition() == QTabWidget::South)
|
||||
{
|
||||
ui->centralTabWidget->setTabPosition(QTabWidget::North);
|
||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->centralTabWidget->setTabPosition(QTabWidget::South);
|
||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
|
||||
}
|
||||
tabsOnTop = !tabsOnTop;
|
||||
setTabLocation();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEntry_points_triggered()
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void readSettings();
|
||||
void saveSettings();
|
||||
void setFilename(const QString &fn);
|
||||
void addOutput(const QString &msg);
|
||||
void addDebugOutput(const QString &msg);
|
||||
@ -86,6 +87,9 @@ public slots:
|
||||
|
||||
void refreshAll();
|
||||
|
||||
void setPanelLock();
|
||||
void setTabLocation();
|
||||
|
||||
void setDarkTheme();
|
||||
void setDefaultTheme();
|
||||
|
||||
@ -174,7 +178,8 @@ private:
|
||||
//SideBar *sideBar;
|
||||
Configuration *configuration;
|
||||
|
||||
bool doLock;
|
||||
bool panelLock;
|
||||
bool tabsOnTop;
|
||||
ut64 hexdumpTopOffset;
|
||||
ut64 hexdumpBottomOffset;
|
||||
QString filename;
|
||||
|
Loading…
Reference in New Issue
Block a user