|
| 1 | +// Copyright (c) 2011-2016 The Bitcoin Core developers |
| 2 | +// Distributed under the MIT software license, see the accompanying |
| 3 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 4 | + |
| 5 | +#ifndef BITCOIN_QT_INTRO_H |
| 6 | +#define BITCOIN_QT_INTRO_H |
| 7 | + |
| 8 | +#include <QDialog> |
| 9 | +#include <QMutex> |
| 10 | +#include <QThread> |
| 11 | + |
| 12 | +static const bool DEFAULT_CHOOSE_DATADIR = false; |
| 13 | + |
| 14 | +class FreespaceChecker; |
| 15 | +class logondlg; |
| 16 | +namespace Ui { |
| 17 | + class Intro; |
| 18 | +} |
| 19 | + |
| 20 | +/** Introduction screen (pre-GUI startup). |
| 21 | + Allows the user to choose a data directory, |
| 22 | + in which the wallet and block chain will be stored. |
| 23 | + */ |
| 24 | +class Intro : public QDialog |
| 25 | +{ |
| 26 | + Q_OBJECT |
| 27 | + |
| 28 | +public: |
| 29 | + explicit Intro(QWidget *parent = 0); |
| 30 | + ~Intro(); |
| 31 | + void setIsRecover(bool IsRecover); |
| 32 | + |
| 33 | + bool getIsRecover(); |
| 34 | + |
| 35 | + QString getDataDirectory(); |
| 36 | + void setDataDirectory(const QString &dataDir); |
| 37 | + |
| 38 | + /** |
| 39 | + * Determine data directory. Let the user choose if the current one doesn't exist. |
| 40 | + * |
| 41 | + * @returns true if a data directory was selected, false if the user cancelled the selection |
| 42 | + * dialog. |
| 43 | + * |
| 44 | + * @note do NOT call global GetDataDir() before calling this function, this |
| 45 | + * will cause the wrong path to be cached. |
| 46 | + */ |
| 47 | + static bool pickDataDirectory(logondlg*,std::string clienttype); |
| 48 | + |
| 49 | + /** |
| 50 | + * Determine default data directory for operating system. |
| 51 | + */ |
| 52 | + static QString getDefaultDataDirectory(); |
| 53 | + |
| 54 | + static std::string m_datapath; |
| 55 | + |
| 56 | + static std::string m_clienttype; |
| 57 | + |
| 58 | + |
| 59 | + static bool m_IsRecover;// = false; |
| 60 | + |
| 61 | + |
| 62 | +Q_SIGNALS: |
| 63 | + void requestCheck(); |
| 64 | + void stopThread(); |
| 65 | + |
| 66 | +public Q_SLOTS: |
| 67 | + void setStatus(int status, const QString &message, quint64 bytesAvailable); |
| 68 | + |
| 69 | +private Q_SLOTS: |
| 70 | + void on_dataDirectory_textChanged(const QString &arg1); |
| 71 | + void on_ellipsisButton_clicked(); |
| 72 | + void on_dataDirDefault_clicked(); |
| 73 | + void on_dataDirCustom_clicked(); |
| 74 | + |
| 75 | +private: |
| 76 | + Ui::Intro *ui; |
| 77 | + QThread *thread; |
| 78 | + QMutex mutex; |
| 79 | + bool signalled; |
| 80 | + QString pathToCheck; |
| 81 | + |
| 82 | + |
| 83 | + void startThread(); |
| 84 | + void checkPath(const QString &dataDir); |
| 85 | + QString getPathToCheck(); |
| 86 | + |
| 87 | + friend class FreespaceChecker; |
| 88 | +}; |
| 89 | + |
| 90 | +#endif // BITCOIN_QT_INTRO_H |
0 commit comments