Ignore:
Timestamp:
01/27/10 09:07:41 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
6bc425e
Parents:
9f367eb
Message:

'search' tab functionality moved to 'tabcontainer'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r9f367eb r001c8cf  
    4949    nowTabContainer->setType(TabContainer::EContainerTypeNow);
    5050    roomsTabContainer->setType(TabContainer::EContainerTypeRooms);
     51    searchTabContainer->setType(TabContainer::EContainerTypeSearch);
    5152
    5253    connect(importScheduleWidget, SIGNAL(scheduleImported(int)), SLOT(scheduleImported(int)));
    53 
    54     connect(searchDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateSearchView(const QDate &)));
    55 
    56     // SEARCH EVENTS View
    57         searchTreeView->setHeaderHidden(true);
    58         searchTreeView->setRootIsDecorated(false);
    59         searchTreeView->setIndentation(0);
    60         searchTreeView->setAnimated(true);
    61         searchTreeView->setModel(new EventModel());
    62         searchTreeView->setItemDelegate(new Delegate(searchTreeView));
    6354
    6455    // event details have changed
     
    6859    connect(roomsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    6960    connect(nowTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     61    connect(searchTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    7062
    71     connect(searchTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    72 
    73     // event clicked
    74     connect(searchTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
    75 
    76     // event search button clicked
    77     connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked()));
    78     connect(searchAgainButton, SIGNAL(clicked()), SLOT(searchAgainClicked()));
    7963
    8064    // event conference map button clicked
    8165    connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
    82     //
     66
    8367    connect(tabWidget, SIGNAL(infoIconClicked()), SLOT(aboutApp()));
    8468
    8569    if(Conference::getAll().count()) // no conference(s) in the DB
    8670    {
    87         QDate aStartDate = Conference::getById(AppSettings::confId()).start();
    88         QDate aEndDate = Conference::getById(AppSettings::confId()).end();
    89         searchDayNavigator->setDates(aStartDate, aEndDate);
     71        QDate startDate = Conference::getById(AppSettings::confId()).start();
     72        QDate endDate = Conference::getById(AppSettings::confId()).end();
    9073        //
    91         dayTabContainer->setDates(aStartDate, aEndDate);
    92         tracksTabContainer->setDates(aStartDate, aEndDate);
    93         roomsTabContainer->setDates(aStartDate, aEndDate);
    94         favsTabContainer->setDates(aStartDate, aEndDate);
     74        dayTabContainer->setDates(startDate, endDate);
     75        tracksTabContainer->setDates(startDate, endDate);
     76        roomsTabContainer->setDates(startDate, endDate);
     77        favsTabContainer->setDates(startDate, endDate);
     78        searchTabContainer->setDates(startDate, endDate);
    9579        //
    9680        conferenceTitle->setText(Conference::getById(AppSettings::confId()).title());
     
    10286                Conference::getById(AppSettings::confId()).end().toString("dd-MM-yyyy"));
    10387    }
    104 
    105     searchTreeView->hide();
    106     searchVerticalWidget->hide();
    107     searchHead->show();
    10888
    10989    // open dialog for given Event ID
     
    153133}
    154134
    155 void MainWindow::updateSearchView(const QDate &aDate)
    156 {
    157     qDebug() << "MainWindow::updateSearchView(), aDate: " << aDate.toString() ;
    158     searchTreeView->reset();
    159     int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId());
    160     if( eventsCount ||
    161             searchDayNavigator->getCurrentDate() != Conference::getById(AppSettings::confId()).start() ){
    162         searchVerticalWidget->show();
    163         //searchAgainButton->show();
    164         searchTreeView->show();
    165         searchHead->hide();
    166     }
    167     else{
    168         searchTreeView->hide();
    169         searchVerticalWidget->hide();
    170         searchHead->show();
    171     }
    172 }
    173 
    174 void MainWindow::searchClicked()
    175 {
    176     QHash<QString,QString> columns;
    177 
    178     if( searchTitle->isChecked() )
    179         columns.insertMulti("EVENT", "title");
    180     if( searchAbstract->isChecked() )
    181         columns.insertMulti("EVENT", "abstract");
    182     if( searchTag->isChecked() )
    183         columns.insertMulti("EVENT", "tag");
    184     if( searchSpeaker->isChecked() )
    185         columns["PERSON"] = "name";
    186     if( searchRoom->isChecked() )
    187         columns["ROOM"] = "name";
    188 
    189     QString keyword = searchEdit->text().replace( QString("%"), QString("\\%") );
    190     qDebug() << "\nKeyword to search: " << keyword;
    191     SqlEngine::searchEvent( AppSettings::confId(), columns, keyword );
    192 
    193     QDate aStartDate = Conference::getById(AppSettings::confId()).start();
    194     QDate aEndDate = Conference::getById(AppSettings::confId()).end();
    195     searchDayNavigator->setDates(aStartDate, aEndDate);
    196     updateSearchView( Conference::getById(AppSettings::confId()).start() );
    197 }
    198 
    199 void MainWindow::searchAgainClicked()
    200 {
    201     searchHead->show();
    202     //searchAgainButton->hide();
    203     searchVerticalWidget->hide();
    204     searchTreeView->hide();
    205 }
    206 
    207135void MainWindow::conferenceMapClicked()
    208136{
     
    225153    nowTabContainer->updateTreeViewModel(aEventId);
    226154    roomsTabContainer->updateTreeViewModel(aEventId);
    227 
    228     static_cast<EventModel*>(searchTreeView->model())->updateModel(aEventId);
     155    searchTabContainer->updateTreeViewModel(aEventId);
    229156}
    230157
Note: See TracChangeset for help on using the changeset viewer.