dogecoin/src/qt/intro.h
Philip Kaufmann 5bc6d8e580 fix possible infinite loop in intro.cpp thread
- it was possible to trigger an infinite loop in FreespaceChecker::check() by
  simply removing the drive letter on Windows (which leads to an infinite
  loop in the FreespaceChecker thread)
- this was caused by not checking if we make progress with
  parentDir.parent_path()
2013-07-26 09:17:24 +02:00

69 lines
1.5 KiB
C++

#ifndef INTRO_H
#define INTRO_H
#include <QDialog>
#include <QThread>
#include <QMutex>
namespace Ui {
class Intro;
}
class FreespaceChecker;
/** 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 // INTRO_H