-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainform.cpp
More file actions
64 lines (50 loc) · 1.46 KB
/
mainform.cpp
File metadata and controls
64 lines (50 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "mainform.h"
#include "ui_mainform.h"
#include <QStackedWidget>
MainForm::MainForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainForm)
{
ui->setupUi(this);
connect(&timer, &QTimer::timeout,
this, &MainForm::updateCodeEvent);
timer.start(1000);
}
void MainForm::updateCodeEvent(){
if (config->maFilesPath == ""){
ui->steamCodeExistProgress->setVisible(false);
ui->mainMessageLabel->setText("Error! No maFiles files for Steam Guard");
return;
}
steamProcess.start("steamguard-cli", {{"-m",config->maFilesPath}} );
steamProcess.waitForFinished();
QString code = steamProcess.readAllStandardOutput();
if (code == ""){
ui->steamCodeExistProgress->setVisible(false);
ui->mainMessageLabel->setText("Error! Unknown error with steamguard-cli 0_o");
return;
}else{
ui->mainMessageLabel->setText(config->nickname);
if (!ui->steamCodeExistProgress->isVisible()){
ui->steamCodeExistProgress->setVisible(true);
}
}
code.replace("\n","");
ui->steamCodeLabel->setText(code);
if (code != lastCode){
statusProgress = 31;
}
if (code == lastCode){
statusProgress -= 1;
ui->steamCodeExistProgress->setValue(statusProgress);
}
lastCode = code;
}
MainForm::~MainForm()
{
delete ui;
}
void MainForm::on_optionsButton_clicked()
{
((QStackedWidget*)parent())->setCurrentIndex(1);
}