From 885a3cc69d2cdf714e85534cd9a3907833b7dfe5 Mon Sep 17 00:00:00 2001 From: pavelpa Date: Thu, 28 Jan 2010 07:29:29 +0000 Subject: [PATCH] conference tab header is hidden if there isn't active conference - handled some warnings --- src/gui/daynavigatorwidget.cpp | 2 + src/gui/mainwindow.cpp | 71 +++++----- src/gui/mainwindow.h | 3 + src/gui/mainwindow.ui | 252 +++++++++++++++++---------------- src/gui/tabwidget.cpp | 2 + 5 files changed, 175 insertions(+), 155 deletions(-) diff --git a/src/gui/daynavigatorwidget.cpp b/src/gui/daynavigatorwidget.cpp index 9a2a428..b799127 100644 --- a/src/gui/daynavigatorwidget.cpp +++ b/src/gui/daynavigatorwidget.cpp @@ -96,6 +96,8 @@ QDate DayNavigatorWidget::getCurrentDate() void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent) { + Q_UNUSED(aEvent); + QString selectedDateStr = mCurDate.toString("MMM dd yyyy"); QPainter painter(this); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index d24d964..b5882d6 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -28,12 +28,6 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) int confId = Conference::activeConference(); - QList confs = Conference::getAll(); - if(confs.count()) - { - setWindowTitle(confs[0].title()); - } - connect(importScheduleWidget, SIGNAL(scheduleImported(int)), SLOT(scheduleImported(int))); // event details have changed @@ -44,31 +38,20 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) connect(nowTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); connect(searchTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); - // event conference map button clicked connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked())); connect(tabWidget, SIGNAL(infoIconClicked()), SLOT(aboutApp())); - if(Conference::getAll().count()) // no conference(s) in the DB + if(Conference::getAll().count()) + { + initTabs(); + fillAndShowConferenceHeader(); + setWindowTitle(Conference::getById(confId).title()); + } + else { - QDate startDate = Conference::getById(confId).start(); - QDate endDate = Conference::getById(confId).end(); - // - dayTabContainer->setDates(startDate, endDate); - tracksTabContainer->setDates(startDate, endDate); - roomsTabContainer->setDates(startDate, endDate); - favsTabContainer->setDates(startDate, endDate); - searchTabContainer->setDates(startDate, endDate); - nowTabContainer->updateTreeView(QDate::currentDate()); - // - conferenceTitle->setText(Conference::getById(confId).title()); - conferenceSubtitle->setText(Conference::getById(confId).subtitle()); - conferenceWhere->setText(Conference::getById(confId).city() + ", " + Conference::getById(confId).venue()); - conferenceWhen->setText( - Conference::getById(confId).start().toString("dd-MM-yyyy") - + ", " + - Conference::getById(confId).end().toString("dd-MM-yyyy")); + conferenceHeader->hide(); } // open dialog for given Event ID @@ -92,13 +75,9 @@ void MainWindow::scheduleImported(int aConfId) QList confs = Conference::getAll(); if(confs.count()) { - // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates - QDate startDate = Conference::getById(Conference::activeConference()).start(); - QDate endDate = Conference::getById(Conference::activeConference()).end(); - dayTabContainer->setDates(startDate, endDate); - tracksTabContainer->setDates(startDate, endDate); - roomsTabContainer->setDates(startDate, endDate); - favsTabContainer->setDates(startDate, endDate); + initTabs(); + fillAndShowConferenceHeader(); + setWindowTitle(Conference::getById(Conference::activeConference()).title()); } } @@ -133,3 +112,31 @@ void MainWindow::eventHasChanged(int aEventId) searchTabContainer->updateTreeViewModel(aEventId); } +void MainWindow::fillAndShowConferenceHeader() +{ + int confId = Conference::activeConference(); + conferenceTitle->setText(Conference::getById(confId).title()); + conferenceSubtitle->setText(Conference::getById(confId).subtitle()); + conferenceWhere->setText(Conference::getById(confId).city() + ", " + Conference::getById(confId).venue()); + conferenceWhen->setText( + Conference::getById(confId).start().toString("dd-MM-yyyy") + + ", " + + Conference::getById(confId).end().toString("dd-MM-yyyy")); + conferenceHeader->show(); +} + +void MainWindow::initTabs() +{ + int confId = Conference::activeConference(); + QDate startDate = Conference::getById(confId).start(); + QDate endDate = Conference::getById(confId).end(); + + // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates + dayTabContainer->setDates(startDate, endDate); + tracksTabContainer->setDates(startDate, endDate); + roomsTabContainer->setDates(startDate, endDate); + favsTabContainer->setDates(startDate, endDate); + searchTabContainer->setDates(startDate, endDate); + nowTabContainer->updateTreeView(QDate::currentDate()); +} + diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 0c40681..e5678c3 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -18,6 +18,9 @@ private slots: void aboutApp(); void conferenceMapClicked(); void eventHasChanged(int aEventId); +private: + void fillAndShowConferenceHeader(); + void initTabs(); }; #endif /* MAINWINDOW_H */ diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 804516b..86ba5b8 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -100,129 +100,135 @@ - - - - 75 - true - - - - Conference Name - - - Qt::AlignCenter - - - true - - - - - - - Conference Subtitle - - - Qt::AlignCenter - - - true - - - - - - - Qt::Horizontal - - - - - - - - - - 75 - true - true - - - - When: - - - - - - - - 75 - true - true - - - - Where: - - - - - - - DATE (FROM - TO) - - - - - - - CITY, CAMPUS - - - - - - - MAP - - - - :/icons/compassBig.png:/icons/compassBig.png - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - Qt::Horizontal - + + + + + + + 75 + true + + + + Conference Name + + + Qt::AlignCenter + + + true + + + + + + + Conference Subtitle + + + Qt::AlignCenter + + + true + + + + + + + Qt::Horizontal + + + + + + + + + + 75 + true + true + + + + When: + + + + + + + + 75 + true + true + + + + Where: + + + + + + + DATE (FROM - TO) + + + + + + + CITY, CAMPUS + + + + + + + MAP + + + + :/icons/compassBig.png:/icons/compassBig.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index 08634e1..ddc3126 100644 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -13,6 +13,8 @@ TabWidget::TabWidget(QWidget *aParent) void TabWidget::paintEvent(QPaintEvent *event) { + Q_UNUSED(event); + int height = tabBar()->tabRect(currentIndex()).height(); QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation); QPainter painter(this); -- 2.39.5