выбор папки для базы блоков из GUI
[novacoin.git] / src / qt / intro.h
diff --git a/src/qt/intro.h b/src/qt/intro.h
new file mode 100644 (file)
index 0000000..c973561
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (c) 2011-2013 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_QT_INTRO_H
+#define BITCOIN_QT_INTRO_H
+
+#include <QDialog>
+#include <QMutex>
+#include <QThread>
+
+class FreespaceChecker;
+
+namespace Ui {
+    class Intro;
+}
+
+/** Introduction screen (pre-GUI startup).
+  Allows the user to choose a data directory,
+  in which the wallet and block chain will be stored.
+ */
+class Intro : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit Intro(QWidget *parent = 0);
+    ~Intro();
+
+    QString getDataDirectory();
+    void setDataDirectory(const QString &dataDir);
+
+    /**
+     * Determine data directory. Let the user choose if the current one doesn't exist.
+     *
+     * @note do NOT call global GetDataDir() before calling this function, this
+     * will cause the wrong path to be cached.
+     */
+    static void pickDataDirectory();
+
+    /**
+     * Determine default data directory for operating system.
+     */
+    static QString getDefaultDataDirectory();
+
+signals:
+    void requestCheck();
+    void stopThread();
+
+public slots:
+    void setStatus(int status, const QString &message, quint64 bytesAvailable);
+
+private slots:
+    void on_dataDirectory_textChanged(const QString &arg1);
+    void on_ellipsisButton_clicked();
+    void on_dataDirDefault_clicked();
+    void on_dataDirCustom_clicked();
+
+private:
+    Ui::Intro *ui;
+    QThread *thread;
+    QMutex mutex;
+    bool signalled;
+    QString pathToCheck;
+
+    void startThread();
+    void checkPath(const QString &dataDir);
+    QString getPathToCheck();
+
+    friend class FreespaceChecker;
+};
+
+#endif // BITCOIN_QT_INTRO_H