Warning, file /multimedia/kid3/src/app/qt/kid3mainwindow.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /**
0002  * \file kid3mainwindow.h
0003  * Kid3 main window.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 9 Jan 2003
0008  *
0009  * Copyright (C) 2003-2024  Urs Fleisch
0010  *
0011  * This file is part of Kid3.
0012  *
0013  * Kid3 is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License as published by
0015  * the Free Software Foundation; either version 2 of the License, or
0016  * (at your option) any later version.
0017  *
0018  * Kid3 is distributed in the hope that it will be useful,
0019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0021  * GNU General Public License for more details.
0022  *
0023  * You should have received a copy of the GNU General Public License
0024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0025  */
0026 
0027 #pragma once
0028 
0029 #include <QMainWindow>
0030 #include "basemainwindow.h"
0031 
0032 class QAction;
0033 class QSessionManager;
0034 class RecentFilesMenu;
0035 class ShortcutsModel;
0036 class Kid3ApplicationTagContext;
0037 
0038 /**
0039  * Kid3 main window.
0040  */
0041 class Kid3MainWindow : public QMainWindow, public BaseMainWindow {
0042   Q_OBJECT
0043 public:
0044   /**
0045    * Constructor.
0046    *
0047    * @param platformTools platform specific tools
0048    * @param app application context
0049    * @param parent parent widget
0050    */
0051   explicit Kid3MainWindow(IPlatformTools* platformTools, Kid3Application* app,
0052                           QWidget* parent = nullptr);
0053 
0054   /**
0055    * Destructor.
0056    */
0057   ~Kid3MainWindow() override = default;
0058 
0059   /**
0060    * Init menu and toolbar actions.
0061    */
0062   void initActions() override;
0063 
0064   /**
0065    * Get keyboard shortcuts.
0066    * @return mapping of action names to key sequences.
0067    */
0068   QMap<QString, QKeySequence> shortcutsMap() const override;
0069 
0070   /**
0071    * Add directory to recent files list.
0072    *
0073    * @param dirName path to directory
0074    */
0075   void addDirectoryToRecentFiles(const QString& dirName) override;
0076 
0077   /**
0078    * Read settings from the configuration.
0079    */
0080   void readConfig() override;
0081 
0082   /**
0083    * Store geometry and recent files in settings.
0084    */
0085   void saveConfig() override;
0086 
0087   /**
0088    * Get action for Settings/Auto Hide Tags.
0089    * @return action.
0090    */
0091   QAction* autoHideTagsAction() override;
0092 
0093   /**
0094    * Get action for Settings/Hide Picture.
0095    * @return action.
0096    */
0097   QAction* showHidePictureAction() override;
0098 
0099   /**
0100    * Set main window caption.
0101    *
0102    * @param caption caption without application name
0103    * @param modified true if any file is modified
0104    */
0105   void setWindowCaption(const QString& caption, bool modified) override;
0106 
0107 protected:
0108   /**
0109    * Window is closed.
0110    *
0111    * @param ce close event
0112    */
0113   void closeEvent(QCloseEvent* ce) override;
0114 
0115 private slots:
0116   /**
0117    * Open recent directory.
0118    *
0119    * @param dir directory to open
0120    */
0121   void slotFileOpenRecentDirectory(const QString& dir);
0122 
0123   /**
0124    * Turn status bar on or off.
0125    */
0126   void slotViewStatusBar();
0127 
0128   /**
0129    * Preferences.
0130    */
0131   void slotSettingsConfigure();
0132 
0133   /**
0134    * Display handbook.
0135    */
0136   void slotHelpHandbook();
0137 
0138   /**
0139    * Display "About" dialog.
0140    */
0141   void slotHelpAbout();
0142 
0143   /**
0144    * Display "About Qt" dialog.
0145    */
0146   void slotHelpAboutQt();
0147 
0148   /**
0149    * Called when session manager wants application to commit its data.
0150    * @param manager session manager
0151    */
0152   void onCommitDataRequest(QSessionManager& manager);
0153 
0154   /**
0155    * Add user action to shortcuts.
0156    * @param name name of action
0157    * @param action action to add
0158    */
0159   void onUserActionAdded(const QString& name, QAction* action);
0160 
0161   /**
0162    * Remove user action from shortcuts.
0163    * @param name name of action
0164    * @param action action to remove
0165    */
0166   void onUserActionRemoved(const QString& name, QAction* action);
0167 
0168 private:
0169   /**
0170    * Read font and style options.
0171    */
0172   void readFontAndStyleOptions();
0173 
0174   /**
0175    * Init actions of form.
0176    */
0177   void initFormActions();
0178 
0179   /**
0180    * Add action of form.
0181    */
0182   QAction* addFormAction(const QString& text, const QString& name,
0183                          const QString& context);
0184 
0185   IPlatformTools* m_platformTools;
0186   RecentFilesMenu* m_fileOpenRecent;
0187   ShortcutsModel* m_shortcutsModel;
0188   QAction* m_viewToolBar;
0189   QAction* m_viewStatusBar;
0190   QAction* m_settingsAutoHideTags;
0191   QAction* m_settingsShowHidePicture;
0192 };