Delete shortcut when deleting instances
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
0a89f5cfaa
commit
d3f337d6ef
11 changed files with 168 additions and 67 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <cassert>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
|
@ -66,6 +67,16 @@ class BaseInstance;
|
|||
// pointer for lazy people
|
||||
using InstancePtr = std::shared_ptr<BaseInstance>;
|
||||
|
||||
/// Shortcut saving target representations
|
||||
enum class ShortcutTarget { Desktop, Applications, Other };
|
||||
|
||||
/// Shortcut data representation
|
||||
struct ShortcutData {
|
||||
QString name;
|
||||
QString filePath;
|
||||
ShortcutTarget target;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Base class for instances.
|
||||
* This class implements many functions that are common between instances and
|
||||
|
@ -129,6 +140,10 @@ class BaseInstance : public QObject, public std::enable_shared_from_this<BaseIns
|
|||
/// Sync name and rename instance dir accordingly; returns true if successful
|
||||
bool syncInstanceDirName(const QString& newRoot) const;
|
||||
|
||||
/// Register a created shortcut
|
||||
void registerShortcut(const ShortcutData& data);
|
||||
QList<ShortcutData>& getShortcuts();
|
||||
|
||||
/// Value used for instance window titles
|
||||
QString windowTitle() const;
|
||||
|
||||
|
@ -308,6 +323,8 @@ class BaseInstance : public QObject, public std::enable_shared_from_this<BaseIns
|
|||
|
||||
SettingsObjectWeakPtr m_global_settings;
|
||||
bool m_specific_settings_loaded = false;
|
||||
|
||||
QList<ShortcutData> m_shortcuts;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(shared_qobject_ptr<BaseInstance>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue