]> cloud.milkyroute.net Git - dolphin.git/blob - src/global.h
Set initial size corectly
[dolphin.git] / src / global.h
1 /*
2 * SPDX-FileCopyrightText: 2015 Ashish Bansal <bansal.ashish096@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef GLOBAL_H
8 #define GLOBAL_H
9
10 #include <QList>
11 #include <QUrl>
12 #include <QWidget>
13
14 class KConfigGroup;
15 class OrgKdeDolphinMainWindowInterface;
16
17 namespace Dolphin {
18 QList<QUrl> validateUris(const QStringList& uriList);
19
20 /**
21 * Returns the home url which is defined in General Settings
22 */
23 QUrl homeUrl();
24
25 enum class OpenNewWindowFlag {
26 None = 0,
27 Select = 1<<1
28 };
29 Q_DECLARE_FLAGS(OpenNewWindowFlags, OpenNewWindowFlag)
30
31 /**
32 * Opens a new Dolphin window
33 */
34 void openNewWindow(const QList<QUrl> &urls = {}, QWidget *window = nullptr, const OpenNewWindowFlags &flags = OpenNewWindowFlag::None);
35
36 /**
37 * Attaches URLs to an existing Dolphin instance if possible.
38 * If @p preferredService is a valid dbus service, it will be tried first.
39 * @p preferredService needs to support the org.kde.dolphin.MainWindow dbus interface with the /dolphin/Dolphin_1 path.
40 * Returns true if the URLs were successfully attached.
41 */
42 bool attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService = QString());
43
44 /**
45 * Returns a QVector with all GUI-capable Dolphin instances
46 */
47 QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinGuiInstances(const QString& preferredService);
48
49 /**
50 * TODO: Move this somewhere global to all KDE apps, not just Dolphin
51 */
52 const int VERTICAL_SPACER_HEIGHT = 12;
53 const int LAYOUT_SPACING_SMALL = 2;
54 }
55
56 class GlobalConfig : public QObject
57 {
58 Q_OBJECT
59
60 public:
61 GlobalConfig() = delete;
62
63 /**
64 * @return a value from the global KDE config that should be
65 * multiplied with every animation duration once.
66 * 0.0 is returned if animations are globally turned off.
67 * 1.0 is the default value.
68 */
69 static double animationDurationFactor();
70
71 private:
72 static void updateAnimationDurationFactor(const KConfigGroup &group, const QByteArrayList &names);
73
74 private:
75 static double s_animationDurationFactor;
76 };
77
78 #endif //GLOBAL_H