diff --git a/core/libs/database/coredb/coredbfields.h b/core/libs/database/coredb/coredbfields.h index 4de69e1aac..7e86dbc425 100644 --- a/core/libs/database/coredb/coredbfields.h +++ b/core/libs/database/coredb/coredbfields.h @@ -1,600 +1,600 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2007-09-22 * Description : Core database field enumerations. * * Copyright (C) 2007-2012 by Marcel Wiesweg * Copyright (C) 2011-2020 by Gilles Caulier * Copyright (C) 2013 by Michael G. Hansen * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_CORE_DB_FIELDS_H #define DIGIKAM_CORE_DB_FIELDS_H #include "digikam_config.h" // C++ includes #include // Qt includes #include #include #include // Local includes #include "digikam_export.h" #ifdef HAVE_DBUS class QDBusArgument; #endif namespace Digikam { namespace DatabaseFields { enum ImagesField { ImagesNone = 0, Album = 1 << 0, Name = 1 << 1, Status = 1 << 2, Category = 1 << 3, ModificationDate = 1 << 4, FileSize = 1 << 5, UniqueHash = 1 << 6, ManualOrder = 1 << 7, ImagesAll = Album | Name | Status | Category | ModificationDate | FileSize | UniqueHash | ManualOrder, ImagesFirst = Album, ImagesLast = ManualOrder }; typedef uint8_t ImagesMinSizeType; enum ItemInformationField { ItemInformationNone = 0, Rating = 1 << 0, CreationDate = 1 << 1, DigitizationDate = 1 << 2, Orientation = 1 << 3, Width = 1 << 4, Height = 1 << 5, Format = 1 << 6, ColorDepth = 1 << 7, ColorModel = 1 << 8, ColorLabel = 1 << 9, PickLabel = 1 << 10, ItemInformationAll = Rating | CreationDate | DigitizationDate | Orientation | Width | Height | Format | ColorDepth | ColorModel | ColorLabel | PickLabel, ItemInformationFirst = Rating, ItemInformationLast = PickLabel }; typedef uint16_t ItemInformationMinSizeType; enum ImageMetadataField { ImageMetadataNone = 0, Make = 1 << 0, Model = 1 << 1, Lens = 1 << 2, Aperture = 1 << 3, FocalLength = 1 << 4, FocalLength35 = 1 << 5, ExposureTime = 1 << 6, ExposureProgram = 1 << 7, ExposureMode = 1 << 8, Sensitivity = 1 << 9, FlashMode = 1 << 10, WhiteBalance = 1 << 11, WhiteBalanceColorTemperature = 1 << 12, MeteringMode = 1 << 13, SubjectDistance = 1 << 14, SubjectDistanceCategory = 1 << 15, ImageMetadataAll = Make | Model | Lens | Aperture | FocalLength | FocalLength35 | ExposureTime | ExposureProgram | ExposureMode | Sensitivity | FlashMode | WhiteBalance | WhiteBalanceColorTemperature | MeteringMode | SubjectDistance | SubjectDistanceCategory, ImageMetadataFirst = Make, ImageMetadataLast = SubjectDistanceCategory }; typedef uint16_t ImageMetadataMinSizeType; enum ItemPositionsField { ItemPositionsNone = 0, Latitude = 1 << 0, LatitudeNumber = 1 << 1, Longitude = 1 << 2, LongitudeNumber = 1 << 3, Altitude = 1 << 4, PositionOrientation = 1 << 5, PositionTilt = 1 << 6, PositionRoll = 1 << 7, PositionAccuracy = 1 << 8, PositionDescription = 1 << 9, ItemPositionsAll = Latitude | LatitudeNumber | Longitude | LongitudeNumber | Altitude | PositionOrientation | PositionRoll | PositionTilt | PositionAccuracy | PositionDescription, ItemPositionsFirst = Latitude, ItemPositionsLast = PositionDescription }; typedef uint16_t ItemPositionsMinSizeType; enum ItemCommentsField { ItemCommentsNone = 0, CommentType = 1 << 0, CommentLanguage = 1 << 1, CommentAuthor = 1 << 2, CommentDate = 1 << 3, Comment = 1 << 4, ItemCommentsAll = CommentType | CommentAuthor | CommentLanguage | CommentDate | Comment, ItemCommentsFirst = CommentType, ItemCommentsLast = Comment }; typedef uint8_t ItemCommentsMinSizeType; enum ImageHistoryInfoField { ImageHistoryInfoNone = 0, ImageUUID = 1 << 0, ImageHistory = 1 << 1, ImageRelations = 1 << 2, ImageHistoryInfoAll = ImageUUID | ImageHistory | ImageRelations, ImageHistoryInfoFirst = ImageUUID, ImageHistoryInfoLast = ImageRelations }; typedef uint8_t ImageHistoryInfoMinSizeType; enum VideoMetadataField { VideoMetadataNone = 0, AspectRatio = 1 << 0, AudioBitRate = 1 << 1, AudioChannelType = 1 << 2, AudioCodec = 1 << 3, Duration = 1 << 4, FrameRate = 1 << 5, VideoCodec = 1 << 6, VideoMetadataAll = AspectRatio | AudioBitRate | AudioChannelType | AudioCodec | Duration | FrameRate | VideoCodec, VideoMetadataFirst = AspectRatio, VideoMetadataLast = VideoCodec }; typedef uint8_t VideoMetadataMinSizeType; Q_DECLARE_FLAGS(Images, ImagesField) Q_DECLARE_FLAGS(ItemInformation, ItemInformationField) Q_DECLARE_FLAGS(ImageMetadata, ImageMetadataField) Q_DECLARE_FLAGS(ItemComments, ItemCommentsField) Q_DECLARE_FLAGS(ItemPositions, ItemPositionsField) Q_DECLARE_FLAGS(ImageHistoryInfo, ImageHistoryInfoField) Q_DECLARE_FLAGS(VideoMetadata, VideoMetadataField) template class FieldMetaInfo { }; #define DECLARE_FIELDMETAINFO(FieldName) \ template<> class DIGIKAM_DATABASE_EXPORT FieldMetaInfo \ { \ public: \ static const FieldName##Field First = FieldName##First; \ static const FieldName##Field Last = FieldName##Last; \ typedef FieldName##MinSizeType MinSizeType; \ inline static MinSizeType toMinSizeType(const FieldName value) { return MinSizeType(value); } \ inline static FieldName fromMinSizeType(const MinSizeType value) { return FieldName(value); } \ }; DECLARE_FIELDMETAINFO(Images) DECLARE_FIELDMETAINFO(ItemInformation) DECLARE_FIELDMETAINFO(ImageMetadata) DECLARE_FIELDMETAINFO(ItemComments) DECLARE_FIELDMETAINFO(ItemPositions) DECLARE_FIELDMETAINFO(ImageHistoryInfo) DECLARE_FIELDMETAINFO(VideoMetadata) /** * You can iterate over each of the Enumerations defined above: * ImagesIterator, ImageMetadataIterator etc. * for (ImagesIterator it ; !it.atEnd() ; ++it) {...} */ template class DatabaseFieldsEnumIterator { public: DatabaseFieldsEnumIterator() : i(FieldMetaInfo::First) { } bool atEnd() const { return i > FieldMetaInfo::Last; } void operator++() { i = (i << 1); } FieldName operator*() const { return FieldName(i); } private: int i; }; /** * An iterator that iterates only over the flags which are set */ template class DatabaseFieldsEnumIteratorSetOnly { public: explicit DatabaseFieldsEnumIteratorSetOnly(const FieldName setValues) : i(), values(setValues) { if (! (*i & values) ) { operator++(); } } bool atEnd() const { return i.atEnd(); } void operator++() { while (!i.atEnd()) { ++i; if (*i & values) { break; } } } FieldName operator*() const { return *i; } private: DatabaseFieldsEnumIterator i; const FieldName values; }; #define DATABASEFIELDS_ENUM_ITERATOR(Flag) \ typedef DatabaseFieldsEnumIterator Flag##Iterator; \ typedef DatabaseFieldsEnumIteratorSetOnly Flag##IteratorSetOnly; DATABASEFIELDS_ENUM_ITERATOR(Images) DATABASEFIELDS_ENUM_ITERATOR(ItemInformation) DATABASEFIELDS_ENUM_ITERATOR(ImageMetadata) DATABASEFIELDS_ENUM_ITERATOR(VideoMetadata) DATABASEFIELDS_ENUM_ITERATOR(ItemPositions) DATABASEFIELDS_ENUM_ITERATOR(ItemComments) DATABASEFIELDS_ENUM_ITERATOR(ImageHistoryInfo) /** * For your custom enum, you need to use the CustomEnum class. * You need to do an explicit cast. */ enum CustomEnumFlags { }; Q_DECLARE_FLAGS(CustomEnum, CustomEnumFlags) #define DATABASEFIELDS_SET_DECLARE_METHODS(Flag, variable) \ explicit Set(const Flag& f) { initialize(); variable = f; } \ explicit Set(const Flag##Field& f) { initialize(); variable = f; } \ inline Flag& operator=(const Flag& f) { return variable.operator=(f); } \ inline Flag& operator|=(Flag f) { return variable.operator|=(f); } \ inline Flag& operator^=(Flag f) { return variable.operator^=(f); } \ inline Flag operator|(Flag f) const { return variable.operator|(f); } \ inline Flag operator^(Flag f) const { return variable.operator^(f); } \ inline Flag operator&(Flag f) const { return variable.operator&(f); } \ inline operator Flag() const { return variable; } \ inline bool hasFieldsFrom##Flag() const { return variable & Flag##All; } \ inline Flag get##Flag() const { return variable; } /** * This class provides a set of all DatabaseFields enums, * without resorting to a QSet. */ class Set { public: Set() { initialize(); } void initialize() { images = ImagesNone; imageInformation = ItemInformationNone; imageMetadata = ImageMetadataNone; imageComments = ItemCommentsNone; imagePositions = ItemPositionsNone; imageHistory = ImageHistoryInfoNone; videoMetadata = VideoMetadataNone; - customEnum = (CustomEnum)nullptr; + customEnum = CustomEnum(); } public: DATABASEFIELDS_SET_DECLARE_METHODS(Images, images) DATABASEFIELDS_SET_DECLARE_METHODS(ItemInformation, imageInformation) DATABASEFIELDS_SET_DECLARE_METHODS(VideoMetadata, videoMetadata) DATABASEFIELDS_SET_DECLARE_METHODS(ImageMetadata, imageMetadata) DATABASEFIELDS_SET_DECLARE_METHODS(ItemComments, imageComments) DATABASEFIELDS_SET_DECLARE_METHODS(ItemPositions, imagePositions) DATABASEFIELDS_SET_DECLARE_METHODS(ImageHistoryInfo, imageHistory) inline bool operator&(const Set& other) { return (images & other.images) || (imageInformation & other.imageInformation) || (imageMetadata & other.imageMetadata) || (imageComments & other.imageComments) || (imagePositions & other.imagePositions) || (imageHistory & other.imageHistory) || (customEnum & other.customEnum) || (videoMetadata & other.videoMetadata); } // overloading operator|= creates ambiguity with the database fields' // operator|=, therefore we give it another name. inline Set& setFields(const Set& otherSet) { images |= otherSet.images; imageInformation |= otherSet.imageInformation; imageMetadata |= otherSet.imageMetadata; imageComments |= otherSet.imageComments; imagePositions |= otherSet.imagePositions; imageHistory |= otherSet.imageHistory; customEnum |= otherSet.customEnum; videoMetadata |= otherSet.videoMetadata; return *this; } inline CustomEnum& operator=(const CustomEnum& f) { return customEnum.operator=(f); } inline CustomEnum& operator|=(CustomEnum f) { return customEnum.operator|=(f); } inline CustomEnum& operator^=(CustomEnum f) { return customEnum.operator^=(f); } inline CustomEnum operator|(CustomEnum f) const { return customEnum.operator|(f); } inline CustomEnum operator^(CustomEnum f) const { return customEnum.operator^(f); } inline CustomEnum operator&(CustomEnum f) const { return customEnum.operator&(f); } #ifdef HAVE_DBUS // databasechangesets.cpp Set& operator<<(const QDBusArgument& argument); const Set& operator>>(QDBusArgument& argument) const; #endif private: Images images; ItemInformation imageInformation; ImageMetadata imageMetadata; VideoMetadata videoMetadata; ItemComments imageComments; ItemPositions imagePositions; ImageHistoryInfo imageHistory; CustomEnum customEnum; }; #define DATABASEFIELDS_HASH_DECLARE_METHODS(Key, method) \ void insertField(const Key& key, const T& value) { QHash::insert(method(key), value); } \ int remove(const Key& key) { return QHash::remove(method(key)); } \ int removeAllFields(const Key& key) \ { \ int removedCount = 0; \ for (DatabaseFieldsEnumIteratorSetOnly it(key) ; !it.atEnd() ; ++it) \ { \ removedCount+=remove(*it); \ } \ return removedCount; \ } \ T take(const Key& key) { return QHash::take(method(key)); } \ \ bool contains(const Key& key) const { return QHash::contains(method(key)); } \ const T value(const Key& key) const { return QHash::value(method(key)); } \ const T value(const Key& key, const T& defaultValue) const { return QHash::value(method(key), defaultValue); } \ \ T& operator[](const Key& key) { return QHash::operator[](method(key)); } \ const T operator[](const Key& key) const { return QHash::operator[](method(key)); } \ \ QList values(const Key& key) const { return QHash::value(method(key)); } \ int count(const Key& key) const { return QHash::count(method(key)); } /** * This class provides a hash on all DatabaseFields enums, * allowing to use the enum values as independent keys. * You can use the class like a normal QHash with the value type defined * by you, and as keys the members of the DatabaseFields enums. * You can only use single enum members as keys, not or'ed numbers. * You can use one custom enum, cast to DatabaseFields::CustomEnum, * which can have at most 26 flag values (1 << 0 to 1 << 26). * Pass this as the optional second template parameter. */ template class Hash : public QHash { public: // We use the upper 6 bits to distinguish the enums, and give the lower 26 bits to the flags. // So we can store up to 64 enums, with 26 flags each. static inline unsigned int uniqueKey(Images f) { return (int)f | (0 << 26); } static inline unsigned int uniqueKey(ItemInformation f) { return (int)f | (1 << 26); } static inline unsigned int uniqueKey(ImageMetadata f) { return (int)f | (2 << 26); } static inline unsigned int uniqueKey(ItemComments f) { return (int)f | (3 << 26); } static inline unsigned int uniqueKey(ItemPositions f) { return (int)f | (4 << 26); } static inline unsigned int uniqueKey(ImageHistoryInfo f) { return (int)f | (5 << 26); } static inline unsigned int uniqueKey(VideoMetadata f) { return (int)f | (6 << 26); } static inline unsigned int uniqueKey(CustomEnum f) { return f | (63 << 26); } // override relevant methods from QHash DATABASEFIELDS_HASH_DECLARE_METHODS(Images, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(ItemInformation, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(ImageMetadata, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(VideoMetadata, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(ItemComments, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(ItemPositions, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(ImageHistoryInfo, uniqueKey); DATABASEFIELDS_HASH_DECLARE_METHODS(CustomEnum, uniqueKey); }; } // namespace DatabaseFields } // namespace Digikam // NOTE: must be outside the namespace! Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::Images) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemInformation) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ImageMetadata) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::VideoMetadata) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemComments) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemPositions) Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ImageHistoryInfo) #endif // DIGIKAM_CORE_DB_FIELDS_H diff --git a/core/libs/widgets/layout/thumbbardock.h b/core/libs/widgets/layout/thumbbardock.h index 023ca1eab4..9b50f76ef3 100644 --- a/core/libs/widgets/layout/thumbbardock.h +++ b/core/libs/widgets/layout/thumbbardock.h @@ -1,143 +1,143 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2009-15-08 * Description : A floatable/dockable widget for thumbnail bars (ThumbBarView * and its descendants), providing i drag handle similar to the * one on toolbars and a standard Action to show/hide the * thumbnail bar. It inherits QDockWidget and can be used in * the dock area's of a QMainWindow. * * Copyright (C) 2009 by Pieter Edelman

* * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_THUMB_BAR_DOCK_H #define DIGIKAM_THUMB_BAR_DOCK_H // Qt includes #include #include #include #include #include #include #include // Local includes #include "digikam_export.h" namespace Digikam { /** * An alternative handle for QDockWidget's that looks like a toolbar handle. */ class DragHandle : public QWidget { Q_OBJECT public: explicit DragHandle(QDockWidget* const); ~DragHandle(); QSize sizeHint() const override; QSize minimumSizeHint() const override; protected: void paintEvent(QPaintEvent*) override; private Q_SLOTS: void dockLocationChanged(Qt::DockWidgetArea); private: class Private; Private* const d; }; // -------------------------------------------------------------------------------- /** * A dock widget specifically designed for thumbnail bars (class ThumbNailView * or one of its descendants). It provides the same look as a toolbar. */ class DIGIKAM_EXPORT ThumbBarDock : public QDockWidget { Q_OBJECT public: enum Visibility { WAS_HIDDEN, WAS_SHOWN, SHOULD_BE_HIDDEN, SHOULD_BE_SHOWN }; public: - explicit ThumbBarDock(QWidget* const parent = nullptr, Qt::WindowFlags flags = nullptr); + explicit ThumbBarDock(QWidget* const parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~ThumbBarDock(); /** * Measure the orientation and size of the widget and adjust the containing * thumbnail bar accordingly. Normally not needed, but useful when the * dock widget has changed location and/or size and the appropriate signals * aren't emitted. */ void reInitialize(); /** * Return an Action to show and hide the thumbnail bar. */ QAction* getToggleAction(QObject* const parent, const QString& caption = QString()) const; /** * The normal show() and hide() functions don't apply that well, because * there are two orthogonal reasons to hide the thumbbar: the user doesn't * want it, and the window with the thumbbar isn't shown. * The restoreVisibility() function will set the visibility status to what * it should be according to the user setting. The setShouldBeVisible() * function can change this setting. showThumbBar() can be used to hide and * show the thumbbar according to the user preference. shouldBeVisible() * tells whether the thumbbar should be shown according to the user. */ bool shouldBeVisible() const; void setShouldBeVisible(bool); void restoreVisibility(); static QPixmap generateFuzzyRect(const QSize& size, const QColor& color, int radius, const QColor& fillColor = Qt::transparent); static QPixmap generateFuzzyRectForGroup(const QSize& size, const QColor& color, int radius); public Q_SLOTS: void showThumbBar(bool); private: Visibility m_visible; }; } // namespace Digikam #endif // DIGIKAM_THUMB_BAR_DOCK_H diff --git a/core/libs/widgets/mainview/dxmlguiwindow.h b/core/libs/widgets/mainview/dxmlguiwindow.h index 2ace235718..a3855cbe51 100644 --- a/core/libs/widgets/mainview/dxmlguiwindow.h +++ b/core/libs/widgets/mainview/dxmlguiwindow.h @@ -1,278 +1,278 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2013-04-29 * Description : digiKam XML GUI window * * Copyright (C) 2013-2020 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_DXML_GUI_WINDOW_H #define DIGIKAM_DXML_GUI_WINDOW_H // Qt includes #include #include #include #include // KDE includes #include // Local includes #include "digikam_export.h" #include "digikam_config.h" #include "dlogoaction.h" #include "dinfointerface.h" #include "dpluginaction.h" #include "dpluginloader.h" class QEvent; class KToolBar; class KConfigGroup; namespace Digikam { /** * Optional parts which can be hidden or not from managed window configuration panel */ enum FullScreenOptions { FS_TOOLBARS = 0x00000001, ///< Manage Tools bar in full-screen mode. FS_THUMBBAR = 0x00000002, ///< Manage Thumb bar in full-screen mode. FS_SIDEBARS = 0x00000004, ///< Manage Side bars in full-screen mode. FS_STATUSBAR = 0x00000008, ///< Manage Status bar in full-screen mode. FS_NONE = 0x00000010, ///< No full-screen options. FS_ALBUMGUI = FS_TOOLBARS | FS_THUMBBAR | FS_SIDEBARS | FS_STATUSBAR, ///< Album GUI Config. FS_EDITOR = FS_TOOLBARS | FS_THUMBBAR | FS_SIDEBARS | FS_STATUSBAR, ///< Image Editor Config. FS_LIGHTTABLE = FS_TOOLBARS | FS_SIDEBARS | FS_STATUSBAR, ///< Light Table Config. FS_IMPORTUI = FS_TOOLBARS | FS_THUMBBAR | FS_SIDEBARS | FS_STATUSBAR ///< Import UI Config. }; enum StdActionType { StdCopyAction = 0, StdPasteAction, StdCutAction, StdQuitAction, StdCloseAction, StdZoomInAction, StdZoomOutAction, StdOpenAction, StdSaveAction, StdSaveAsAction, StdRevertAction, StdBackAction, StdForwardAction }; static const QString s_configFullScreenHideToolBarsEntry(QLatin1String("FullScreen Hide ToolBars")); static const QString s_configFullScreenHideThumbBarEntry(QLatin1String("FullScreen Hide ThumbBar")); static const QString s_configFullScreenHideSideBarsEntry(QLatin1String("FullScreen Hide SideBars")); static const QString s_configFullScreenHideStatusBarEntry(QLatin1String("FullScreen Hide StatusBar")); /** * Data container to use in managed window. */ class DIGIKAM_EXPORT DXmlGuiWindow : public KXmlGuiWindow { Q_OBJECT public: - explicit DXmlGuiWindow(QWidget* const parent=nullptr, Qt::WindowFlags f=KDE_DEFAULT_WINDOWFLAGS); + explicit DXmlGuiWindow(QWidget* const parent=nullptr, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS); ~DXmlGuiWindow(); /** * Manage config group name used by window instance to get/set settings from config file */ void setConfigGroupName(const QString& name); QString configGroupName() const; /** * Create common actions to setup all digiKam main windows. */ void createSettingsActions(); /** * Create common actions from Help menu for all digiKam main windows. */ void createHelpActions(bool coreOptions=true); /** * Cleanup unwanted actions from action collection. */ void cleanupActions(); /** * Create common actions to handle side-bar through keyboard shortcuts. */ void createSidebarActions(); /** * Set full-screen options to managed window */ void setFullScreenOptions(int options); /** * Create Full-screen action to action collection instance from managed window * set through setManagedWindow(). This action is connected to slotToggleFullScreen() slot. * 'name' is action name used in KDE UI rc file. */ void createFullScreenAction(const QString& name); /** * Read full-screen settings from KDE config file. */ void readFullScreenSettings(const KConfigGroup& group); /** * Return true if managed window is currently in Full Screen Mode. */ bool fullScreenIsActive() const; public: /** * Register all generic plugins action to this instance. * Call registerExtraPluginsActions() to plug oter kind of plugins in GUI. */ void registerPluginsActions(); virtual void registerExtraPluginsActions(QString& /*dom*/) {}; /** * Return the interface instance to access to items information. */ virtual DInfoInterface* infoIface(DPluginAction* const ac) = 0; public: static void openHandbook(); static void restoreWindowSize(QWindow* const win, const KConfigGroup& group); static void saveWindowSize(QWindow* const win, KConfigGroup& group); static QAction* buildStdAction(StdActionType type, const QObject* const recvr, const char* const slot, QObject* const parent); /** * If we have some local breeze icon resource, prefer it. */ static void setupIconTheme(); protected: DLogoAction* m_animLogo; protected: QAction* showMenuBarAction() const; QAction* showStatusBarAction() const; /** * Call this method from your main window to show keyboard shortcut config dialog * with an extra action collection to configure. This method is called by slotEditKeys() * which can be re-implement in child class for cutomization. */ void editKeyboardShortcuts(KActionCollection* const extraac=nullptr, const QString& actitle=QString()); void closeEvent(QCloseEvent* e) override; void keyPressEvent(QKeyEvent* e) override; bool eventFilter(QObject* obj, QEvent* ev) override; /** * Re-implement this method if you want to manage sidebars visibility in full-screen mode. * By default this method do nothing. */ virtual void showSideBars(bool visible); /** * Re-implement this method if you want to manage thumbbar visibility in full-screen mode. * By default this method do nothing. */ virtual void showThumbBar(bool visible); /** * Re-implement this method if you want to manage customized view visibility in full-screen mode. * This method is called by switchWindowToFullScreen(). By default this method do nothing. */ virtual void customizedFullScreenMode(bool set); /** * Re-implement this method if managed window has a thumbbar. This must return visibility state of it. */ virtual bool thumbbarVisibility() const; private Q_SLOTS: void slotToggleFullScreen(bool); void slotShowMenuBar(); void slotShowStatusBar(); void slotConfNotifications(); void slotConfToolbars(); void slotNewToolbarConfig(); void slotRawCameraList(); void slotDonateMoney(); void slotRecipesBook(); void slotContribute(); void slotHelpContents(); /// Slots for common Help Actions virtual void slotComponentsInfo() {}; virtual void slotDBStat() {}; /// Slots for common Sidebar Actions virtual void slotToggleLeftSideBar() {}; virtual void slotToggleRightSideBar() {}; virtual void slotPreviousLeftSideBarTab() {}; virtual void slotNextLeftSideBarTab() {}; virtual void slotPreviousRightSideBarTab() {}; virtual void slotNextRightSideBarTab() {}; /// Slots for common Settings actions virtual void slotEditKeys() { editKeyboardShortcuts(); }; virtual void slotSetup() = 0; private: /** * Used by slotToggleFullScreen() to switch tool-bar visibility in managed window */ void showToolBars(bool visible); /** * Return main tool bar instance created in managed window. */ KToolBar* mainToolBar() const; private: class Private; Private* const d; }; } // namespace Digikam #endif // DIGIKAM_DXML_GUI_WINDOW_H diff --git a/core/utilities/geolocation/geoiface/correlator/gpsdatacontainer.h b/core/utilities/geolocation/geoiface/correlator/gpsdatacontainer.h index 0643b1aed9..44ba8cc8d2 100644 --- a/core/utilities/geolocation/geoiface/correlator/gpsdatacontainer.h +++ b/core/utilities/geolocation/geoiface/correlator/gpsdatacontainer.h @@ -1,307 +1,306 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2010-04-19 * Description : A class to hold the GPS related data * * Copyright (C) 2010-2020 by Gilles Caulier * Copyright (C) 2010-2014 by Michael G. Hansen * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_GPS_DATA_CONTAINER_H #define DIGIKAM_GPS_DATA_CONTAINER_H // Local includes #include "geocoordinates.h" namespace Digikam { class GPSDataContainer { public: enum HasFlagsEnum { - HasNothing = 0, HasCoordinates = 1, HasAltitude = 2, HasIsInterpolated = 4, HasNSatellites = 8, HasDop = 16, HasFixType = 32, HasSpeed = 64 }; Q_DECLARE_FLAGS(HasFlags, HasFlagsEnum) public: GPSDataContainer() - : m_hasFlags(HasNothing), + : m_hasFlags(HasFlags()), m_coordinates(), m_nSatellites(-1), m_dop(-1), m_fixType(-1), m_speed(0) { } private: HasFlags m_hasFlags; GeoCoordinates m_coordinates; int m_nSatellites; qreal m_dop; int m_fixType; qreal m_speed; public: // general bool operator==(const GPSDataContainer& b) const { if (m_hasFlags != b.m_hasFlags) { return false; } if (m_hasFlags.testFlag(HasCoordinates)) { if (!(m_coordinates == b.m_coordinates)) { return false; } } if (hasNSatellites()) { if (m_nSatellites != b.m_nSatellites) { return false; } } if (hasDop()) { if (m_dop != b.m_dop) { return false; } } if (hasFixType()) { if (m_fixType != b.m_fixType) { return false; } } if (hasSpeed()) { if (m_speed != b.m_speed) { return false; } } return true; } inline HasFlags flags() const { return m_hasFlags; } inline void clear() { - m_hasFlags = HasNothing; + m_hasFlags = HasFlags(); m_coordinates.clear(); } inline void clearNonCoordinates() { m_hasFlags&= ~(HasNSatellites | HasDop | HasFixType | HasSpeed); } // coordinates inline GeoCoordinates getCoordinates() const { return m_coordinates; } inline void setCoordinates(const GeoCoordinates& coordinates) { m_coordinates = coordinates; if (coordinates.hasCoordinates()) { m_hasFlags |= HasCoordinates; } else { m_hasFlags &= ~HasCoordinates; } if (coordinates.hasAltitude()) { m_hasFlags |= HasAltitude; } else { m_hasFlags &= ~HasAltitude; } clearNonCoordinates(); } inline void setAltitude(const qreal alt) { m_coordinates.setAlt(alt); m_hasFlags |= HasAltitude; } inline bool hasAltitude() const { return m_hasFlags.testFlag(HasAltitude); } inline void setLatLon(const qreal lat, const qreal lon) { m_coordinates.setLatLon(lat, lon); m_hasFlags |= HasCoordinates; clearNonCoordinates(); } inline void clearAltitude() { m_hasFlags &= ~HasAltitude; m_coordinates.clearAlt(); } inline bool hasCoordinates() const { return m_hasFlags.testFlag(HasCoordinates); } // NSatellites inline int getNSatellites() const { return m_nSatellites; } inline bool hasNSatellites() const { return m_hasFlags.testFlag(HasNSatellites); } inline void clearNSatellites() { m_hasFlags &= ~HasNSatellites; } inline void setNSatellites(const int nSatellites) { m_nSatellites = nSatellites; m_hasFlags |= HasNSatellites; } // DOP inline bool hasDop() const { return m_hasFlags.testFlag(HasDop); } inline void clearDop() { m_hasFlags &= ~HasDop; } inline void setDop(const qreal dop) { m_dop = dop; m_hasFlags |= HasDop; } inline qreal getDop() const { return m_dop; } // fix type inline bool hasFixType() const { return m_hasFlags.testFlag(HasFixType); } inline void setFixType(const int fixType) { m_fixType = fixType; m_hasFlags |= HasFixType; } inline qreal getFixType() const { return m_fixType; } inline void clearFixType() { m_hasFlags &= ~HasFixType; } // speed /** * @brief Return the speed in m/s */ inline qreal getSpeed() const { return m_speed; } inline bool hasSpeed() const { return m_hasFlags.testFlag(HasSpeed); } /** * @brief Set the speed in m/s */ inline void setSpeed(const qreal speed) { m_hasFlags |= HasSpeed; m_speed = speed; } inline void clearSpeed() { m_hasFlags &= ~HasSpeed; } }; } // namespace Digikam Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::GPSDataContainer::HasFlags) #endif // DIGIKAM_GPS_DATA_CONTAINER_H