Skip to content

Commit

Permalink
More follow-up fixes for issue #131.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed Nov 7, 2024
1 parent eaf13b5 commit fd792a3
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 22 deletions.
10 changes: 9 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion libseq66/src/sessions/smanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion seq_qt5/include/qsmainwnd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion seq_qt5/include/qt5nsmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ();
Expand Down
44 changes: 28 additions & 16 deletions seq_qt5/src/qsmainwnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*
Expand All @@ -63,13 +63,11 @@
*/

#include <QErrorMessage> /* QErrorMessage */
#include <QFileDialog> /* prompt for full MIDI file's path */
#include <QInputDialog> /* prompt for NSM MIDI file-name */
#include <QGuiApplication> /* used for QScreen geometry() call */
#include <QMessageBox> /* QMessageBox */
#include <QResizeEvent> /* QResizeEvent */
#include <QScreen> /* Qscreen */
#include <QTimer> /* QTimer */
#include <QScreen> /* QScreen */

#undef USE_QDESKTOPSERVICES
#if defined USE_QDESKTOPSERVICES
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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
(
Expand All @@ -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."
Expand All @@ -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."
Expand All @@ -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
(
Expand Down Expand Up @@ -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);
Expand Down
25 changes: 23 additions & 2 deletions seq_qt5/src/qt5nsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit fd792a3

Please sign in to comment.