-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCloudDialog.cpp
More file actions
86 lines (74 loc) · 1.8 KB
/
Copy pathCloudDialog.cpp
File metadata and controls
86 lines (74 loc) · 1.8 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "CloudDialog.h"
CloudDialog::CloudDialog(LogNotebook* main, QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
notebook = main;
}
CloudDialog::~CloudDialog()
{
}
void CloudDialog::setLatestBackup(QDate date)
{
if (date == QDate(1970, 1, 1)) {
ui.lastBackupLbl->setText("No Backups");
}
else {
ui.lastBackupLbl->setText(date.toString("MM-dd-yyyy"));
}
}
void CloudDialog::setLoggedIn(bool loggedIn)
{
if (loggedIn) {
ui.statusLbl->setText("Logged In");
ui.logInBtn->setText("Log out");
ui.backupBtn->setEnabled(true);
ui.refreshBtn->setEnabled(true);
}
else {
ui.statusLbl->setText("Logged Out");
ui.logInBtn->setText("Log In");
ui.backupBtn->setEnabled(false);
ui.refreshBtn->setEnabled(false);
}
}
void CloudDialog::setUserName(QString name)
{
ui.userNameLbl->setText(name);
}
void CloudDialog::setBackupFrequency(int frequency)
{
ui.frequencySpin->setValue(frequency);
}
void CloudDialog::writeLine(QString line)
{
ui.textBrowser->append(line);
}
void CloudDialog::on_backupBtn_clicked()
{
if (notebook->dropBox->token() == Q_NULLPTR) {
ui.textBrowser->append("You must sign into Dropbox before backing up to it.");
return;
}
notebook->backupToCloud();
}
void CloudDialog::on_refreshBtn_clicked()
{
if (notebook->dropBox->token() == Q_NULLPTR) {
ui.textBrowser->append("You must sign into Dropbox before refreshing backups up to it.");
return;
}
notebook->getLastDBBackup();
}
void CloudDialog::on_frequencySpin_valueChanged(int i)
{
notebook->backupFrequency = i;
QSettings settings;
settings.setValue("backupFrequency", i);
notebook->checkBackup();
}
void CloudDialog::on_logInBtn_clicked() {
if (ui.logInBtn->text() == "Log In") notebook->logIntoDB();
else notebook->logOutofDB();
}