Files
qt5-legatus-legacy/Lts/Plugins/PlanEditor/favourites_action_manager.h
T
2026-08-13 18:33:10 +02:00

180 lines
4.1 KiB
Objective-C
Executable File

/**
**
** @RDE_HEADER@
** Used to manage buttons of favourite symbols.
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 29.07.2016, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include "logging.h"
namespace SituationMap
{
class Map;
}
namespace LtsWidgets
{
class LtsBaseLayoutWidget;
}
namespace PlanEditor
{
class PlanEditor;
class FavouriteProps;
class SymbolFavourites;
class PlanEditorSession;
/**
@class FavouritesActionManager
@brief Manager class to handle widget and icons used to control symbols from user interface.
*/
class FavouritesActionManager : public QObject
{
Q_OBJECT
public:
/**
@name Construction & Destruction
@{
*/
FavouritesActionManager(PlanEditor *planEditor, SituationMap::Map *map, const PlanEditorSession &session);
virtual ~FavouritesActionManager();
/** @} */
void initMainMenu( bool retranslate = false );
void initFromDefaultSettings();
SymbolFavourites *symbolFavourites() const;
void removeActionItems();
public slots:
/**
Slot to add new symbol to favourites.
@param scope Scope of symbol
@param sidc Code of symbol
*/
void onSymbolFavouriteAdd(const QString &scope, const QString &sidc);
/**
Slot to delete new symbol to favourites.
@param sidc Code of symbol.
*/
void onSymbolFavouriteDelete(const QString &sidc);
/**
Slot to delete scope and all attached symbols.
@param scope Name of scope to delete.
*/
void onSymbolFavouriteDeleteScope(const QString &scope);
/**
Slot to save favourites with QSettings
*/
void onSaveFavouritesToSettings();
/**
Slot to save scope to file.
@param scope Name of scope to save.
*/
void onScopeSaveToFile(const QString &scope);
/**
Slot to load scope from file. In case of success returns a list of scope names otherwise
an empty QStringList is returned.
*/
QStringList onScopeLoadFromFile();
/**
Slot to save scope via setting service. In case of success returns a list of scope names otherwise
an empty QStringList is returned.
@param scope Name of scope to store
*/
void onScopeStoreViaSettingService(const QString &scope);
/**
Slot to load scope viasetting service. In case of success returns a list of scope names otherwise
an empty QStringList is returned.
*/
QStringList onScopeLoadViaSettingService();
signals:
/**
When scopes are created or removed the signal updateSymbolScopes is emitted with current list of scopes.
@param scopeList List of all scope names.
*/
void updateSymbolScopes(const QStringList &scopeList);
private:
class InternalData;
InternalData *m_internal;
FavouriteProps &buildFavouriteAction(const QString &scope, const QString &sidc, const QString &name, const QPixmap &symbolPixmap);
private slots:
/**
Internal slots which are called from class SymbolFavourites to create new elements of user interface
or remove them.
@{
*/
void onNewFavouritesScope(const QString &scope);
void onNewFavouritesSymbol(const QString &scope, const QString &sidc);
void onDeleteFavouritesScope(const QString &scope);
void onDeleteFavouritesSymbol(const QString &sidc);
void onDeleteFavouriteSymbol();
/** @} */
/**
Remove all QAction and menus associated to a scope.
@param scope Name of scope to look up associated actions and menus.
*/
void removeScopeMenus(const QString &scope);
}; // FavouritesActionManager
} // namespace PlanEditor