bf257858a4
Adds a "Data Directory" section to Options > Main tab that lets users browse for a new data directory. On confirmation, files are automatically migrated to the new location on restart (wallet.dat copied first with atomic rename for safety). Supports "Restart Now" or "Later" workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
1.9 KiB
C++
77 lines
1.9 KiB
C++
#ifndef OPTIONSDIALOG_H
|
|
#define OPTIONSDIALOG_H
|
|
|
|
#include <QDialog>
|
|
|
|
class QLineEdit;
|
|
class QLabel;
|
|
|
|
namespace Ui {
|
|
class OptionsDialog;
|
|
}
|
|
class OptionsModel;
|
|
class MonitoredDataMapper;
|
|
class QValidatedLineEdit;
|
|
|
|
/** Preferences dialog. */
|
|
class OptionsDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit OptionsDialog(QWidget *parent = 0);
|
|
~OptionsDialog();
|
|
|
|
void setModel(OptionsModel *model);
|
|
void setMapper();
|
|
|
|
protected:
|
|
bool eventFilter(QObject *object, QEvent *event);
|
|
|
|
private slots:
|
|
/* enable only apply button */
|
|
void enableApplyButton();
|
|
/* disable only apply button */
|
|
void disableApplyButton();
|
|
/* enable apply button and OK button */
|
|
void enableSaveButtons();
|
|
/* disable apply button and OK button */
|
|
void disableSaveButtons();
|
|
/* set apply button and OK button state (enabled / disabled) */
|
|
void setSaveButtonState(bool fState);
|
|
void on_okButton_clicked();
|
|
void on_cancelButton_clicked();
|
|
void on_applyButton_clicked();
|
|
|
|
void showRestartWarning_Proxy();
|
|
void showRestartWarning_Lang();
|
|
void updateDisplayUnit();
|
|
void handleProxyIpValid(QValidatedLineEdit *object, bool fState);
|
|
void applyTorDefaults(bool enabled);
|
|
void on_dataDirBrowseButton_clicked();
|
|
void updateDataDirFreeSpace();
|
|
|
|
signals:
|
|
void proxyIpValid(QValidatedLineEdit *object, bool fValid);
|
|
|
|
private:
|
|
bool handleDataDirChange();
|
|
void performRestart();
|
|
quint64 calculateDirSize(const QString& path);
|
|
|
|
Ui::OptionsDialog *ui;
|
|
OptionsModel *model;
|
|
MonitoredDataMapper *mapper;
|
|
bool fRestartWarningDisplayed_Proxy;
|
|
bool fRestartWarningDisplayed_Lang;
|
|
bool fProxyIpValid;
|
|
|
|
// Data directory widgets (built programmatically)
|
|
QLineEdit *dataDirPath;
|
|
QLabel *dataDirFreeSpaceLabel;
|
|
QString m_currentDataDir;
|
|
QString m_pendingDataDir;
|
|
};
|
|
|
|
#endif // OPTIONSDIALOG_H
|