diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-17 19:53:33 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-17 19:53:33 +0200 |
commit | 4885535c9e1da9b1a718125273bfe76933c7fff8 (patch) | |
tree | d753b37ba7860bcdddb2cf2f737e727b809d5270 /qtmips_gui | |
parent | 139dcf818566f9f2a48d95cdab9ad9e2ac7c7978 (diff) | |
download | qtmips-4885535c9e1da9b1a718125273bfe76933c7fff8.tar.gz qtmips-4885535c9e1da9b1a718125273bfe76933c7fff8.tar.bz2 qtmips-4885535c9e1da9b1a718125273bfe76933c7fff8.zip |
Do not open editor twice for same filename.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/mainwindow.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index 87549d2..19299c0 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -584,7 +584,14 @@ void MainWindow::open_source() { file_name = QFileDialog::getOpenFileName(this, tr("Open File"), "", "Source Files (*.asm *.S *.s)"); if (!file_name.isEmpty()) { - SrcEditor *editor = new SrcEditor(); + SrcEditor *editor = source_editor_for_file(file_name, false); + if (editor != nullptr) { + if (central_window != nullptr) + central_window->setCurrentWidget(editor); + return; + } + editor = new SrcEditor(); + if (editor->loadFile(file_name)) { add_src_editor_to_tabs(editor); } else { |