-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainmenuui.cpp
118 lines (112 loc) · 5.19 KB
/
mainmenuui.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
111
112
113
114
115
116
117
#include "mainmenuui.h"
#include "ui_mainmenuui.h"
#include<QPainter>
#include<QPixmap>
#include<QDebug>
MainMenuUi::MainMenuUi(QWidget *parent)
: QWidget(parent)
, ui(new Ui::MainMenuUi)
{
ui->setupUi(this);
bg.load(":/main/image/menubackground3.jpg");
token=LoginToken::getInstance();
menuconnect();
//currentButton=ui->myfileButton;
ui->myfileButton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
/*
smapper=new QSignalMapper(this);
mapper.insert(ui->myfileButton->text(),ui->myfileButton);
mapper.insert(ui->fileshareButton->text(),ui->fileshareButton);
mapper.insert(ui->changeuserButton->text(),ui->changeuserButton);
mapper.insert(ui->filedownloadbutton->text(),ui->filedownloadbutton);
for(auto it=mapper.begin();it!=mapper.end();it++)
{
smapper->setMapping(it.value(),it.key());
connect(it.value(),SIGNAL(clicked()),smapper,SLOT(map()));
}
connect(smapper,SIGNAL(mapped(QString)),this,SLOT(onMapperButtonClicked(QString)));
*/
}
/*
void MainMenuUi::defaultPage() {
currentButton->setStyleSheet("color:black");
currentButton = ui->myfileButton;
ui->myfileButton->setStyleSheet("color:white");
}
*/
MainMenuUi::~MainMenuUi()
{
delete ui;
}
void MainMenuUi::paintEvent(QPaintEvent *event)
{
QPainter p(this);
p.drawPixmap(0,0,this->width(),this->height(),bg);
ui->userButton->setText(token->getName());
}
/*
void MainMenuUi::onMapperButtonClicked(QString text)
{
qDebug()<<"hell哦“";
QToolButton *btnTemp=nullptr;
for( auto it=mapper.begin();it!=mapper.end();it++)
{
if(it.key()==text)
{
btnTemp=it.value();break;
}
}
if(btnTemp==currentButton)return;
currentButton->setStyleSheet("color:black");
currentButton=btnTemp;
currentButton->setStyleSheet("color:wihte");
if(text==ui->myfileButton->text()) emit show_myfilePage();
else if(text==ui->fileshareButton->text()) emit show_sharefilePage();
else if(text==ui->filedownloadbutton->text()) emit show_downloadfilePage();
else if(text==ui->filetransportButton->text()) emit show_transportfilePage();
else if(text==ui->changeuserButton->text())emit show_changeuserPage();
}
*/
void MainMenuUi::menuconnect()
{
connect(ui->myfileButton, &QToolButton::clicked, this, [=](){
emit show_myfilePage();
ui->myfileButton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
ui->fileshareButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filedownloadbutton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filetransportButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->changeuserButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
});
connect(ui->fileshareButton, &QToolButton::clicked, this, [=](){
emit show_sharefilePage();
ui->myfileButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->fileshareButton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
ui->filedownloadbutton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filetransportButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->changeuserButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
});
connect(ui->filedownloadbutton, &QToolButton::clicked, this, [=](){
emit show_downloadfilePage();
ui->myfileButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->fileshareButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filedownloadbutton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
ui->filetransportButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->changeuserButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
});
connect(ui->filetransportButton, &QToolButton::clicked, this, [=](){
emit show_transportfilePage();
ui->myfileButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->fileshareButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filedownloadbutton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filetransportButton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
ui->changeuserButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
});
connect(ui->changeuserButton, &QToolButton::clicked, this, [=](){
emit show_changeuserPage();
ui->myfileButton->setStyleSheet("color:rgb(151, 116, 208);font: 700 10pt Microsoft YaHei UI");
ui->fileshareButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filedownloadbutton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->filetransportButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
ui->changeuserButton->setStyleSheet("color:black;font: 700 10pt Microsoft YaHei UI");
});
}