From 5c2175f675751f63ffa47ffde156620cc6f77abd Mon Sep 17 00:00:00 2001 From: me_desk Date: Mon, 1 Apr 2013 18:03:18 +0000 Subject: notifications in MainWindow, show-hide on button click git-svn-id: svn://localhost/project_picapica/trunk@235 fb96df88-216d-11de-830c-f3023f12d8ac --- pica-client/mainwindow.cpp | 29 ++++++++++++++++++++++++++++- pica-client/mainwindow.h | 7 +++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'pica-client') 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 #include #include +#include #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(); }; -- cgit v1.2.1