File indexing completed on 2024-12-08 11:10:08

0001 /**
0002  * SPDX-FileCopyrightText: (C) 2003 Sébastien Laoût <slaout@linux62.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef GLOBAL_H
0008 #define GLOBAL_H
0009 
0010 #include "basket_export.h"
0011 #include <KSharedConfig>
0012 
0013 class QString;
0014 
0015 class KMainWindow;
0016 
0017 class DebugWindow;
0018 class BackgroundManager;
0019 class SystemTray;
0020 class BNPView;
0021 class QCommandLineParser;
0022 
0023 class MainWindow;
0024 
0025 /** Handle all global variables of the application.
0026  * This file only declare classes : developer should include
0027  * the .h files of variables he use.
0028  * @author Sébastien Laoût
0029  */
0030 class BASKET_EXPORT Global
0031 {
0032 private:
0033     static QString s_customSavesFolder;
0034 
0035     static void initializeGitRepository(QString folder);
0036 
0037 public:
0038     // Global Variables:
0039     static DebugWindow *debugWindow;
0040     static BackgroundManager *backgroundManager;
0041     static BNPView *bnpView;
0042     static KSharedConfig::Ptr basketConfig;
0043     static QCommandLineParser *commandLineOpts;
0044     static MainWindow *mainWnd;
0045 
0046     // Application Folders:
0047     static void setCustomSavesFolder(const QString &folder);
0048     static QString savesFolder();       /// << @return e.g. "/home/username/.local/share/basket/".
0049     static QString basketsFolder();     /// << @return e.g. "/home/username/.local/share/basket/baskets/".
0050     static QString backgroundsFolder(); /// << @return e.g. "/home/username/.local/share/basket/backgrounds/".
0051     static QString templatesFolder();   /// << @return e.g. "/home/username/.local/share/basket/templates/".
0052     static QString tempCutFolder();     /// << @return e.g. "/home/username/.local/share/basket/temp-cut/".   (was ".tmp/")
0053     static QString gitFolder();         /// << @return e.g. "/home/username/.local/share/basket/.git/".
0054 
0055     // Various Things:
0056     /** Initialize git repository if Version sync is enabled
0057         @param savesFolder Path returned by savesFolder()  */
0058     static void initializeGitIfNeeded(QString savesFolder);
0059     static QString openNoteIcon();          /// << @return the icon used for the "Open" action on notes.
0060     static KMainWindow *activeMainWindow(); /// << @returns Main window if it has focus (is active), otherwise NULL
0061     static MainWindow *mainWindow();        /// << @returns Main window (always not NULL after it has been actually created)
0062     static KConfig *config();
0063 };
0064 
0065 #endif // GLOBAL_H