You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

intro.h 1.9KB

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