Changeset 61346c9 in confclerk_git for src/gui


Ignore:
Timestamp:
09/04/12 23:57:13 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
1f12b6b
Parents:
8d6798d
Message:

Restructured the SqlEngine?. Not yet finished (see "TODO" in the code).

Location:
src/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r8d6798d r61346c9  
    5151const QString PROXY_PASSWD;
    5252
    53 MainWindow::MainWindow(int aEventId, QWidget *aParent)
    54     : QMainWindow(aParent)
    55     , conferenceModel(new ConferenceModel(this))
    56     , mXmlParser(new ScheduleXmlParser(this))
    57     , mNetworkAccessManager(new QNetworkAccessManager(this))
    58 {
     53MainWindow::MainWindow(int aEventId, QWidget *aParent): QMainWindow(aParent) {
    5954    setupUi(this);
     55
     56    // Open database
     57    sqlEngine = new SqlEngine(this);
     58    searchTabContainer->setSqlEngine(sqlEngine);
     59    connect(sqlEngine, SIGNAL(dbError(QString)), this, SLOT(showError(QString)));
     60    sqlEngine->open();
     61    sqlEngine->createOrUpdateDbSchema();
     62
     63    conferenceModel = new ConferenceModel(this);
     64    mXmlParser = new ScheduleXmlParser(sqlEngine, this);
     65    mNetworkAccessManager = new QNetworkAccessManager(this);
    6066
    6167    saved_title = windowTitle();
     
    287293    setWindowTitle(saved_title);
    288294}
     295
     296
     297void MainWindow::showError(const QString& message) {
     298    error_message(message);
     299}
     300
    289301
    290302void MainWindow::on_settingsAction_triggered()
     
    388400}
    389401
    390 void MainWindow::removeConference(int id)
    391 {
    392     Conference::deleteConference(id);
     402
     403void MainWindow::removeConference(int id) {
     404    sqlEngine->deleteConference(id);
    393405    conferenceModel->conferenceRemoved();
    394 
    395406    emit conferenceRemoved();
    396407}
    397408
    398 void MainWindow::changeConferenceUrl(int id, const QString& url)
    399 {
     409
     410void MainWindow::changeConferenceUrl(int id, const QString& url) {
    400411    Conference::getById(id).setUrl(url);
    401412}
  • src/gui/mainwindow.h

    r8d6798d r61346c9  
    6262    void useConference(int id);
    6363    void unsetConference();
     64
     65    void showError(const QString& message);
    6466private:
    6567    void fillAndShowConferenceHeader();
     
    6971
    7072    QString saved_title;
     73    SqlEngine* sqlEngine;
    7174    ConferenceModel* conferenceModel;
    7275    ScheduleXmlParser *mXmlParser;
  • src/gui/searchtabcontainer.cpp

    r8d6798d r61346c9  
    2323#include <QMessageBox>
    2424
    25 SearchTabContainer::SearchTabContainer(QWidget *aParent) : TabContainer( aParent )
    26 {
     25SearchTabContainer::SearchTabContainer(QWidget *aParent): TabContainer(aParent), sqlEngine(0) {
    2726    header = new SearchHead(this);
    2827    header->setObjectName(QString::fromUtf8("header"));
     
    5958
    6059void SearchTabContainer::searchButtonClicked() {
     60    if (!sqlEngine) return;
     61
    6162    QHash<QString,QString> columns;
    6263
     
    7980    Conference conf = Conference::getById(confId);
    8081
    81     SqlEngine::searchEvent( confId, columns, keyword );
     82    sqlEngine->searchEvent( confId, columns, keyword );
    8283
    8384    int nrofFounds = 0;
  • src/gui/searchtabcontainer.h

    r8d6798d r61346c9  
    2626#include "tabcontainer.h"
    2727#include "searchhead.h"
     28#include "sqlengine.h"
    2829
    2930class SearchTabContainer: public TabContainer {
    3031    Q_OBJECT
     32private:
     33    SqlEngine* sqlEngine;
    3134public:
    3235    SearchTabContainer(QWidget *aParent);
    3336    virtual ~SearchTabContainer() {}
     37    void setSqlEngine(SqlEngine* sqlEngine) {this->sqlEngine = sqlEngine;}
    3438    bool searchDialogIsVisible() const;
    3539    int searchResultCount(const QDate& date) const; ///< returns the number of events found on that specific date
Note: See TracChangeset for help on using the changeset viewer.