Merge pull request #1355 from KLayout/issue-1349

Fixed issue-1349 (Add application events for indicating start/finish …
This commit is contained in:
Matthias Köfferlein 2023-05-05 23:12:53 +02:00 committed by GitHub
commit 0bc97df381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 24 deletions

View File

@ -760,6 +760,16 @@ Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "M
"\n"
"This event has been added in version 0.25.\n"
) +
gsi::event ("on_session_about_to_be_restored", &lay::MainWindow::begin_restore_session,
"@brief An event indicating that a session is about to be restored\n"
"\n"
"This event has been added in version 0.28.8.\n"
) +
gsi::event ("on_session_restored", &lay::MainWindow::end_restore_session,
"@brief An event indicating that a session was restored\n"
"\n"
"This event has been added in version 0.28.8.\n"
) +
gsi::method ("show_macro_editor", &lay::MainWindow::show_macro_editor, gsi::arg ("cat", std::string ()), gsi::arg ("add", false),
"@brief Shows the macro editor\n"
"If 'cat' is given, this category will be selected in the category tab. "

View File

@ -2062,8 +2062,17 @@ MainWindow::restore_session (const std::string &fn)
m_current_session = fn;
lay::Session session;
session.load (fn);
session.restore (*this);
read_dock_widget_state ();
begin_restore_session ();
try {
session.restore (*this);
read_dock_widget_state ();
end_restore_session ();
} catch (...) {
read_dock_widget_state ();
end_restore_session ();
throw;
}
}
void

View File

@ -532,28 +532,6 @@ public:
*/
std::string all_layout_file_formats () const;
/**
* @brief An event indicating that the current view has changed
* This event is fired if the current view was changed.
* The current view's reference is updated if the event is issued.
*/
tl::Event current_view_changed_event;
/**
* @brief An event indicating that a view was closed
* If a view is closed, this event is triggered. When the signal is sent,
* the view still points to the view being closed which is still valid.
* The integer parameter will receive the index of the view about to be closed.
*/
tl::event<int> view_closed_event;
/**
* @brief An event indicating that a new view is created
* If a new view is created, this event will be triggered.
* The integer parameter will receive the index of the view that was created.
*/
tl::event<int> view_created_event;
/**
* @brief Adds an entry to the MRU list with the initial technology
*/
@ -595,6 +573,38 @@ public:
*/
void dropEvent(QDropEvent *event);
/**
* @brief An event indicating that the current view has changed
* This event is fired if the current view was changed.
* The current view's reference is updated if the event is issued.
*/
tl::Event current_view_changed_event;
/**
* @brief An event indicating that a view was closed
* If a view is closed, this event is triggered. When the signal is sent,
* the view still points to the view being closed which is still valid.
* The integer parameter will receive the index of the view about to be closed.
*/
tl::event<int> view_closed_event;
/**
* @brief An event indicating that a new view is created
* If a new view is created, this event will be triggered.
* The integer parameter will receive the index of the view that was created.
*/
tl::event<int> view_created_event;
/**
* @brief An event indicating the start of a session restore
*/
tl::Event begin_restore_session;
/**
* @brief An event indicating the end of a session restore
*/
tl::Event end_restore_session;
signals:
void closed ();