From: pavelpa Date: Wed, 27 Jan 2010 08:07:41 +0000 (+0000) Subject: 'search' tab functionality moved to 'tabcontainer' X-Git-Tag: 0.5.0~180 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/001c8cfe6f0538c1a5e93e5eea7452f3cfa211f4 'search' tab functionality moved to 'tabcontainer' --- diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 6ea7851..660de2b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -48,50 +48,34 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) tracksTabContainer->setType(TabContainer::EContainerTypeTracks); nowTabContainer->setType(TabContainer::EContainerTypeNow); roomsTabContainer->setType(TabContainer::EContainerTypeRooms); + searchTabContainer->setType(TabContainer::EContainerTypeSearch); connect(importScheduleWidget, SIGNAL(scheduleImported(int)), SLOT(scheduleImported(int))); - connect(searchDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateSearchView(const QDate &))); - - // SEARCH EVENTS View - searchTreeView->setHeaderHidden(true); - searchTreeView->setRootIsDecorated(false); - searchTreeView->setIndentation(0); - searchTreeView->setAnimated(true); - searchTreeView->setModel(new EventModel()); - searchTreeView->setItemDelegate(new Delegate(searchTreeView)); - // event details have changed connect(dayTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); connect(favsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); connect(favsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); connect(roomsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); connect(nowTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); + connect(searchTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); - connect(searchTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); - - // event clicked - connect(searchTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); - - // event search button clicked - connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked())); - connect(searchAgainButton, SIGNAL(clicked()), SLOT(searchAgainClicked())); // 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 { - QDate aStartDate = Conference::getById(AppSettings::confId()).start(); - QDate aEndDate = Conference::getById(AppSettings::confId()).end(); - searchDayNavigator->setDates(aStartDate, aEndDate); + QDate startDate = Conference::getById(AppSettings::confId()).start(); + QDate endDate = Conference::getById(AppSettings::confId()).end(); // - dayTabContainer->setDates(aStartDate, aEndDate); - tracksTabContainer->setDates(aStartDate, aEndDate); - roomsTabContainer->setDates(aStartDate, aEndDate); - favsTabContainer->setDates(aStartDate, aEndDate); + dayTabContainer->setDates(startDate, endDate); + tracksTabContainer->setDates(startDate, endDate); + roomsTabContainer->setDates(startDate, endDate); + favsTabContainer->setDates(startDate, endDate); + searchTabContainer->setDates(startDate, endDate); // conferenceTitle->setText(Conference::getById(AppSettings::confId()).title()); conferenceSubtitle->setText(Conference::getById(AppSettings::confId()).subtitle()); @@ -102,10 +86,6 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) Conference::getById(AppSettings::confId()).end().toString("dd-MM-yyyy")); } - searchTreeView->hide(); - searchVerticalWidget->hide(); - searchHead->show(); - // open dialog for given Event ID // this is used in case Alarm Dialog request application to start if(aEventId) @@ -152,58 +132,6 @@ void MainWindow::aboutApp() dialog.exec(); } -void MainWindow::updateSearchView(const QDate &aDate) -{ - qDebug() << "MainWindow::updateSearchView(), aDate: " << aDate.toString() ; - searchTreeView->reset(); - int eventsCount = static_cast(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId()); - if( eventsCount || - searchDayNavigator->getCurrentDate() != Conference::getById(AppSettings::confId()).start() ){ - searchVerticalWidget->show(); - //searchAgainButton->show(); - searchTreeView->show(); - searchHead->hide(); - } - else{ - searchTreeView->hide(); - searchVerticalWidget->hide(); - searchHead->show(); - } -} - -void MainWindow::searchClicked() -{ - QHash columns; - - if( searchTitle->isChecked() ) - columns.insertMulti("EVENT", "title"); - if( searchAbstract->isChecked() ) - columns.insertMulti("EVENT", "abstract"); - if( searchTag->isChecked() ) - columns.insertMulti("EVENT", "tag"); - if( searchSpeaker->isChecked() ) - columns["PERSON"] = "name"; - if( searchRoom->isChecked() ) - columns["ROOM"] = "name"; - - QString keyword = searchEdit->text().replace( QString("%"), QString("\\%") ); - qDebug() << "\nKeyword to search: " << keyword; - SqlEngine::searchEvent( AppSettings::confId(), columns, keyword ); - - QDate aStartDate = Conference::getById(AppSettings::confId()).start(); - QDate aEndDate = Conference::getById(AppSettings::confId()).end(); - searchDayNavigator->setDates(aStartDate, aEndDate); - updateSearchView( Conference::getById(AppSettings::confId()).start() ); -} - -void MainWindow::searchAgainClicked() -{ - searchHead->show(); - //searchAgainButton->hide(); - searchVerticalWidget->hide(); - searchTreeView->hide(); -} - void MainWindow::conferenceMapClicked() { QString mapPath = QString(":/maps/campus.png"); @@ -224,7 +152,6 @@ void MainWindow::eventHasChanged(int aEventId) tracksTabContainer->updateTreeViewModel(aEventId); nowTabContainer->updateTreeViewModel(aEventId); roomsTabContainer->updateTreeViewModel(aEventId); - - static_cast(searchTreeView->model())->updateModel(aEventId); + searchTabContainer->updateTreeViewModel(aEventId); } diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 2e82a7c..0c40681 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -16,12 +16,9 @@ public: private slots: void scheduleImported(int aConfId); void aboutApp(); - void updateSearchView(const QDate &aDate); - void searchClicked(); - void searchAgainClicked(); void conferenceMapClicked(); void eventHasChanged(int aEventId); }; -#endif // MAINWINDOW_H +#endif /* MAINWINDOW_H */ diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 7f25a2f..63e4e05 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -61,228 +61,7 @@ - - - true - - - - 0 - 0 - - - - - 0 - - - - - - 0 - 0 - - - - Search again - - - S - - - - :/icons/search.png:/icons/search.png - - - - 24 - 24 - - - - Qt::ToolButtonIconOnly - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - QLayout::SetDefaultConstraint - - - - - - - true - - - type a keyword to search - - - - - - - - 0 - 0 - - - - Search - - - - :/icons/search.png:/icons/search.png - - - false - - - true - - - true - - - false - - - - - - - - - - - Title - - - true - - - - - - - Abstract - - - - - - - Speaker - - - - - - - Tag - - - - - - - Room - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - 0 - 1 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 1 - - - - - + @@ -473,17 +252,6 @@ - - DayNavigatorWidget - QWidget -
daynavigatorwidget.h
- 1 -
- - TreeView - QTreeView -
../mvc/treeview.h
-
TabWidget QTabWidget diff --git a/src/gui/tabcontainer.cpp b/src/gui/tabcontainer.cpp index 6035e84..993b9a2 100644 --- a/src/gui/tabcontainer.cpp +++ b/src/gui/tabcontainer.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -22,6 +23,7 @@ TabContainer::TabContainer(QWidget *aParent) setupUi(this); searchAgainButton->hide(); + searchHead->hide(); treeView->setHeaderHidden(true); treeView->setRootIsDecorated(false); @@ -37,6 +39,9 @@ TabContainer::TabContainer(QWidget *aParent) connect(treeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); connect(treeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); + connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked())); + connect(searchAgainButton, SIGNAL(clicked()), SLOT(searchAgainClicked())); + if(!Conference::getAll().count()) // no conference(s) in the DB { dayNavigator->hide(); // hide DayNavigatorWidget @@ -52,12 +57,17 @@ TabContainer::TabContainer(QWidget *aParent) void TabContainer::setType(TabContainer::Type aType) { mType = aType; + if(aType == EContainerTypeNow) { QTimer *timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), SLOT(timerUpdateTreeView()) ); timer->start( 30000); // 30 seconds timer } + if(aType == EContainerTypeSearch) + { + searchHead->show(); + } } void TabContainer::updateTreeView(const QDate &aDate) @@ -90,6 +100,25 @@ void TabContainer::updateTreeView(const QDate &aDate) treeView->setAllExpanded(true); } break; + case EContainerTypeSearch: + { + treeView->reset(); + int eventsCount = static_cast(treeView->model())->loadSearchResultEvents(aDate,AppSettings::confId()); + if( eventsCount || + dayNavigator->getCurrentDate() != Conference::getById(AppSettings::confId()).start() ){ + searchAgainButton->show(); + dayNavigator->show(); + treeView->show(); + searchHead->hide(); + } + else{ + treeView->hide(); + searchAgainButton->hide(); + dayNavigator->hide(); + searchHead->show(); + } + } + break; case EContainerTypeNone: default: { @@ -178,3 +207,42 @@ void TabContainer::timerUpdateTreeView() } } +void TabContainer::searchClicked() +{ + if(mType == EContainerTypeSearch) + { + QHash columns; + + if( searchTitle->isChecked() ) + columns.insertMulti("EVENT", "title"); + if( searchAbstract->isChecked() ) + columns.insertMulti("EVENT", "abstract"); + if( searchTag->isChecked() ) + columns.insertMulti("EVENT", "tag"); + if( searchSpeaker->isChecked() ) + columns["PERSON"] = "name"; + if( searchRoom->isChecked() ) + columns["ROOM"] = "name"; + + QString keyword = searchEdit->text().replace( QString("%"), QString("\\%") ); + qDebug() << "\nKeyword to search: " << keyword; + SqlEngine::searchEvent( AppSettings::confId(), columns, keyword ); + + QDate startDate = Conference::getById(AppSettings::confId()).start(); + QDate endDate = Conference::getById(AppSettings::confId()).end(); + dayNavigator->setDates(startDate, endDate); + updateTreeView( Conference::getById(AppSettings::confId()).start() ); + } +} + +void TabContainer::searchAgainClicked() +{ + if(mType == EContainerTypeSearch) + { + searchHead->show(); + searchAgainButton->hide(); + dayNavigator->hide(); + treeView->hide(); + } +} + diff --git a/src/gui/tabcontainer.h b/src/gui/tabcontainer.h index 527c58b..47748a0 100644 --- a/src/gui/tabcontainer.h +++ b/src/gui/tabcontainer.h @@ -39,6 +39,8 @@ private slots: void itemClicked(const QModelIndex &aIndex); void displayMap(const QModelIndex &aIndex); void displayWarning(const QModelIndex &aIndex); + void searchClicked(); + void searchAgainClicked(); private: TabContainer::Type mType; diff --git a/src/gui/tabcontainer.ui b/src/gui/tabcontainer.ui index ff1966e..4da6b10 100644 --- a/src/gui/tabcontainer.ui +++ b/src/gui/tabcontainer.ui @@ -13,50 +13,190 @@ Form - - - - true - - - - 0 - 0 - - - - Search again - - - S - - - - :/icons/search.png:/icons/search.png - - - - 24 - 24 - - - - Qt::ToolButtonIconOnly - - + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + QLayout::SetDefaultConstraint + + + + + + + true + + + type a keyword to search + + + + + + + + 0 + 0 + + + + Search + + + + :/icons/search.png:/icons/search.png + + + false + + + true + + + true + + + false + + + + + + + + + + + Title + + + true + + + + + + + Abstract + + + + + + + Speaker + + + + + + + Tag + + + + + + + Room + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + - - - - - - - - 0 - 0 - - - + + + + + + true + + + + 0 + 0 + + + + Search again + + + S + + + + :/icons/search.png:/icons/search.png + + + + 24 + 24 + + + + Qt::ToolButtonIconOnly + + + + + + + + 0 + 0 + + + + +