File indexing completed on 2024-05-05 17:04:27

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef SETTINGS_H
0021 #define SETTINGS_H
0022 
0023 #include <QObject>
0024 #include <QString>
0025 #include <QQuickItem>
0026 
0027 class Settings : public QObject
0028 {
0029     Q_OBJECT
0030     Q_PROPERTY(QString currentFile READ currentFile WRITE setCurrentFile NOTIFY currentFileChanged)
0031     Q_PROPERTY(QString currentFileClass READ currentFileClass NOTIFY currentFileChanged)
0032     Q_PROPERTY(bool temporaryFile READ isTemporaryFile WRITE setTemporaryFile NOTIFY temporaryFileChanged)
0033     Q_PROPERTY(QQuickItem* focusItem READ focusItem WRITE setFocusItem NOTIFY focusItemChanged)
0034     Q_PROPERTY(QObject* theme READ theme NOTIFY themeChanged)
0035     Q_PROPERTY(QString themeID READ themeID WRITE setThemeID NOTIFY themeChanged)
0036 
0037 public:
0038     explicit Settings( QObject* parent = 0);
0039     ~Settings() override;
0040 
0041 public Q_SLOTS:
0042 
0043     QString currentFile() const;
0044     QString currentFileClass() const;
0045     void setCurrentFile(const QString &fileName);
0046 
0047     bool isTemporaryFile() const;
0048     void setTemporaryFile(bool temp);
0049 
0050     QQuickItem *focusItem();
0051     void setFocusItem(QQuickItem *item);
0052 
0053     QObject* theme() const;
0054 
0055     QString themeID() const;
0056     void setThemeID(const QString& id);
0057 
0058     int mimeTypeToDocumentClass(QString mimeType) const;
0059 
0060 Q_SIGNALS:
0061     void canvasChanged();
0062     void currentFileChanged();
0063     void temporaryFileChanged();
0064     void focusItemChanged();
0065     void themeChanged();
0066     void loadingFinished();
0067 
0068 private:
0069     class Private;
0070     Private* const d;
0071 };
0072 
0073 #endif // SETTINGS_H