- Timestamp:
- 04/15/10 14:50:23 (13 years ago)
- Branches:
- master, qt5
- Children:
- 2eda137
- Parents:
- d97bcab
- Location:
- src/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
rd97bcab r04acaf9 51 51 setupUi(this); 52 52 53 saved_title = windowTitle(); 54 53 55 #ifdef N810 54 56 tabWidget->setTabText(1,"Favs"); … … 99 101 setWindowTitle(Conference::getById(confId).title()); 100 102 101 if(confCount==1) // don't have to show 'selectConference' widget, if there is only one conference in the DB102 selectConferenceWidget->hide();103 else103 QList<Conference> confs = Conference::getAll(); 104 QListIterator<Conference> i(confs); 105 while(i.hasNext()) 104 106 { 105 // have to fill comboBox with available conferences 106 QList<Conference> confs = Conference::getAll(); 107 QListIterator<Conference> i(confs); 108 while(i.hasNext()) 109 { 110 Conference conf = i.next(); 111 selectConference->addItem(conf.title(),conf.id()); 112 } 113 int idx = selectConference->findText(Conference::getById(Conference::activeConference()).title()); 114 selectConference->setCurrentIndex(idx); 107 Conference conf = i.next(); 108 selectConference->addItem(conf.title(),conf.id()); 115 109 } 110 int idx = selectConference->findText(Conference::getById(Conference::activeConference()).title()); 111 selectConference->setCurrentIndex(idx); 116 112 connect(selectConference, SIGNAL(currentIndexChanged(int)), SLOT(conferenceChanged(int))); 113 conferenceChanged(idx); 117 114 } 118 115 else … … 155 152 selectConference->setCurrentIndex(idx); 156 153 157 if(confCount>1) 158 selectConferenceWidget->show(); 154 selectConferenceWidget->show(); 159 155 160 156 conferenceChanged(idx); … … 169 165 // should not happen 170 166 qWarning() << __PRETTY_FUNCTION__ << "removed non-existent item:" << title; 167 // this happens when you remove the only conference (the list is not ptoperly inited in this case) 168 // now make sure that conferencet 169 if (selectConference->count() > 0) { 170 selectConference->setCurrentIndex(0); 171 conferenceChanged(0); 172 } else { 173 conferenceChanged(-1); 174 } 171 175 } else { 172 176 // will it signal "changed"? … … 238 242 } 239 243 244 void MainWindow::unsetConference() 245 { 246 dayTabContainer->clearModel(); 247 tracksTabContainer->clearModel(); 248 roomsTabContainer->clearModel(); 249 favsTabContainer->clearModel(); 250 searchTabContainer->clearModel(); 251 searchTabContainer->searchAgainClicked(); 252 nowTabContainer->clearModel(); 253 254 conferenceHeader->hide(); 255 setWindowTitle(saved_title); 256 } 257 240 258 void MainWindow::conferenceChanged(int aIndex) 241 259 { 242 Conference::getById(Conference::activeConference()).update("active",0); 243 Conference::getById(selectConference->itemData(aIndex).toInt()).update("active",1); 260 if (aIndex < 0) { 261 // no conferences left? reset all views 262 unsetConference(); 263 return; 264 } 265 266 try { 267 Conference::getById(Conference::activeConference()).update("active",0); 268 Conference::getById(selectConference->itemData(aIndex).toInt()).update("active",1); 269 } catch (OrmException& e) { 270 // cannon set an active conference 271 unsetConference(); 272 return; 273 } 244 274 245 275 initTabs(); -
src/gui/mainwindow.h
rd97bcab r04acaf9 43 43 void fillAndShowConferenceHeader(); 44 44 void initTabs(); 45 void unsetConference(); 46 47 QString saved_title; 45 48 }; 46 49 -
src/gui/tabcontainer.cpp
rd97bcab r04acaf9 56 56 void TabContainer::updateTreeView(const QDate &aDate) 57 57 { 58 int active_id = Conference::activeConference(); 58 59 dayNavigator->show(); 59 loadEvents( aDate, Conference::activeConference() ); 60 treeView->reset(); 60 if (active_id > 0) { 61 loadEvents(aDate, active_id); 62 } else { 63 static_cast<EventModel*>(treeView->model())->clearModel(); 64 } 61 65 } 62 66 … … 133 137 } 134 138 139 void TabContainer::clearModel() 140 { 141 static_cast<EventModel*>(treeView->model())->clearModel(); 142 } 143 -
src/gui/tabcontainer.h
rd97bcab r04acaf9 36 36 virtual ~TabContainer() {} 37 37 38 void clearModel(); 38 39 protected: 39 40 virtual void loadEvents( const QDate &aDate, const int aConferenceId )
Note: See TracChangeset
for help on using the changeset viewer.