mirror of
https://github.com/epasveer/seer.git
synced 2026-08-30 00:50:42 +08:00
Checkpoint. Still working on saving highlight colors.
This commit is contained in:
+53
-12
@@ -2,6 +2,7 @@
|
||||
#include <QtWidgets/QListWidget>
|
||||
#include <QtWidgets/QListWidgetItem>
|
||||
#include <QtWidgets/QStackedWidget>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) {
|
||||
@@ -54,7 +55,8 @@ SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) {
|
||||
configSeerButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
// Connect things.
|
||||
connect(contentsListWidget, &QListWidget::currentItemChanged, this, &SeerConfigDialog::changePage);
|
||||
connect(contentsListWidget, &QListWidget::currentItemChanged, this, &SeerConfigDialog::handleChangePage);
|
||||
connect(buttonBox, &QDialogButtonBox::clicked, this, &SeerConfigDialog::handleButtonClicked);
|
||||
|
||||
// Set to first page.
|
||||
contentsListWidget->setCurrentRow(0);
|
||||
@@ -63,17 +65,6 @@ SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) {
|
||||
SeerConfigDialog::~SeerConfigDialog() {
|
||||
}
|
||||
|
||||
void SeerConfigDialog::changePage(QListWidgetItem* current, QListWidgetItem* previous) {
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << current << previous;
|
||||
|
||||
if (!current) {
|
||||
current = previous;
|
||||
}
|
||||
|
||||
pagesStackedWidget->setCurrentIndex(contentsListWidget->row(current));
|
||||
}
|
||||
|
||||
void SeerConfigDialog::setGdbProgram (const QString& program) {
|
||||
|
||||
_gdbConfigPage->setGdbProgram(program);
|
||||
@@ -124,3 +115,53 @@ const SeerHighlighterSettings& SeerConfigDialog::editorHighlighterSettings () co
|
||||
return _editorConfigPage->highlighterSettings();
|
||||
}
|
||||
|
||||
void SeerConfigDialog::handleChangePage(QListWidgetItem* current, QListWidgetItem* previous) {
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << current << previous;
|
||||
|
||||
if (!current) {
|
||||
current = previous;
|
||||
}
|
||||
|
||||
pagesStackedWidget->setCurrentIndex(contentsListWidget->row(current));
|
||||
}
|
||||
|
||||
void SeerConfigDialog::handleButtonClicked (QAbstractButton* button) {
|
||||
|
||||
// Handle resetting the config pages if "Reset" is clicked.
|
||||
if (buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole) {
|
||||
|
||||
QString itemLabel = contentsListWidget->currentItem()->text();
|
||||
|
||||
if (itemLabel == "GDB") {
|
||||
|
||||
int result = QMessageBox::warning(this, "Seer",
|
||||
QString("Reset settings for '") + itemLabel + "'?",
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if (result == QMessageBox::Ok) {
|
||||
setGdbProgram("/usr/bin/gdb");
|
||||
setGdbArguments("--interpreter=mi");
|
||||
setGdbAsyncMode(true);
|
||||
}
|
||||
|
||||
}else if (itemLabel == "Editor") {
|
||||
|
||||
int result = QMessageBox::warning(this, "Seer",
|
||||
QString("Reset settings for '") + itemLabel + "'?",
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if (result == QMessageBox::Ok) {
|
||||
setEditorFont(QFont("Source Code Pro"));
|
||||
setEditorHighlighterSettings(SeerHighlighterSettings::populateForCPP());
|
||||
}
|
||||
|
||||
}else if (itemLabel == "Source") {
|
||||
|
||||
}else if (itemLabel == "Seer") {
|
||||
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user