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),
|
sectionsDock(nullptr),
|
||||||
consoleDock(nullptr)
|
consoleDock(nullptr)
|
||||||
{
|
{
|
||||||
doLock = false;
|
panelLock = false;
|
||||||
|
tabsOnTop = false;
|
||||||
configuration = new Configuration();
|
configuration = new Configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,11 +440,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
{
|
{
|
||||||
if (saveProject(true))
|
if (saveProject(true))
|
||||||
{
|
{
|
||||||
QSettings settings;
|
saveSettings();
|
||||||
settings.setValue("geometry", saveGeometry());
|
|
||||||
settings.setValue("size", size());
|
|
||||||
settings.setValue("pos", pos());
|
|
||||||
settings.setValue("state", saveState());
|
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -453,11 +450,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
}
|
}
|
||||||
else if (ret == QMessageBox::Discard)
|
else if (ret == QMessageBox::Discard)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
saveSettings();
|
||||||
settings.setValue("geometry", saveGeometry());
|
|
||||||
settings.setValue("size", size());
|
|
||||||
settings.setValue("pos", pos());
|
|
||||||
settings.setValue("state", saveState());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -473,6 +466,59 @@ void MainWindow::readSettings()
|
|||||||
QByteArray state = settings.value("state", QByteArray()).toByteArray();
|
QByteArray state = settings.value("state", QByteArray()).toByteArray();
|
||||||
restoreState(state);
|
restoreState(state);
|
||||||
this->responsive = settings.value("responsive").toBool();
|
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()
|
void MainWindow::setDarkTheme()
|
||||||
@ -493,21 +539,8 @@ void MainWindow::refreshAll()
|
|||||||
|
|
||||||
void MainWindow::on_actionLock_triggered()
|
void MainWindow::on_actionLock_triggered()
|
||||||
{
|
{
|
||||||
doLock = !doLock;
|
panelLock = !panelLock;
|
||||||
if (doLock)
|
setPanelLock();
|
||||||
{
|
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
|
||||||
{
|
|
||||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
|
||||||
{
|
|
||||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::lockUnlock_Docks(bool what)
|
void MainWindow::lockUnlock_Docks(bool what)
|
||||||
@ -551,16 +584,8 @@ void MainWindow::on_actionLockUnlock_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionTabs_triggered()
|
void MainWindow::on_actionTabs_triggered()
|
||||||
{
|
{
|
||||||
if (ui->centralTabWidget->tabPosition() == QTabWidget::South)
|
tabsOnTop = !tabsOnTop;
|
||||||
{
|
setTabLocation();
|
||||||
ui->centralTabWidget->setTabPosition(QTabWidget::North);
|
|
||||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->centralTabWidget->setTabPosition(QTabWidget::South);
|
|
||||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEntry_points_triggered()
|
void MainWindow::on_actionEntry_points_triggered()
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
|
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
void saveSettings();
|
||||||
void setFilename(const QString &fn);
|
void setFilename(const QString &fn);
|
||||||
void addOutput(const QString &msg);
|
void addOutput(const QString &msg);
|
||||||
void addDebugOutput(const QString &msg);
|
void addDebugOutput(const QString &msg);
|
||||||
@ -86,6 +87,9 @@ public slots:
|
|||||||
|
|
||||||
void refreshAll();
|
void refreshAll();
|
||||||
|
|
||||||
|
void setPanelLock();
|
||||||
|
void setTabLocation();
|
||||||
|
|
||||||
void setDarkTheme();
|
void setDarkTheme();
|
||||||
void setDefaultTheme();
|
void setDefaultTheme();
|
||||||
|
|
||||||
@ -174,7 +178,8 @@ private:
|
|||||||
//SideBar *sideBar;
|
//SideBar *sideBar;
|
||||||
Configuration *configuration;
|
Configuration *configuration;
|
||||||
|
|
||||||
bool doLock;
|
bool panelLock;
|
||||||
|
bool tabsOnTop;
|
||||||
ut64 hexdumpTopOffset;
|
ut64 hexdumpTopOffset;
|
||||||
ut64 hexdumpBottomOffset;
|
ut64 hexdumpBottomOffset;
|
||||||
QString filename;
|
QString filename;
|
||||||
|
Loading…
Reference in New Issue
Block a user