Changeset 1fb7a33 for src/gui/mainwindow.cpp
- Timestamp:
- 01/29/10 11:06:55 (13 years ago)
- Branches:
- master, qt5
- Children:
- 5007fde
- Parents:
- 8b0bf22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
r8b0bf22 r1fb7a33 44 44 connect(tabWidget, SIGNAL(infoIconClicked()), SLOT(aboutApp())); 45 45 46 if(Conference::getAll().count()) 46 selectConference->setDuplicatesEnabled(false); 47 int confCount = Conference::getAll().count(); 48 if(confCount) 47 49 { 48 50 initTabs(); 49 51 fillAndShowConferenceHeader(); 50 52 setWindowTitle(Conference::getById(confId).title()); 53 54 if(confCount==1) // don't have to show 'selectConference' widget, if there is only one conference in the DB 55 selectConferenceWidget->hide(); 56 else 57 { 58 // have to fill comboBox with available conferences 59 QList<Conference> confs = Conference::getAll(); 60 QListIterator<Conference> i(confs); 61 while(i.hasNext()) 62 { 63 Conference conf = i.next(); 64 selectConference->addItem(conf.title(),conf.id()); 65 } 66 int idx = selectConference->findText(Conference::getById(Conference::activeConference()).title()); 67 selectConference->setCurrentIndex(idx); 68 } 69 connect(selectConference, SIGNAL(currentIndexChanged(int)), SLOT(conferenceChanged(int))); 51 70 } 52 71 else 53 72 { 54 73 conferenceHeader->hide(); 74 selectConferenceWidget->hide(); 55 75 // go to the 'conferenceTab', so the user can import the schedule 56 76 tabWidget->setCurrentIndex(6); // 6 - conference tab … … 75 95 Q_UNUSED(aConfId); 76 96 77 QList<Conference> confs = Conference::getAll();78 if( confs.count())97 Conference conf = Conference::getById(aConfId); 98 if( selectConference->findText(conf.title()) < 0 ) // item doesn't exist 79 99 { 80 initTabs(); 81 fillAndShowConferenceHeader(); 82 setWindowTitle(Conference::getById(Conference::activeConference()).title()); 100 disconnect(selectConference, SIGNAL(currentIndexChanged(int)), this, SLOT(conferenceChanged(int))); 101 selectConference->addItem(conf.title(),conf.id()); 102 connect(selectConference, SIGNAL(currentIndexChanged(int)), SLOT(conferenceChanged(int))); 103 } 104 int confCount = Conference::getAll().count(); 105 if(confCount) 106 { 107 int idx = selectConference->findText(conf.title()); 108 selectConference->setCurrentIndex(idx); 109 110 if(confCount>1) 111 selectConferenceWidget->show(); 112 113 conferenceChanged(idx); 83 114 } 84 115 } … … 144 175 } 145 176 177 void MainWindow::conferenceChanged(int aIndex) 178 { 179 Conference::getById(Conference::activeConference()).update("active",0); 180 Conference::getById(selectConference->itemData(aIndex).toInt()).update("active",1); 181 182 initTabs(); 183 fillAndShowConferenceHeader(); 184 setWindowTitle(Conference::getById(Conference::activeConference()).title()); 185 } 186
Note: See TracChangeset
for help on using the changeset viewer.