From fd792a3336f0d32c6ce8b6475f1f266efcb0c674 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 7 Nov 2024 14:00:04 -0500 Subject: [PATCH] More follow-up fixes for issue #131. --- NEWS | 10 ++++++- libseq66/src/sessions/smanager.cpp | 1 - seq_qt5/include/qsmainwnd.hpp | 3 +- seq_qt5/include/qt5nsmanager.hpp | 9 +++++- seq_qt5/src/qsmainwnd.cpp | 44 +++++++++++++++++++----------- seq_qt5/src/qt5nsmanager.cpp | 25 +++++++++++++++-- 6 files changed, 70 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 06001124..6e2e54c6 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ NEWS for Seq66 0.99.16 Chris Ahlstrom -2015-07-10 to 2024-11-04 +2015-07-10 to 2024-11-07 # Change Log @@ -10,10 +10,18 @@ Chris Ahlstrom - Refined documentation about the Import/Export functionality. - Added CONFIG\_DIR\_NAME and cleaned up configure.ac. +- Merged a fix from a pull request to update the \*.desktop files. ### Fixed - Fixed the display of tunes with various PPQNs such as 120. +- Fixed an issue with NSM interactions introduced in version 0.99.11, + plus other related issue: + - The NSM would show two clients for "qseq66" and "seq66" when adding + only the "qseq66" client. + - Saving via a remote NSM Save command or by the File / Save menu + would not clear the modified flag. + - Closing the session would not remove any external editor windows. ### Added diff --git a/libseq66/src/sessions/smanager.cpp b/libseq66/src/sessions/smanager.cpp index 0af5515f..9b18986e 100644 --- a/libseq66/src/sessions/smanager.cpp +++ b/libseq66/src/sessions/smanager.cpp @@ -61,7 +61,6 @@ #include "play/playlist.hpp" /* seq66::playlist class */ #include "sessions/smanager.hpp" /* seq66::smanager() */ #include "os/daemonize.hpp" /* seq66::reroute_stdio(), etc. */ -///// #include "util/basic_macros.hpp" /* seq66::msgprintf() */ #include "util/filefunctions.hpp" /* seq66::file_readable() etc. */ #if defined SEQ66_PORTMIDI_SUPPORT diff --git a/seq_qt5/include/qsmainwnd.hpp b/seq_qt5/include/qsmainwnd.hpp index bd388ded..aea01897 100644 --- a/seq_qt5/include/qsmainwnd.hpp +++ b/seq_qt5/include/qsmainwnd.hpp @@ -27,7 +27,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-12-22 + * \updates 2024-11-07 * \license GNU GPLv2 or above * * The main window is known as the "Patterns window" or "Patterns panel". It @@ -256,6 +256,7 @@ class qsmainwnd final : } void enable_save (bool flag = true); + void enable_save_update (bool flag = true); void make_perf_frame_in_tab (); bool check (); std::string midi_filename_prompt diff --git a/seq_qt5/include/qt5nsmanager.hpp b/seq_qt5/include/qt5nsmanager.hpp index cd1142b2..4004daa6 100644 --- a/seq_qt5/include/qt5nsmanager.hpp +++ b/seq_qt5/include/qt5nsmanager.hpp @@ -28,7 +28,7 @@ * \library qt5nsmanager application * \author Chris Ahlstrom * \date 2020-03-15 - * \updates 2024-11-06 + * \updates 2024-11-07 * \license GNU GPLv2 or above * * This is an attempt to change from the hoary old (or, as H.P. Lovecraft @@ -99,6 +99,13 @@ class qt5nsmanager : public QObject, public clinsmanager virtual void session_display_name (const std::string & dispname) override; virtual void session_client_id (const std::string & clid) override; + /* + * Version 0.99.16. Added to access main window to clear modified + * flag and remove editor windows. + */ + + virtual bool save_session (std::string & msg, bool ok = true) override; + private: void quit (); diff --git a/seq_qt5/src/qsmainwnd.cpp b/seq_qt5/src/qsmainwnd.cpp index c3b024d6..5132ebbd 100644 --- a/seq_qt5/src/qsmainwnd.cpp +++ b/seq_qt5/src/qsmainwnd.cpp @@ -24,7 +24,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2024-11-02 + * \updates 2024-11-07 * \license GNU GPLv2 or above * * The main window is known as the "Patterns window" or "Patterns panel". It @@ -38,7 +38,7 @@ * New MIDI FIle new_session() Clear file/playlist, set new name. * Import [Open] import_midi_into_session() Imports only a MIDI file. * Save session save_session() Save MIDI and configs in session. - * Save As HIDDEN See Export from Session. + * Save As HIDDEN See Export from session. * Export from ... save_file_as() Copy MIDI file outside of session. * Close (hidden) quit_session Detach from session management. * @@ -63,13 +63,11 @@ */ #include /* QErrorMessage */ -#include /* prompt for full MIDI file's path */ #include /* prompt for NSM MIDI file-name */ #include /* used for QScreen geometry() call */ #include /* QMessageBox */ #include /* QResizeEvent */ -#include /* Qscreen */ -#include /* QTimer */ +#include /* QScreen */ #undef USE_QDESKTOPSERVICES #if defined USE_QDESKTOPSERVICES @@ -1098,6 +1096,10 @@ qsmainwnd::closeEvent (QCloseEvent * event) if (usr().in_nsm_session()) { session_message("Close event with NSM"); + remove_all_editors(); + remove_qperfedit(); + remove_all_live_frames(); + remove_set_master(); } else { @@ -2412,13 +2414,24 @@ qsmainwnd::save_session () { std::string msg; result = session()->save_session(msg); - if (! result) + if (result) + enable_save_update(false); + else show_error_box(msg); } } return result; } +void +qsmainwnd::enable_save_update (bool flag) +{ + enable_save(flag); /* disable "File / Save" */ + update_all_editors_titles(flag); /* update title bars */ + cb_perf().unmodify(); /* avoid saving later */ + m_is_title_dirty = true; +} + bool qsmainwnd::save_file (const std::string & fname, bool updatemenu) { @@ -2455,8 +2468,7 @@ qsmainwnd::save_file (const std::string & fname, bool updatemenu) last_used_dir(path); rc().last_used_dir(path); } - enable_save(false); /* disable "File / Save" */ - update_all_editors_titles(false); + enable_save_update(false); song_path(filename); if (updatemenu) /* or ! use_nsm() */ update_recent_files_menu(); /* add the recent file-name */ @@ -3838,7 +3850,7 @@ qsmainwnd::connect_nsm_slots () * File / New. NSM version. */ - ui->actionNew->setText("&New MIDI File..."); + ui->actionNew->setText("&New MIDI file..."); ui->actionNew->setToolTip("Clear and set a new MIDI file in session."); connect ( @@ -3847,11 +3859,11 @@ qsmainwnd::connect_nsm_slots () ); /* - * File / Open versus File / Import / Import MIDI into Session. + * File / Open versus File / Import / Import MIDI into session. */ ui->actionOpen->setVisible(false); - ui->actionImportMIDIIntoSession->setText("&Import MIDI into Session..."); + ui->actionImportMIDIIntoSession->setText("&Import MIDI into session..."); ui->actionImportMIDIIntoSession->setToolTip ( "Import a MIDI/Seq66 file into the current session." @@ -3870,10 +3882,10 @@ qsmainwnd::connect_nsm_slots () ui->actionOpenPlaylist->setVisible(false); /* - * File / Save Session. + * File / Save session. */ - ui->actionSave->setText("&Save"); + ui->actionSave->setText("&Save session"); ui->actionSave->setToolTip ( "Save current MIDI file and configuration in the session." @@ -3891,10 +3903,10 @@ qsmainwnd::connect_nsm_slots () ui->actionSave_As->setVisible(false); /* - * File / Export from Session + * File / Export from session */ - ui->actionSave_As->setText("&Export from Session..."); + ui->actionSave_As->setText("&Export from session..."); ui->actionSave_As->setToolTip("Export as a Seq66 MIDI file."); connect ( @@ -3927,7 +3939,7 @@ qsmainwnd::connect_normal_slots () connect(ui->actionNew, SIGNAL(triggered(bool)), this, SLOT(new_file())); /* - * File / Open versus File / Import / Import MIDI into Session. + * File / Open versus File / Import / Import MIDI into session. */ ui->actionImportMIDIIntoSession->setVisible(false); diff --git a/seq_qt5/src/qt5nsmanager.cpp b/seq_qt5/src/qt5nsmanager.cpp index 7f36004e..407f01a2 100644 --- a/seq_qt5/src/qt5nsmanager.cpp +++ b/seq_qt5/src/qt5nsmanager.cpp @@ -25,7 +25,7 @@ * \library qt5nsmanager application * \author Chris Ahlstrom * \date 2020-03-15 - * \updates 2023-11-06 + * \updates 2023-11-07 * \license GNU GPLv2 or above * * Duty now for the future! Join the Smart Patrol! @@ -272,7 +272,7 @@ qt5nsmanager::create_window () /** * Will do more with this later. Currently we just call the base class. * Note that the auto-palette-save() value will always be false. - * Saving teh palette should be a manual option, as it is never changed + * Saving the palette should be a manual option, as it is never changed * during run-time. * * bool savepalette = rc().palette_active() || rc().auto_palette_save(); @@ -288,6 +288,12 @@ qt5nsmanager::close_session (std::string & msg, bool ok) std::string palfile = rc().palette_filespec(); saved = save_palette(global_palette(), palfile); } + + /* + * if (m_window) + * m_window->remove_all_editors(); + */ + bool closed = clinsmanager::close_session(msg, ok); return saved && closed; } @@ -481,6 +487,21 @@ qt5nsmanager::session_client_id (const std::string & clid) m_window->session_client_id(clid.empty() ? "None" : clid); } +/* + * Added in version 0.99.16 in order to clear the modified flag and + * close editor windows. + */ + +bool +qt5nsmanager::save_session (std::string & msg, bool ok) +{ + bool result = clinsmanager::save_session(msg, ok); + if (m_window && ok) + m_window->enable_save_update(false); + + return result; +} + void qt5nsmanager::handle_show_hide (bool hide) {