Changeset 7620de0
- Timestamp:
- 01/25/10 13:52:01 (13 years ago)
- Branches:
- master, qt5
- Children:
- c7b58d4
- Parents:
- 7b70507
- Location:
- src
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
r7b70507 r7620de0 54 54 connect(favouriteDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateFavouritesView(const QDate &))); 55 55 connect(searchDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateSearchView(const QDate &))); 56 connect(roomDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateRoomView(const QDate &))); 56 57 57 58 // DAY EVENTS View … … 95 96 nowTreeView->setItemDelegate(new Delegate(nowTreeView)); 96 97 98 // ROOMS View 99 roomTreeView->setHeaderHidden(true); 100 roomTreeView->setRootIsDecorated(false); 101 roomTreeView->setIndentation(0); 102 roomTreeView->setAnimated(true); 103 roomTreeView->setModel(new EventModel()); 104 roomTreeView->setItemDelegate(new Delegate(roomTreeView)); 105 97 106 // event details have changed 98 107 connect(dayTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); … … 101 110 connect(searchTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); 102 111 connect(nowTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); 112 connect(roomTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); 103 113 104 114 // event clicked … … 108 118 connect(searchTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 109 119 connect(nowTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 120 connect(roomTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 110 121 // request for map to be displayed 111 122 connect(dayTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); … … 114 125 connect(searchTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); 115 126 connect(nowTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); 127 connect(roomTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); 116 128 // request for warning to be displayed 117 129 connect(dayTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); … … 120 132 connect(searchTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); 121 133 connect(nowTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); 134 connect(roomTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); 122 135 // event search button clicked 123 136 connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked())); … … 132 145 dayNavigator->hide(); // hide DayNavigatorWidget 133 146 trackDayNavigator->hide(); 147 roomDayNavigator->hide(); 134 148 } 135 149 else … … 141 155 favouriteDayNavigator->setDates(aStartDate, aEndDate); 142 156 searchDayNavigator->setDates(aStartDate, aEndDate); 157 roomDayNavigator->setDates(aStartDate, aEndDate); 143 158 // 144 159 conferenceTitle->setText(Conference::getById(AppSettings::confId()).title()); … … 232 247 void MainWindow::updateSearchView(const QDate &aDate) 233 248 { 249 /* 234 250 searchTreeView->reset(); 235 251 int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId()); … … 245 261 searchHead->show(); 246 262 } 263 */ 247 264 } 248 265 … … 253 270 nowTreeView->reset(); 254 271 nowTreeView->setAllExpanded(true); 272 } 273 274 void MainWindow::updateRoomView(const QDate &aDate) 275 { 276 static_cast<EventModel*>(roomTreeView->model())->loadEventsByRoom(aDate, AppSettings::confId()); 277 roomTreeView->reset(); 278 roomDayNavigator->show(); 255 279 } 256 280 -
src/gui/mainwindow.h
r7b70507 r7620de0 24 24 void updateSearchView(const QDate &aDate); 25 25 void updateNowView(); 26 void updateRoomView(const QDate &aDate); 26 27 void itemClicked(const QModelIndex &aIndex); 27 28 void displayMap(const QModelIndex &aIndex); -
src/gui/mainwindow.ui
r7b70507 r7620de0 6 6 <x>0</x> 7 7 <y>0</y> 8 <width> 654</width>9 <height> 444</height>8 <width>935</width> 9 <height>530</height> 10 10 </rect> 11 11 </property> … … 119 119 </layout> 120 120 </widget> 121 <widget class="QWidget" name="searchTab" >122 <attribute name="title" >121 <widget class="QWidget" name="searchTab" > 122 <attribute name="title" > 123 123 <string>Search</string> 124 124 </attribute> 125 <layout class="Q HBoxLayout" name="horizontalLayout_1">125 <layout class="QVBoxLayout" name="verticalLayout_3" > 126 126 <item> 127 <widget class="QWidget" name="searchVerticalWidget" native="true"> 128 <layout class="QVBoxLayout" name="searchDayNavigatorVerticalLayout"> 129 <item> 130 <widget class="QToolButton" name="searchAgainButton"> 131 <property name="text"> 132 <string>Search again</string> 133 </property> 134 <property name="toolButtonStyle"> 135 <enum>Qt::ToolButtonTextOnly</enum> 136 </property> 137 </widget> 138 </item> 139 <item> 140 <widget class="DayNavigatorWidget" name="searchDayNavigator" native="true"> 141 <property name="maximumSize"> 142 <size> 143 <width>16777215</width> 144 <height>16777215</height> 145 </size> 146 </property> 147 </widget> 148 </item> 149 </layout> 150 </widget> 127 <layout class="QFormLayout" name="searchHeadLayout" > 128 <property name="fieldGrowthPolicy" > 129 <enum>QFormLayout::AllNonFixedFieldsGrow</enum> 130 </property> 131 <item row="0" column="0" > 132 <widget class="QCheckBox" name="searchTitle" > 133 <property name="text" > 134 <string>Title</string> 135 </property> 136 </widget> 137 </item> 138 <item row="0" column="1" > 139 <layout class="QHBoxLayout" name="horizontalLayout" > 140 <item> 141 <widget class="QLineEdit" name="searchEdit" > 142 <property name="enabled" > 143 <bool>true</bool> 144 </property> 145 <property name="toolTip" > 146 <string>type a keyword to search</string> 147 </property> 148 </widget> 149 </item> 150 <item> 151 <widget class="QPushButton" name="searchButton" > 152 <property name="text" > 153 <string>Search</string> 154 </property> 155 <property name="checkable" > 156 <bool>false</bool> 157 </property> 158 <property name="autoDefault" > 159 <bool>false</bool> 160 </property> 161 <property name="default" > 162 <bool>true</bool> 163 </property> 164 <property name="flat" > 165 <bool>false</bool> 166 </property> 167 </widget> 168 </item> 169 </layout> 170 </item> 171 <item row="1" column="0" > 172 <widget class="QCheckBox" name="searchAbstract" > 173 <property name="text" > 174 <string>Abstract</string> 175 </property> 176 </widget> 177 </item> 178 </layout> 151 179 </item> 152 180 <item> 153 <layout class="QVBoxLayout" name="verticalLayout_3"> 154 <item> 155 <widget class="QWidget" name="searchHead" native="true"> 156 <layout class="QFormLayout" name="searchHeadLayout"> 157 <property name="fieldGrowthPolicy"> 158 <enum>QFormLayout::AllNonFixedFieldsGrow</enum> 159 </property> 160 <item row="0" column="0"> 161 <widget class="QCheckBox" name="searchTitle"> 162 <property name="text"> 163 <string>Title</string> 164 </property> 165 </widget> 166 </item> 167 <item row="0" column="1"> 168 <layout class="QHBoxLayout" name="horizontalLayout"> 169 <item> 170 <widget class="QLineEdit" name="searchEdit"> 171 <property name="enabled"> 172 <bool>true</bool> 173 </property> 174 <property name="toolTip"> 175 <string>type a keyword to search</string> 176 </property> 177 </widget> 178 </item> 179 <item> 180 <widget class="QPushButton" name="searchButton"> 181 <property name="text"> 182 <string>Search</string> 183 </property> 184 <property name="checkable"> 185 <bool>false</bool> 186 </property> 187 <property name="autoDefault"> 188 <bool>true</bool> 189 </property> 190 <property name="default"> 191 <bool>true</bool> 192 </property> 193 <property name="flat"> 194 <bool>false</bool> 195 </property> 196 </widget> 197 </item> 198 </layout> 199 </item> 200 <item row="1" column="0"> 201 <widget class="QCheckBox" name="searchAbstract"> 202 <property name="text"> 203 <string>Abstract</string> 204 </property> 205 </widget> 206 </item> 207 </layout> 208 </widget> 209 </item> 210 <item> 211 <widget class="TreeView" name="searchTreeView"> 212 <property name="maximumSize"> 181 <layout class="QHBoxLayout" name="searchDayNavigatorHorizontalLayout" > 182 <item> 183 <spacer name="horizontalSpacer_2" > 184 <property name="orientation" > 185 <enum>Qt::Horizontal</enum> 186 </property> 187 <property name="sizeHint" stdset="0" > 188 <size> 189 <width>40</width> 190 <height>20</height> 191 </size> 192 </property> 193 </spacer> 194 </item> 195 <item> 196 <widget class="DayNavigatorWidget" native="1" name="searchDayNavigator" > 197 <property name="maximumSize" > 213 198 <size> 214 199 <width>16777215</width> … … 218 203 </widget> 219 204 </item> 220 </layout> 221 </item> 222 </layout> 223 </widget> 224 <widget class="QWidget" name="conferenceTab" > 225 <attribute name="title" > 205 <item> 206 <spacer name="horizontalSpacer" > 207 <property name="orientation" > 208 <enum>Qt::Horizontal</enum> 209 </property> 210 <property name="sizeHint" stdset="0" > 211 <size> 212 <width>40</width> 213 <height>20</height> 214 </size> 215 </property> 216 </spacer> 217 </item> 218 </layout> 219 </item> 220 <item> 221 <widget class="TreeView" name="searchTreeView" > 222 <property name="maximumSize" > 223 <size> 224 <width>16777215</width> 225 <height>16777215</height> 226 </size> 227 </property> 228 </widget> 229 </item> 230 </layout> 231 </widget> 232 <widget class="QWidget" name="roomsTab" > 233 <attribute name="title" > 234 <string>Rooms</string> 235 </attribute> 236 <layout class="QGridLayout" name="gridLayout_8" > 237 <item row="0" column="0" > 238 <layout class="QHBoxLayout" name="horizontalLayout_5" > 239 <property name="sizeConstraint" > 240 <enum>QLayout::SetDefaultConstraint</enum> 241 </property> 242 <item> 243 <widget class="DayNavigatorWidget" native="1" name="roomDayNavigator" /> 244 </item> 245 <item> 246 <widget class="TreeView" name="roomTreeView" > 247 <property name="maximumSize" > 248 <size> 249 <width>16777215</width> 250 <height>16777215</height> 251 </size> 252 </property> 253 </widget> 254 </item> 255 </layout> 256 </item> 257 </layout> 258 </widget> 259 <widget class="QWidget" name="conferenceTab" > 260 <attribute name="title" > 226 261 <string>Conference</string> 227 262 </attribute> … … 356 391 <x>0</x> 357 392 <y>0</y> 358 <width> 654</width>393 <width>935</width> 359 394 <height>26</height> 360 395 </rect> -
src/mvc/event.cpp
r7b70507 r7620de0 1 1 #include "event.h" 2 #include "room.h" 2 3 3 4 QString const Event::sTableName = QString("event"); … … 40 41 } 41 42 43 QList<Event> Event::getByDateAndRoom(const QDate& date, int conferenceId) 44 { 45 QSqlQuery query; 46 QString aliasEvent("E"); 47 QString aliasEventRoom("R"); 48 query.prepare(QString("SELECT %1 FROM %2 %3, %4 %5 WHERE %3.xid_conference = :conf AND %3.start >= :start AND %3.start < :end AND %3.id = R.xid_event ORDER BY %5.xid_room, %3.start").arg( 49 columnsForSelect(aliasEvent), Event::sTableName, aliasEvent, "EVENT_ROOM", aliasEventRoom)); 50 query.bindValue(":conf", conferenceId); 51 query.bindValue(":start", convertToDb(date, QVariant::DateTime)); 52 query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime)); 53 54 return load(query); 55 } 56 42 57 QList<Event> Event::nowEvents(int conferenceId, QString orderBy) 43 58 { … … 65 80 } 66 81 67 QList<Event> Event::getByTrack(int trackId)68 {69 QSqlQuery query;70 query.prepare(selectQuery() + QString("WHERE xid_track = :trackId ORDER BY start"));71 query.bindValue(":trackId", trackId);72 73 return load(query);74 }75 76 82 QString Event::room() const 77 83 { … … 87 93 else 88 94 return QString("not-available"); 95 } 96 97 int Event::roomId() const 98 { 99 QSqlQuery query; 100 query.prepare("SELECT xid_room FROM event_room WHERE xid_event = :id"); 101 query.bindValue(":id", id()); 102 if (!query.isActive()) 103 if (!query.exec()) 104 throw OrmSqlException(query.lastError().text()); 105 if (!query.next()) 106 throw OrmNoObjectException(); 107 return query.record().value("xid_room").toInt(); 89 108 } 90 109 -
src/mvc/event.h
r7b70507 r7620de0 27 27 static QList<Event> nowEvents(int conferenceId, QString orderBy); // get events scheduled NOW 28 28 static QList<Event> getByTrack(int id); 29 static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId); 29 30 public: 30 31 int id() const { return value("id").toInt(); } … … 45 46 // records from other tables associated with 'id' 46 47 QString room() const; 48 int roomId() const; 47 49 QStringList persons() const; 48 50 -
src/mvc/eventmodel.cpp
r7b70507 r7620de0 3 3 #include <conference.h> 4 4 #include <track.h> 5 #include <room.h> 5 6 6 7 const QString EventModel::COMMA_SEPARATOR = ", "; … … 74 75 } 75 76 76 void EventModel::createTrackGroupsNew() { 77 void EventModel::createRoomGroups() 78 { 77 79 mGroups.clear(); 78 80 mParents.clear(); … … 81 83 return; 82 84 } 83 QList<Track> trackList = Track::getAll(); 84 QList<Track>::iterator track = trackList.begin(); 85 while (track != trackList.end()) 86 { 87 QList<Event> eventList = Event::getByTrack(track->id()); 88 QList<Event>::iterator event = eventList.begin(); 89 while (event != eventList.end()) 90 { 91 //TODO korinpa: pokracuj 92 event++; 93 } 94 track++; 95 } 85 int roomId = mEvents.first().roomId(); 86 87 mGroups << EventModel::Group(Room::retrieveRoomName(roomId), 0); 88 int nextRoomId = roomId; 89 90 QList<Event>::iterator event = mEvents.begin(); 91 int i = 0; 92 while (event != mEvents.end()) 93 { 94 roomId = event->roomId(); 95 if (nextRoomId != roomId) 96 { 97 mGroups.last().mChildCount = i - mGroups.last().mFirstEventIndex; 98 mGroups << EventModel::Group(Room::retrieveRoomName(roomId), i); 99 nextRoomId = roomId; 100 } 101 mParents[event->id()] = mGroups.count() - 1; 102 event++; 103 i++; 104 } 105 mGroups.last().mChildCount = mEvents.count() - mGroups.last().mFirstEventIndex; 96 106 } 97 107 … … 235 245 { 236 246 clearModel(); 237 if (Conference::getAll().count())247 if (Conference::getAll().count()) 238 248 { 239 249 qDebug() << "Loading Conference Data (by Track): [" << Conference::getById(aConferenceId).title() << "] " << aDate; … … 241 251 } 242 252 createTrackGroups(); 253 } 254 255 void EventModel::loadEventsByRoom(const QDate &aDate, int aConferenceId) 256 { 257 clearModel(); 258 if (Conference::getAll().count()) 259 { 260 qDebug() << "Loading Conference Data (by Room): [" << Conference::getById(aConferenceId).title() << "] " << aDate; 261 mEvents = Event::getByDateAndRoom(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 262 } 263 createRoomGroups(); 243 264 } 244 265 -
src/mvc/eventmodel.h
r7b70507 r7620de0 19 19 void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB 20 20 void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB 21 void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Trackfrom the DB21 void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events sorted by Track id and Event start from the DB 22 22 int loadSearchResultEvents(const QDate &aDate, int aConferenceId); 23 23 void loadNowEvents(int aConferenceId); // loads Now events from the DB 24 void loadEventsByRoom(const QDate &aDate, int aConferenceId); 24 25 25 26 private: … … 44 45 void createTrackGroupsNew(); 45 46 void clearModel(); 47 void createRoomGroups(); 46 48 47 49 public slots: -
src/mvc/mvc.pro
r7b70507 r7620de0 26 26 delegate.h \ 27 27 eventmodel.h \ 28 treeview.h 28 treeview.h \ 29 room.h 29 30 SOURCES += event.cpp \ 30 31 conference.cpp \ … … 32 33 delegate.cpp \ 33 34 eventmodel.cpp \ 34 treeview.cpp 35 treeview.cpp \ 36 room.cpp -
src/mvc/track.cpp
r7b70507 r7620de0 7 7 8 8 #include "track.h" 9 #include <QSqlTableModel>10 9 11 10 QString const Track::sTableName = QString("track"); … … 16 15 << QSqlField("id", QVariant::Int) 17 16 << QSqlField(NAME, QVariant::String)); 18 19 //QMap<int, Track> Track::mIdToTrack;20 17 21 18 class TrackInsertException : OrmSqlException -
src/mvc/track.h
r7b70507 r7620de0 15 15 public: 16 16 static const QSqlRecord sColumns; 17 static const QSqlRecord sInsertColumns;18 17 static QString const sTableName; 19 18 static const int sTableColCount; 20 19 static const QString NAME; 21 20 public: 22 static QMap<int, Track> mIdToTrack;23 public:24 int insert();25 21 int id() const { return value("id").toInt(); } 26 22 void setId(int id) { setValue("id", id); } 27 23 QString name() const { return value("name").toString(); } 28 24 void setName(const QString & type) { setValue("name", type); } 25 int insert(); 29 26 public: 30 27 static QList<Track> getAll();
Note: See TracChangeset
for help on using the changeset viewer.