mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 03:46:11 +00:00
Bye bye "General Settings", welcome "Appearance" (#837)
* Bye bye "General Settings", welcome "Appearance" * Fix Windows header * fix typo
This commit is contained in:
parent
96cffbeff2
commit
0567114b09
@ -155,7 +155,7 @@ SOURCES += \
|
|||||||
widgets/VisualNavbar.cpp \
|
widgets/VisualNavbar.cpp \
|
||||||
widgets/GraphView.cpp \
|
widgets/GraphView.cpp \
|
||||||
dialogs/preferences/PreferencesDialog.cpp \
|
dialogs/preferences/PreferencesDialog.cpp \
|
||||||
dialogs/preferences/GeneralOptionsWidget.cpp \
|
dialogs/preferences/AppearanceOptionsWidget.cpp \
|
||||||
dialogs/preferences/GraphOptionsWidget.cpp \
|
dialogs/preferences/GraphOptionsWidget.cpp \
|
||||||
dialogs/preferences/PreferenceCategory.cpp \
|
dialogs/preferences/PreferenceCategory.cpp \
|
||||||
widgets/QuickFilterView.cpp \
|
widgets/QuickFilterView.cpp \
|
||||||
@ -250,7 +250,7 @@ HEADERS += \
|
|||||||
widgets/VisualNavbar.h \
|
widgets/VisualNavbar.h \
|
||||||
widgets/GraphView.h \
|
widgets/GraphView.h \
|
||||||
dialogs/preferences/PreferencesDialog.h \
|
dialogs/preferences/PreferencesDialog.h \
|
||||||
dialogs/preferences/GeneralOptionsWidget.h \
|
dialogs/preferences/AppearanceOptionsWidget.h \
|
||||||
dialogs/preferences/PreferenceCategory.h \
|
dialogs/preferences/PreferenceCategory.h \
|
||||||
dialogs/preferences/GraphOptionsWidget.h \
|
dialogs/preferences/GraphOptionsWidget.h \
|
||||||
widgets/QuickFilterView.h \
|
widgets/QuickFilterView.h \
|
||||||
@ -327,7 +327,7 @@ FORMS += \
|
|||||||
widgets/HexdumpWidget.ui \
|
widgets/HexdumpWidget.ui \
|
||||||
dialogs/SaveProjectDialog.ui \
|
dialogs/SaveProjectDialog.ui \
|
||||||
dialogs/preferences/PreferencesDialog.ui \
|
dialogs/preferences/PreferencesDialog.ui \
|
||||||
dialogs/preferences/GeneralOptionsWidget.ui \
|
dialogs/preferences/AppearanceOptionsWidget.ui \
|
||||||
dialogs/preferences/GraphOptionsWidget.ui \
|
dialogs/preferences/GraphOptionsWidget.ui \
|
||||||
widgets/QuickFilterView.ui \
|
widgets/QuickFilterView.ui \
|
||||||
widgets/PseudocodeWidget.ui \
|
widgets/PseudocodeWidget.ui \
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "PreferencesDialog.h"
|
#include "PreferencesDialog.h"
|
||||||
#include "GeneralOptionsWidget.h"
|
#include "AppearanceOptionsWidget.h"
|
||||||
#include "ui_GeneralOptionsWidget.h"
|
#include "ui_AppearanceOptionsWidget.h"
|
||||||
|
|
||||||
#include "utils/Helpers.h"
|
#include "utils/Helpers.h"
|
||||||
#include "utils/Configuration.h"
|
#include "utils/Configuration.h"
|
||||||
@ -14,9 +14,9 @@
|
|||||||
#include "utils/ColorSchemeFileSaver.h"
|
#include "utils/ColorSchemeFileSaver.h"
|
||||||
#include "widgets/ColorSchemePrefWidget.h"
|
#include "widgets/ColorSchemePrefWidget.h"
|
||||||
|
|
||||||
GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *parent)
|
AppearanceOptionsWidget::AppearanceOptionsWidget(PreferencesDialog *dialog, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::GeneralOptionsWidget)
|
ui(new Ui::AppearanceOptionsWidget)
|
||||||
{
|
{
|
||||||
Q_UNUSED(dialog);
|
Q_UNUSED(dialog);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -24,7 +24,7 @@ GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *p
|
|||||||
updateFontFromConfig();
|
updateFontFromConfig();
|
||||||
updateThemeFromConfig();
|
updateThemeFromConfig();
|
||||||
|
|
||||||
connect(Config(), &Configuration::fontsUpdated, this, &GeneralOptionsWidget::updateFontFromConfig);
|
connect(Config(), &Configuration::fontsUpdated, this, &AppearanceOptionsWidget::updateFontFromConfig);
|
||||||
connect(ui.get()->colorComboBox, &QComboBox::currentTextChanged, [&](const QString & name) {
|
connect(ui.get()->colorComboBox, &QComboBox::currentTextChanged, [&](const QString & name) {
|
||||||
static_cast<ColorSchemePrefWidget *>(ui.get()->colorSchemePrefWidget)->setNewScheme(name);
|
static_cast<ColorSchemePrefWidget *>(ui.get()->colorSchemePrefWidget)->setNewScheme(name);
|
||||||
});
|
});
|
||||||
@ -32,15 +32,15 @@ GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *p
|
|||||||
(ui.get()->colorSchemePrefWidget)->setNewScheme(Config()->getCurrentTheme());
|
(ui.get()->colorSchemePrefWidget)->setNewScheme(Config()->getCurrentTheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralOptionsWidget::~GeneralOptionsWidget() {}
|
AppearanceOptionsWidget::~AppearanceOptionsWidget() {}
|
||||||
|
|
||||||
void GeneralOptionsWidget::updateFontFromConfig()
|
void AppearanceOptionsWidget::updateFontFromConfig()
|
||||||
{
|
{
|
||||||
QFont currentFont = Config()->getFont();
|
QFont currentFont = Config()->getFont();
|
||||||
ui->fontSelectionLabel->setText(currentFont.toString());
|
ui->fontSelectionLabel->setText(currentFont.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::updateThemeFromConfig()
|
void AppearanceOptionsWidget::updateThemeFromConfig()
|
||||||
{
|
{
|
||||||
// Disconnect currentIndexChanged because clearing the comboxBox and refiling it causes its index to change.
|
// Disconnect currentIndexChanged because clearing the comboxBox and refiling it causes its index to change.
|
||||||
disconnect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -68,7 +68,7 @@ void GeneralOptionsWidget::updateThemeFromConfig()
|
|||||||
SLOT(on_colorComboBox_currentIndexChanged(int)));
|
SLOT(on_colorComboBox_currentIndexChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::on_fontSelectionButton_clicked()
|
void AppearanceOptionsWidget::on_fontSelectionButton_clicked()
|
||||||
{
|
{
|
||||||
QFont currentFont = Config()->getFont();
|
QFont currentFont = Config()->getFont();
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -79,20 +79,20 @@ void GeneralOptionsWidget::on_fontSelectionButton_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::on_themeComboBox_currentIndexChanged(int index)
|
void AppearanceOptionsWidget::on_themeComboBox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
//disconnect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
//disconnect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
||||||
Config()->setTheme(index);
|
Config()->setTheme(index);
|
||||||
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::on_colorComboBox_currentIndexChanged(int index)
|
void AppearanceOptionsWidget::on_colorComboBox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QString theme = ui->colorComboBox->itemText(index);
|
QString theme = ui->colorComboBox->itemText(index);
|
||||||
Config()->setColorTheme(theme);
|
Config()->setColorTheme(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::on_copyButton_clicked()
|
void AppearanceOptionsWidget::on_copyButton_clicked()
|
||||||
{
|
{
|
||||||
QString newSchemeName;
|
QString newSchemeName;
|
||||||
do {
|
do {
|
||||||
@ -110,7 +110,7 @@ void GeneralOptionsWidget::on_copyButton_clicked()
|
|||||||
ui.get()->colorComboBox->setCurrentIndex(ui.get()->colorComboBox->findText(newSchemeName));
|
ui.get()->colorComboBox->setCurrentIndex(ui.get()->colorComboBox->findText(newSchemeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralOptionsWidget::on_deleteButton_clicked()
|
void AppearanceOptionsWidget::on_deleteButton_clicked()
|
||||||
{
|
{
|
||||||
ColorSchemeFileWorker().deleteScheme(Config()->getCurrentTheme());
|
ColorSchemeFileWorker().deleteScheme(Config()->getCurrentTheme());
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#ifndef GENERALOPTIONSWIDGET_H
|
#ifndef AppearanceOptionsWidget_H
|
||||||
#define GENERALOPTIONSWIDGET_H
|
#define AppearanceOptionsWidget_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -11,19 +11,19 @@
|
|||||||
class PreferencesDialog;
|
class PreferencesDialog;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GeneralOptionsWidget;
|
class AppearanceOptionsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneralOptionsWidget : public QDialog
|
class AppearanceOptionsWidget : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *parent = nullptr);
|
explicit AppearanceOptionsWidget(PreferencesDialog *dialog, QWidget *parent = nullptr);
|
||||||
~GeneralOptionsWidget();
|
~AppearanceOptionsWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::GeneralOptionsWidget> ui;
|
std::unique_ptr<Ui::AppearanceOptionsWidget> ui;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateFontFromConfig();
|
void updateFontFromConfig();
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>GeneralOptionsWidget</class>
|
<class>AppearanceOptionsWidget</class>
|
||||||
<widget class="QWidget" name="GeneralOptionsWidget">
|
<widget class="QWidget" name="AppearanceOptionsWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>General</string>
|
<string>Appearance</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
@ -3,7 +3,7 @@
|
|||||||
#include "PreferencesDialog.h"
|
#include "PreferencesDialog.h"
|
||||||
#include "ui_PreferencesDialog.h"
|
#include "ui_PreferencesDialog.h"
|
||||||
|
|
||||||
#include "GeneralOptionsWidget.h"
|
#include "AppearanceOptionsWidget.h"
|
||||||
#include "AsmOptionsWidget.h"
|
#include "AsmOptionsWidget.h"
|
||||||
#include "GraphOptionsWidget.h"
|
#include "GraphOptionsWidget.h"
|
||||||
#include "DebugOptionsWidget.h"
|
#include "DebugOptionsWidget.h"
|
||||||
@ -22,11 +22,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QList<PreferenceCategory> prefs {
|
QList<PreferenceCategory> prefs {
|
||||||
{
|
|
||||||
"General",
|
|
||||||
new GeneralOptionsWidget(this),
|
|
||||||
QIcon(":/img/icons/cog_light.svg")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Assembly",
|
"Assembly",
|
||||||
new AsmOptionsWidget(this),
|
new AsmOptionsWidget(this),
|
||||||
@ -43,6 +39,11 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
|
|||||||
"Debug",
|
"Debug",
|
||||||
new DebugOptionsWidget(this),
|
new DebugOptionsWidget(this),
|
||||||
QIcon(":/img/icons/bug_light.svg")
|
QIcon(":/img/icons/bug_light.svg")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Appearance",
|
||||||
|
new AppearanceOptionsWidget(this),
|
||||||
|
QIcon(":/img/icons/polar_light.svg")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ void PreferencesDialog::showSection(PreferencesDialog::Section section)
|
|||||||
{
|
{
|
||||||
QTreeWidgetItem *defitem;
|
QTreeWidgetItem *defitem;
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case Section::General:
|
case Section::Appearance:
|
||||||
ui->configPanel->setCurrentIndex(0);
|
ui->configPanel->setCurrentIndex(0);
|
||||||
defitem = ui->configCategories->topLevelItem(0);
|
defitem = ui->configCategories->topLevelItem(0);
|
||||||
ui->configCategories->setCurrentItem(defitem, 0);
|
ui->configCategories->setCurrentItem(defitem, 0);
|
||||||
|
@ -18,7 +18,7 @@ class PreferencesDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Section { General, Disassembly };
|
enum class Section { Appearance, Disassembly };
|
||||||
|
|
||||||
explicit PreferencesDialog(QWidget *parent = nullptr);
|
explicit PreferencesDialog(QWidget *parent = nullptr);
|
||||||
~PreferencesDialog();
|
~PreferencesDialog();
|
||||||
|
Loading…
Reference in New Issue
Block a user