~ubuntu-branches/ubuntu/utopic/youker-assistant/utopic-proposed

« back to all changes in this revision

Viewing changes to src/modaldialog.cpp

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    ui->btn_min->installEventFilter(this);
29
29
    ui->btn_close->setStyleSheet("border-image:url(:/pixmap/image/closeBtn.png)");
30
30
    ui->btn_min->setStyleSheet("border-image:url(:/pixmap/image/minBtn.png)");
 
31
    ui->okButton->setStyleSheet("QPushButton {border-image:url(:/pixmap/image/ok.png);}"
 
32
                "QPushButton:hover{border-image:url(:/pixmap/image/ok-hover.png);}");
 
33
    ui->closeButton->setStyleSheet("QPushButton {border-image:url(:/pixmap/image/quit.png);}"
 
34
                "QPushButton:hover{border-image:url(:/pixmap/image/quit-hover.png);}");
31
35
    //QLabel自动换行
32
36
    ui->displaylabel->setWordWrap(true);
33
 
//    ui->displaylabel->setAlignment(Qt::AlignTop);
34
 
 
35
 
 
 
37
    ui->displaylabel->setText("点击鼠标左键进行更换颜色检测操作,点击鼠标右键退出检测。");
36
38
    QObject::connect(ui->okButton,SIGNAL(clicked()),this,SLOT(accept()));
37
39
    QObject::connect(ui->closeButton,SIGNAL(clicked()),this,SLOT(reject()));
38
40
    this->qtui = NULL;
39
 
 
40
41
}
41
42
 
42
 
ModalDialog::~ModalDialog()
43
 
{
 
43
ModalDialog::~ModalDialog() {
44
44
    delete ui;
45
45
}
46
46
 
47
 
void ModalDialog::on_closeButton_clicked()
48
 
{
 
47
void ModalDialog::on_closeButton_clicked() {
49
48
    close();
50
49
    QDialog::destroy(true);
51
50
}
52
51
 
53
 
void ModalDialog::on_okButton_clicked()
54
 
{
55
 
//    passwd = ui->lineEdit->text();
56
 
//    QDialog::accept();
 
52
void ModalDialog::on_okButton_clicked() {
 
53
    //开始屏幕检测
57
54
    monitor_check();
58
55
}
59
56
 
60
57
void ModalDialog::monitor_check() {
61
 
    if (this->qtui)
 
58
    if (this->qtui) {
62
59
        delete this->qtui;
 
60
    }
63
61
    this->qtui = new QUIBO();
64
62
}
65
63
 
66
 
bool ModalDialog::eventFilter(QObject *obj, QEvent *event)
67
 
{
 
64
bool ModalDialog::eventFilter(QObject *obj, QEvent *event) {
68
65
    if(obj == ui->btn_min){
69
66
            if(event->type() == QEvent::Enter){
70
67
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/minBtn-hover.png"));
108
105
 
109
106
}
110
107
 
111
 
void ModalDialog::mousePressEvent(QMouseEvent *event)
112
 
{
 
108
void ModalDialog::mousePressEvent(QMouseEvent *event) {
113
109
    if (event->button() == Qt::LeftButton)
114
110
    {
115
111
        dragPos = event->globalPos() - frameGeometry().topLeft();
116
112
        event->accept();
117
113
    }
118
 
 
119
114
}
120
115
 
121
 
void ModalDialog::mouseMoveEvent(QMouseEvent *event)
122
 
{
123
 
    if (event->buttons() & Qt::LeftButton )
124
 
    {
 
116
void ModalDialog::mouseMoveEvent(QMouseEvent *event) {
 
117
    if (event->buttons() & Qt::LeftButton ) {
125
118
        move(event->globalPos() - dragPos);
126
119
        setWindowOpacity(0.5);
127
120
    }
128
121
    event->accept();
129
 
 
130
122
}
131
123
 
132
 
void ModalDialog::mouseReleaseEvent(QMouseEvent *event)
133
 
{
134
 
    if (event->button() == Qt::LeftButton)
135
 
    {
 
124
void ModalDialog::mouseReleaseEvent(QMouseEvent *event) {
 
125
    if (event->button() == Qt::LeftButton) {
136
126
        setWindowOpacity(1);
137
127
    }
138
128
    event->accept();