forked from oleksandrhf/GoHabit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.cpp
110 lines (80 loc) · 1.89 KB
/
menu.cpp
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include "menu.h"
#include "ui_menu.h"
menu::menu(QWidget *parent) :
QWidget(parent),
ui(new Ui::menu)
{
ui->setupUi(this);
ui->stackedWidget->setCurrentIndex(0);
}
menu::~menu()
{
delete ui;
}
bool menu::connectDB() // підключення бази даних до проекту
{
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("./db_GoHabit.db");
if(!db.open())
{
qDebug() << "Cannot open database: " << db.lastError();
return false;
}
return true;
}
void menu::on_menuToday_clicked()
{
emit menuTodayButton();
this->hide();
}
void menu::on_pushButton_clicked()
{
int* arrOfId;
Singleton* s1 = Singleton::getInstance();
arrOfId = s1->getarrOfId();
ui->groupBox_8->setVisible(false);
ui->stackedWidget->setCurrentIndex(1);
if(*arrOfId != 0)
{
ui->groupBox_8->setVisible(true);
ui->label_22->setText("1");
ui->label_23->hide();
ui->label_11->hide();
// QMessageBox msgBox;
// msgBox.setWindowTitle("Achievements");
// msgBox.setText("You create First Habit!\n");
// msgBox.exec();
}
}
void menu::on_pushButton_4_clicked()
{
ui->stackedWidget->setCurrentIndex(2);
}
void menu::on_pushButton_5_clicked()
{
ui->stackedWidget->setCurrentIndex(3);
}
void menu::on_backAchieve_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void menu::on_backNotificat_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void menu::on_backSettings_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void menu::on_menuButton2_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void menu::on_pushButton_8_clicked()
{
emit logged_out();
}
void menu::on_pushButton_9_clicked()
{
ui->groupBox_8->hide();
}