Skip to content

Commit

Permalink
Merge pull request #133 from ModOrganizer2/dev/refresh-callback
Browse files Browse the repository at this point in the history
Refresh Callback (+ Extra for AboutToRun)
  • Loading branch information
Holt59 authored Sep 29, 2023
2 parents a67db9b + 7ef39f5 commit a9186c3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/imoinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef IMOINFO_H
#define IMOINFO_H

#include <QDir>
#include <QList>
#include <QMainWindow>
#include <QString>
Expand Down Expand Up @@ -395,12 +396,16 @@ class QDLLEXPORT IOrganizer : public QObject
*
* Parameters of the callback:
* - Path (absolute) to the application to be run.
* - [Optional] Working directory for the run.
* - [Optional] Argument for the binary.
*
* The callback can return false to prevent the application from being launched.
*
* @param func Function to be called when an application is run.
*/
virtual bool onAboutToRun(const std::function<bool(const QString&)>& func) = 0;
virtual bool onAboutToRun(
const std::function<bool(const QString&, const QDir&, const QString&)>& func) = 0;

/**
* @brief Add a new callback to be called when an has finished running.
Expand All @@ -427,6 +432,17 @@ class QDLLEXPORT IOrganizer : public QObject
virtual bool
onUserInterfaceInitialized(std::function<void(QMainWindow*)> const& func) = 0;

/**
* @brief Add a new callback to be called when the next refresh finishes (or
* immediately if possible).
*
* @param func Callback.
* @param immediateIfPossible If true and no refresh is in progress, the callback will
* be called immediately.
*/
virtual bool onNextRefresh(std::function<void()> const& func,
bool immediateIfPossible = true) = 0;

/**
* @brief Add a new callback to be called when a new profile is created.
*
Expand Down

0 comments on commit a9186c3

Please sign in to comment.