Ignore:
Timestamp:
01/21/10 19:23:23 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
1735f55
Parents:
76cde75
Message:

added 'Conference' tab - to list conference details

  • implemented AppSettings? for storing Application settings
    • stored conference ID
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r76cde75 r30e2bdf  
    11#include "mainwindow.h"
     2#include <appsettings.h>
    23
    34#include <QTreeView>
     
    2021#include "mapwindow.h"
    2122
    22 
    23 const int confId = 1;
    24 
    2523MainWindow::MainWindow(int aEventId, QWidget *aParent)
    2624    : QMainWindow(aParent)
    2725{
    2826    setupUi(this);
     27
     28    // TODO: conference ID should be assigned based on actual data in the DB
     29    // for testing only
     30    AppSettings::setConfId(1);
    2931
    3032    // connect Menu actions
     
    6264    favTreeView->setItemDelegate(new Delegate(favTreeView));
    6365
    64     //ACTIVITIES View
     66    // TRACKS View
    6567    trackTreeView->setHeaderHidden(true);
    6668    trackTreeView->setRootIsDecorated(false);
     
    99101    if(Conference::getAll().count()) // no conference(s) in the DB
    100102    {
    101         static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
     103        static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(AppSettings::confId()).start(),AppSettings::confId());
    102104        favTreeView->reset();
    103105    }
     
    110112    else
    111113    {
    112         QDate aStartDate = Conference::getById(confId).start();
    113         QDate aEndDate = Conference::getById(confId).end();
     114        QDate aStartDate = Conference::getById(AppSettings::confId()).start();
     115        QDate aEndDate = Conference::getById(AppSettings::confId()).end();
    114116        dayNavigator->setDates(aStartDate, aEndDate);
    115117        trackDayNavigator->setDates(aStartDate, aEndDate);
    116118        favouriteDayNavigator->setDates(aStartDate, aEndDate);
    117119        searchDayNavigator->setDates(aStartDate, aEndDate);
     120        //
     121        conferenceTitle->setText(Conference::getById(AppSettings::confId()).title());
     122        conferenceSubtitle->setText(Conference::getById(AppSettings::confId()).subtitle());
     123        conferenceWhere->setText(Conference::getById(AppSettings::confId()).city() + ", " + Conference::getById(AppSettings::confId()).venue());
     124        conferenceWhen->setText(
     125                Conference::getById(AppSettings::confId()).start().toString("dd-MM-yyyy")
     126                + ", " +
     127                Conference::getById(AppSettings::confId()).end().toString("dd-MM-yyyy"));
    118128    }
    119129
     
    154164    {
    155165        // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates
    156         QDate aStartDate = Conference::getById(confId).start();
    157         QDate aEndDate = Conference::getById(confId).end();
     166        QDate aStartDate = Conference::getById(AppSettings::confId()).start();
     167        QDate aEndDate = Conference::getById(AppSettings::confId()).end();
    158168        dayNavigator->setDates(aStartDate, aEndDate);
    159169        //update activity map
     
    173183void MainWindow::updateDayView(const QDate &aDate)
    174184{
    175     static_cast<EventModel*>(dayTreeView->model())->loadEvents(aDate,confId);
     185    static_cast<EventModel*>(dayTreeView->model())->loadEvents(aDate,AppSettings::confId());
    176186    dayTreeView->reset();
    177187    dayNavigator->show();
     
    211221void MainWindow::updateTracksView(const QDate &aDate)
    212222{
    213     static_cast<EventModel*>(trackTreeView->model())->loadEventsByTrack(aDate, confId);
     223    static_cast<EventModel*>(trackTreeView->model())->loadEventsByTrack(aDate, AppSettings::confId());
    214224    trackTreeView->reset();
    215225    trackDayNavigator->show();
     
    218228void MainWindow::updateFavouritesView(const QDate &aDate)
    219229{
    220     static_cast<EventModel*>(favTreeView->model())->loadFavEvents(aDate,confId);
     230    static_cast<EventModel*>(favTreeView->model())->loadFavEvents(aDate,AppSettings::confId());
    221231    favTreeView->reset();
    222232    favouriteDayNavigator->show();
     
    226236{
    227237    searchTreeView->reset();
    228     int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,confId);
     238    int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId());
    229239    if( eventsCount ){
    230240        searchDayNavigator->show();
     
    277287        columns.append( "abstract" );
    278288
    279     mSqlEngine->searchEvent( confId, columns, searchEdit->text() );
    280     updateSearchView( Conference::getById(confId).start() );
     289    mSqlEngine->searchEvent( AppSettings::confId(), columns, searchEdit->text() );
     290    updateSearchView( Conference::getById(AppSettings::confId()).start() );
    281291}
    282292
    283293void MainWindow::displayWarning(const QModelIndex &aIndex)
    284294{
     295    Q_UNUSED(aIndex);
     296
    285297    QMessageBox::warning(
    286298    this,
     
    288300    tr("This event happens at the same time than another one of your favourites.") );
    289301}
     302
Note: See TracChangeset for help on using the changeset viewer.