set theme for create and restore process #135

This commit is contained in:
DenioD
2020-07-27 21:23:51 +02:00
parent 550cbd1ce7
commit a8ccbb3a86
2 changed files with 51 additions and 5 deletions

View File

@@ -26,8 +26,49 @@ auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths
#endif
void FirstTimeWizard::slot_change_theme(const QString& theme_name)
{
Settings::getInstance()->set_theme_name(theme_name);
// Include css
QString saved_theme_name;
try
{
saved_theme_name = Settings::getInstance()->get_theme_name();
}
catch (...)
{
saved_theme_name = "Dark";
}
QFile qFile(":/css/res/css/" + saved_theme_name +".css");
if (qFile.open(QFile::ReadOnly))
{
QString styleSheet = QLatin1String(qFile.readAll());
this->setStyleSheet(""); // resets styles, makes app restart unnecessary
this->setStyleSheet(styleSheet);
}
}
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
{
// Include css
QString theme_name;
try
{
theme_name = Settings::getInstance()->get_theme_name();
}
catch (...)
{
theme_name = "Dark";
}
this->slot_change_theme(theme_name);
setWindowTitle("New wallet wizard");
this->dangerous = dangerous;
this->server = server;
@@ -139,11 +180,12 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
form.radioRestoreWallet->setEnabled(true);
form.radioNewWallet->setEnabled(true);
form.radioNewWallet->setChecked(true);
parent->button(QWizard::NextButton)->setEnabled(false);
int length = passphrase.length();
char *sequence = NULL;
char *sequence = NULL;
sequence = new char[length+1];
strncpy(sequence, passphrase.toUtf8(), length +1);

View File

@@ -17,13 +17,17 @@ class FirstTimeWizard: public QWizard
public:
FirstTimeWizard(bool dangerous, QString server);
QString getSeed();
void setSeed(QString Seed);
QString _seed;
QString getBirthday();
void setBirthday(QString Birthday);
QString getBirthday();
QString _birthday;
QString _seed;
void setSeed(QString Seed);
void setBirthday(QString Birthday);
void cancelEvent();
public slots:
void slot_change_theme(const QString& themeName);
protected: