OSDN Git Service

Version 0.5
[fontmanager/fontmanager.git] / applicationcontroller.h
index d073c0b..f81ff5a 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Takumi Asaki
+** Copyright (C) 2012 Takumi Asaki
 ** All rights reserved.
 ** Contact: Takumi Asaki (takumi.asaki@gmail.com)
 **
@@ -53,20 +53,22 @@ class FontsConfEditorController;
 class ApplicationController : public QObject
 {
     Q_OBJECT
-    Q_PROPERTY(QString version READ version)
+    Q_PROPERTY(QString version READ version NOTIFY dummySignal)
     Q_PROPERTY(QString fontDir READ fontDir WRITE setFontDir NOTIFY fontDirChanged)
     Q_PROPERTY(bool fontDirExists READ fontDirExists NOTIFY fontDirExistsChanged)
 
     Q_PROPERTY(QString localFontsConfPath READ localFontsConfPath NOTIFY localFontsConfPathChanged)
     Q_PROPERTY(bool localFontsConfExists READ localFontsConfExists NOTIFY localFontsConfExistsChanged)
-    Q_PROPERTY(bool isEmptyFontsConf READ isEmptyFontsConf NOTIFY localFontsConfChanged)
-    Q_PROPERTY(QString localFontsConf READ localFontsConf NOTIFY localFontsConfChanged)
+    Q_PROPERTY(bool isEmptyFontsConf READ isEmptyFontsConf NOTIFY localFontsConfFileUpdated)
+    Q_PROPERTY(QString localFontsConf READ localFontsConf NOTIFY localFontsConfFileUpdated)
 
     Q_PROPERTY(bool showSystemFont READ showSystemFont WRITE setShowSystemFont NOTIFY showSystemFontChanged)
 
     Q_PROPERTY(bool working READ working NOTIFY workingChanged)
 
     Q_PROPERTY(QUrl backupDir READ backupDir NOTIFY backupDirChanged)
+
+    Q_PROPERTY(QStringList installedFonts READ installedFonts NOTIFY installedFontsChanged)
 public:
     explicit ApplicationController(QObject *parent = 0);
     
@@ -100,6 +102,11 @@ public:
     QUrl backupDir() const;
     Q_INVOKABLE QString defaultBackupFilename() const;
 
+    Q_INVOKABLE QString url2path(const QUrl &url) const;
+    Q_INVOKABLE QString path4display(const QString &path) const;
+
+    QStringList installedFonts() const;
+
 public slots:
     void updateAllEditorController();
 
@@ -123,6 +130,7 @@ public slots:
 
     void backupConfig(const QString &filename);
     void restoreConfig(const QString &filename);
+    void restoreConfig(const QUrl &filename);
 
 signals:
     void alertDialog(const QString &message);
@@ -131,9 +139,12 @@ signals:
     void fontDirExistsChanged();
 
     void showSystemFontChanged();
+    void installedFontsChanged();
 
     void installFinished(const QString &fontpath);
     void uninstallFinished(const QString &fontpath);
+    void backupConfigFinished(const QString &filepath);
+    void restoreConfigFinished(const QString &filepath);
 
     void clearInstalledFontList();
     void appendInstalledFont(const QString &family, const QString &fullname);
@@ -144,11 +155,14 @@ signals:
     void localFontsConfPathChanged();
     void localFontsConfExistsChanged();
     void localFontsConfChanged();
+    void localFontsConfFileUpdated();
 
     void workingChanged();
 
     void backupDirChanged();
 
+    void dummySignal();
+
 private slots:
     void readFcListFinished();
 
@@ -175,9 +189,9 @@ private:
     QString mFontDirPath;
     bool mFontDirExists;
     bool mShowSystemFont;
+    QStringList mInstalledFonts;
 
     int mUpdating;
-    bool mForceOverwrite;
     bool mWorking;
     bool mIgnoreUpdate;