Changeset 0bb39f5 in confclerk_git
- Timestamp:
- 01/27/10 16:31:10 (13 years ago)
- Branches:
- master, qt5
- Children:
- a790a90
- Parents:
- 07ae23a
- Location:
- src
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/app/app.pro
r07ae23a r0bb39f5 17 17 } 18 18 19 SOURCES += main.cpp \ 20 appsettings.cpp 21 22 HEADERS += appsettings.h 19 SOURCES += main.cpp 23 20 24 21 RESOURCES += ../icons.qrc \ -
src/gui/alarmdialog.cpp
r07ae23a r0bb39f5 1 1 #include "alarmdialog.h" 2 #include < appsettings.h>2 #include <conference.h> 3 3 4 4 #include <QApplication> … … 47 47 try 48 48 { 49 Event event = Event::getById(mEventId, AppSettings::confId());49 Event event = Event::getById(mEventId,Conference::activeConference()); 50 50 titleStr = "Event alarm"; 51 51 messageStr = event.title(); … … 89 89 try 90 90 { 91 Event event = Event::getById(mEventId, AppSettings::confId());91 Event event = Event::getById(mEventId,Conference::activeConference()); 92 92 event.setHasAlarm(false); 93 93 event.update("alarm"); -
src/gui/eventdialog.cpp
r07ae23a r0bb39f5 1 1 #include "eventdialog.h" 2 #include < appsettings.h>2 #include <conference.h> 3 3 4 4 #include <QScrollBar> … … 18 18 #endif 19 19 20 Event event = Event::getById(mEventId, AppSettings::confId());20 Event event = Event::getById(mEventId,Conference::activeConference()); 21 21 22 22 title->setText(event.title()); … … 42 42 void EventDialog::favouriteClicked() 43 43 { 44 Event event = Event::getById(mEventId, AppSettings::confId());44 Event event = Event::getById(mEventId,Conference::activeConference()); 45 45 46 46 if(event.isFavourite()) … … 65 65 void EventDialog::alarmClicked() 66 66 { 67 Event event = Event::getById(mEventId, AppSettings::confId());67 Event event = Event::getById(mEventId,Conference::activeConference()); 68 68 69 69 if(event.hasAlarm()) -
src/gui/favtabcontainer.cpp
r07ae23a r0bb39f5 1 /*2 * favtabcontainer.cpp3 *4 * Created on: Jan 27, 20105 * Author: maemo6 */7 1 8 2 #include "favtabcontainer.h" … … 22 16 // we need to reload favourites, because some favourite could be deleted 23 17 //static_cast<EventModel*>(favTreeView->model())->updateModel(aEventId); 24 QDate aStartDate = Conference::getById(AppSettings::confId()).start(); 25 QDate aEndDate = Conference::getById(AppSettings::confId()).end(); 26 dayNavigator->setDates(aStartDate, aEndDate); 27 updateTreeView( Conference::getById(AppSettings::confId()).start() ); 18 int confId = Conference::activeConference(); 19 QDate startDate = Conference::getById(confId).start(); 20 QDate endDate = Conference::getById(confId).end(); 21 dayNavigator->setDates(startDate, endDate); 22 updateTreeView( Conference::getById(confId).start() ); 28 23 } 24 -
src/gui/mainwindow.cpp
r07ae23a r0bb39f5 1 1 #include "mainwindow.h" 2 #include <appsettings.h>3 2 4 3 #include <QTreeView> … … 28 27 setupUi(this); 29 28 30 // Sanity check for existence of any Conference in the DB 31 // it AppSettings::confId() is 0, but there are any Conference(s) in the DB 32 // set the confId in the AppSettings for the ID of the first conference in the DB 29 int confId = Conference::activeConference(); 30 33 31 QList<Conference> confs = Conference::getAll(); 34 if( !confs.count()) // no conference(s) in the DB32 if(confs.count()) 35 33 { 36 AppSettings::setConfId(0); // no conference in the DB37 }38 else39 {40 if(AppSettings::confId() == 0)41 AppSettings::setConfId(confs[0].id());42 43 34 setWindowTitle(confs[0].title()); 44 35 } … … 62 53 if(Conference::getAll().count()) // no conference(s) in the DB 63 54 { 64 QDate startDate = Conference::getById( AppSettings::confId()).start();65 QDate endDate = Conference::getById( AppSettings::confId()).end();55 QDate startDate = Conference::getById(confId).start(); 56 QDate endDate = Conference::getById(confId).end(); 66 57 // 67 58 dayTabContainer->setDates(startDate, endDate); … … 71 62 searchTabContainer->setDates(startDate, endDate); 72 63 // 73 conferenceTitle->setText(Conference::getById( AppSettings::confId()).title());74 conferenceSubtitle->setText(Conference::getById( AppSettings::confId()).subtitle());75 conferenceWhere->setText(Conference::getById( AppSettings::confId()).city() + ", " + Conference::getById(AppSettings::confId()).venue());64 conferenceTitle->setText(Conference::getById(confId).title()); 65 conferenceSubtitle->setText(Conference::getById(confId).subtitle()); 66 conferenceWhere->setText(Conference::getById(confId).city() + ", " + Conference::getById(confId).venue()); 76 67 conferenceWhen->setText( 77 Conference::getById( AppSettings::confId()).start().toString("dd-MM-yyyy")68 Conference::getById(confId).start().toString("dd-MM-yyyy") 78 69 + ", " + 79 Conference::getById( AppSettings::confId()).end().toString("dd-MM-yyyy"));70 Conference::getById(confId).end().toString("dd-MM-yyyy")); 80 71 } 81 72 … … 99 90 100 91 QList<Conference> confs = Conference::getAll(); 101 if( !confs.count()) // no conference(s) in the DB92 if(confs.count()) 102 93 { 103 AppSettings::setConfId(0); // no conference in the DB104 }105 else106 {107 if(AppSettings::confId() == 0)108 AppSettings::setConfId(confs[0].id());109 110 94 // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates 111 QDate startDate = Conference::getById( AppSettings::confId()).start();112 QDate endDate = Conference::getById( AppSettings::confId()).end();95 QDate startDate = Conference::getById(Conference::activeConference()).start(); 96 QDate endDate = Conference::getById(Conference::activeConference()).end(); 113 97 dayTabContainer->setDates(startDate, endDate); 114 98 tracksTabContainer->setDates(startDate, endDate); -
src/gui/searchtabcontainer.cpp
r07ae23a r0bb39f5 1 2 #include <appsettings.h>3 1 4 2 #include "searchtabcontainer.h" … … 65 63 QString keyword = searchHeader->searchEdit->text().replace( QString("%"), QString("\\%") ); 66 64 qDebug() << "\nKeyword to search: " << keyword; 67 SqlEngine::searchEvent( AppSettings::confId(), columns, keyword );68 65 69 QDate startDate = Conference::getById(AppSettings::confId()).start(); 70 QDate endDate = Conference::getById(AppSettings::confId()).end(); 66 int confId = Conference::activeConference(); 67 SqlEngine::searchEvent( confId, columns, keyword ); 68 69 QDate startDate = Conference::getById(confId).start(); 70 QDate endDate = Conference::getById(confId).end(); 71 71 dayNavigator->setDates(startDate, endDate); 72 updateTreeView( Conference::getById( AppSettings::confId()).start() );72 updateTreeView( Conference::getById(confId).start() ); 73 73 } 74 74 -
src/gui/tabcontainer.cpp
r07ae23a r0bb39f5 36 36 else 37 37 { 38 QDate aStartDate = Conference::getById( AppSettings::confId()).start();39 QDate aEndDate = Conference::getById( AppSettings::confId()).end();38 QDate aStartDate = Conference::getById(Conference::activeConference()).start(); 39 QDate aEndDate = Conference::getById(Conference::activeConference()).end(); 40 40 dayNavigator->setDates(aStartDate, aEndDate); 41 41 } … … 45 45 { 46 46 dayNavigator->show(); 47 loadEvents( aDate, AppSettings::confId() );47 loadEvents( aDate, Conference::activeConference() ); 48 48 treeView->reset(); 49 49 } … … 102 102 } 103 103 104 105 -
src/gui/tabcontainer.h
r07ae23a r0bb39f5 5 5 #include "ui_tabcontainer.h" 6 6 7 #include < appsettings.h>7 #include <conference.h> 8 8 #include <sqlengine.h> 9 9 #include <conference.h> -
src/mvc/conference.cpp
r07ae23a r0bb39f5 11 11 << QSqlField("days", QVariant::Int) 12 12 << QSqlField("day_change", QVariant::Int) 13 << QSqlField("timeslot_duration", QVariant::Int)); 13 << QSqlField("timeslot_duration", QVariant::Int) 14 << QSqlField("active", QVariant::Bool)); 14 15 15 16 QString const Conference::sTableName = QString("conference"); … … 30 31 } 31 32 33 int Conference::activeConference() 34 { 35 QSqlQuery query("SELECT id FROM conference WHERE active = 1"); 36 query.exec(); 37 38 QList<int> activeConfs; 39 while(query.next()) 40 activeConfs.append(query.record().value("id").toInt()); 41 42 if(activeConfs.count()==0) // no active DB 43 return 1; 44 else // even if there are more active confs, the first from the list is confidered active 45 return activeConfs[0]; 46 } 47 -
src/mvc/conference.h
r07ae23a r0bb39f5 17 17 static Conference getById(int id); 18 18 static QList<Conference> getAll(); 19 static int activeConference(); 19 20 20 21 public: … … 29 30 int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00 30 31 int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds 32 bool isActive() const { return value("active").toBool(); } 31 33 32 34 void setId(int id) { setValue("id", id); } … … 35 37 void setVenue(const QString& venue) { setValue("venue", venue); } 36 38 void setCity(const QString& city) { setValue("city", city); } 37 //void setStart(const QDate& start) { setValue("start", QDateTime(start)); }38 39 void setStart(const QDate& start) { setValue("start", start); } 39 //void setEnd(const QDate& end) { setValue("end", QDateTime(end)); }40 40 void setEnd(const QDate& end) { setValue("end", end); } 41 41 void setDays(int days) { setValue("days", days); } 42 42 void setDayChange(int dayChange) { setValue("day_change", dayChange); } 43 43 void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); } 44 void setActive(bool active) { setValue("active", (int)((active))); } 44 45 }; 45 46 -
src/mvc/eventmodel.cpp
r07ae23a r0bb39f5 1 1 #include "eventmodel.h" 2 #include <appsettings.h>3 2 #include <conference.h> 4 3 #include <track.h> … … 281 280 { 282 281 if(mEvents[i].id() == aEventId) 283 mEvents[i] = Event::getById(aEventId, AppSettings::confId());282 mEvents[i] = Event::getById(aEventId,Conference::activeConference()); 284 283 } 285 284 -
src/sql/sqlengine.cpp
r07ae23a r0bb39f5 7 7 8 8 #include <QDir> 9 #include <appsettings.h>10 9 #include "sqlengine.h" 11 10 #include <track.h> … … 95 94 .arg(-QTime::fromString(aConference["day_change"],TIME_FORMAT).secsTo(QTime(0,0))) \ 96 95 .arg(-QTime::fromString(aConference["timeslot_duration"],TIME_FORMAT).secsTo(QTime(0,0))); 97 98 QString query = QString("INSERT INTO CONFERENCE (title,subtitle,venue,city,start,end,days,day_change,timeslot_duration) VALUES (%1)").arg(values); 96 values.append(QString(", '%1'").arg(confsList.count()>0?"0":"1")); 97 98 QString query = QString("INSERT INTO CONFERENCE (title,subtitle,venue,city,start,end,days,day_change,timeslot_duration,active) VALUES (%1)").arg(values); 99 99 QSqlQuery result (query, db); 100 100 aConference["id"] = result.lastInsertId().toString(); // 'id' is assigned automatically 101 102 if(!AppSettings::confId()) // default conf Id isn't set yet => set it up103 AppSettings::setConfId(confId);104 101 } 105 102 } … … 241 238 "days INTEGER, " 242 239 "day_change INTEGER, " 243 "timeslot_duration INTEGER);"); 240 "timeslot_duration INTEGER, " 241 "active INTEGER DEFAULT 0);"); 244 242 245 243 query.exec("CREATE TABLE TRACK ( "
Note: See TracChangeset
for help on using the changeset viewer.