diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-04-01 18:03:18 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-04-01 18:03:18 +0000 |
| commit | 5c2175f675751f63ffa47ffde156620cc6f77abd (patch) | |
| tree | aa1e02f2b79b43b7d48503d3fde4e2af477e239d | |
| parent | 7f34ed3d9f69619f1681d12f3dffeb3b3937326f (diff) | |
| download | pica-pica-5c2175f675751f63ffa47ffde156620cc6f77abd.tar.gz pica-pica-5c2175f675751f63ffa47ffde156620cc6f77abd.zip | |
notifications in MainWindow, show-hide on button click
git-svn-id: svn://localhost/project_picapica/trunk@235 fb96df88-216d-11de-830c-f3023f12d8ac
| -rw-r--r-- | pica-client/mainwindow.cpp | 29 | ||||
| -rw-r--r-- | pica-client/mainwindow.h | 7 |
2 files changed, 35 insertions, 1 deletions
diff --git a/pica-client/mainwindow.cpp b/pica-client/mainwindow.cpp index 5bf44dd..2df04db 100644 --- a/pica-client/mainwindow.cpp +++ b/pica-client/mainwindow.cpp @@ -19,10 +19,16 @@ MainWindow::MainWindow(QWidget *parent) : layout = new QVBoxLayout; contact_list = new ContactListWidget; status = new QComboBox; + notifications = new QListWidget(); + bt_showhide_notifications = new QPushButton(); + hide_notifications(); status->setMinimumHeight(36); + notifications->setMinimumHeight(48); - layout->addWidget(contact_list); + layout->addWidget(notifications, 1, Qt::AlignTop); + layout->addWidget(bt_showhide_notifications, 0, Qt::AlignRight); + layout->addWidget(contact_list, 8); layout->addWidget(status,0,Qt::AlignBottom); centralWidget()->setLayout(layout); @@ -40,6 +46,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(skynet, SIGNAL(BecameSelfAware()), this, SLOT(set_online())); connect(skynet, SIGNAL(LostSelfAwareness()), this, SLOT(set_offline())); connect(status, SIGNAL(currentIndexChanged(int)), this, SLOT(status_changed(int))); + connect(bt_showhide_notifications, SIGNAL(clicked()), this, SLOT(showhide_click())); } MainWindow::~MainWindow() @@ -104,7 +111,27 @@ void MainWindow::createMenus() } +void MainWindow::show_notifications() +{ + notifications->show(); + bt_showhide_notifications->setText(tr("Hide Notifications")); + status_notifications_hidden = false; +} + +void MainWindow::hide_notifications() +{ + notifications->hide(); + bt_showhide_notifications->setText(tr("Show Notifications")); + status_notifications_hidden = true; +} +void MainWindow::showhide_click() +{ + if (status_notifications_hidden) + show_notifications(); + else + hide_notifications(); +} diff --git a/pica-client/mainwindow.h b/pica-client/mainwindow.h index 3361c69..552db9b 100644 --- a/pica-client/mainwindow.h +++ b/pica-client/mainwindow.h @@ -5,6 +5,7 @@ #include <QListWidget> #include <QComboBox> #include <QSystemTrayIcon> +#include <QPushButton> #include "contacts.h" #include "contactlistwidget.h" @@ -30,6 +31,8 @@ private: Ui::MainWindow *ui; ContactListWidget *contact_list; QComboBox *status; + QListWidget *notifications; + QPushButton *bt_showhide_notifications; QMenu *contactsMenu; QMenu *helpMenu; @@ -37,11 +40,15 @@ private: bool status_change_disable_flag; void SetStatus(bool connected); + bool status_notifications_hidden; private slots: void set_online(); void set_offline(); void status_changed(int index); + void show_notifications(); + void hide_notifications(); + void showhide_click(); }; |
