Skip to content

Commit

Permalink
Merge pull request #73 from cvut/fix-coreview-lost-focus
Browse files Browse the repository at this point in the history
GUI: rework editor
  • Loading branch information
jdupak authored Oct 30, 2023
2 parents 4656ca3 + 2f14bf0 commit daec4b6
Show file tree
Hide file tree
Showing 17 changed files with 889 additions and 506 deletions.
9 changes: 7 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ set(gui_SOURCES
ui/hexlineedit.cpp
windows/editor/highlighterasm.cpp
windows/editor/highlighterc.cpp
windows/editor/linenumberarea.cpp
windows/editor/editordock.cpp
windows/editor/editortab.cpp
hinttabledelegate.cpp
windows/lcd/lcddisplaydock.cpp
windows/lcd/lcddisplayview.cpp
Expand All @@ -45,7 +48,7 @@ set(gui_SOURCES
textsignalaction.cpp
windows/coreview/components/value_handlers.cpp
windows/coreview/components/cache.cpp
widgets/HidingTabWidget.cpp
widgets/hidingtabwidget.cpp
)
set(gui_HEADERS
dialogs/about/aboutdialog.h
Expand All @@ -67,6 +70,8 @@ set(gui_HEADERS
ui/hexlineedit.h
windows/editor/highlighterasm.h
windows/editor/highlighterc.h
windows/editor/linenumberarea.h
windows/editor/editordock.h
hinttabledelegate.h
windows/lcd/lcddisplaydock.h
windows/lcd/lcddisplayview.h
Expand All @@ -86,7 +91,7 @@ set(gui_HEADERS
windows/coreview/data.h
windows/coreview/components/cache.h
helper/async_modal.h
widgets/HidingTabWidget.h
widgets/hidingtabwidget.h
)
set(gui_UI
dialogs/gotosymbol/gotosymboldialog.ui
Expand Down
21 changes: 7 additions & 14 deletions src/gui/dialogs/savechanged/savechangeddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <QTabWidget>
#include <QVBoxLayout>

SaveChnagedDialog::SaveChnagedDialog(QStringList &changedlist, QWidget *parent)
: QDialog(parent) {
SaveChangedDialog::SaveChangedDialog(QStringList &changedlist, QWidget *parent) : QDialog(parent) {
setAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_ShowModal);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Expand Down Expand Up @@ -49,15 +48,9 @@ SaveChnagedDialog::SaveChnagedDialog(QStringList &changedlist, QWidget *parent)
auto *ignoreButton = new QPushButton(tr("&Ignore"), parent);
auto *saveButton = new QPushButton(tr("&Save"), parent);
saveButton->setFocus();
connect(
cancelButton, &QAbstractButton::clicked, this,
&SaveChnagedDialog::cancel_clicked);
connect(
ignoreButton, &QAbstractButton::clicked, this,
&SaveChnagedDialog::ignore_clicked);
connect(
saveButton, &QAbstractButton::clicked, this,
&SaveChnagedDialog::save_clicked);
connect(cancelButton, &QAbstractButton::clicked, this, &SaveChangedDialog::cancel_clicked);
connect(ignoreButton, &QAbstractButton::clicked, this, &SaveChangedDialog::ignore_clicked);
connect(saveButton, &QAbstractButton::clicked, this, &SaveChangedDialog::save_clicked);
hlBtn->addWidget(cancelButton);
hlBtn->addStretch();
hlBtn->addWidget(ignoreButton);
Expand All @@ -69,19 +62,19 @@ SaveChnagedDialog::SaveChnagedDialog(QStringList &changedlist, QWidget *parent)
setMinimumSize(400, 300);
}

void SaveChnagedDialog::cancel_clicked() {
void SaveChangedDialog::cancel_clicked() {
QStringList list;
emit user_decision(true, list);
close();
}

void SaveChnagedDialog::ignore_clicked() {
void SaveChangedDialog::ignore_clicked() {
QStringList list;
emit user_decision(false, list);
close();
}

void SaveChnagedDialog::save_clicked() {
void SaveChangedDialog::save_clicked() {
QStringList list;
for (int r = 0; r < model->rowCount(); ++r) {
if (model->item(r)->checkState() == Qt::Checked) {
Expand Down
6 changes: 2 additions & 4 deletions src/gui/dialogs/savechanged/savechangeddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
#include <QStandardItemModel>
#include <QStringList>

class SaveChnagedDialog : public QDialog {
class SaveChangedDialog : public QDialog {
Q_OBJECT

public:
explicit SaveChnagedDialog(
QStringList &changedlist,
QWidget *parent = nullptr);
explicit SaveChangedDialog(QStringList &changedlist, QWidget *parent = nullptr);
signals:
void user_decision(bool cancel, QStringList tosavelist);
private slots:
Expand Down
Loading

0 comments on commit daec4b6

Please sign in to comment.