Ignore:
Timestamp:
01/26/10 13:51:56 (13 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
830f102
Parents:
01df23f
Message:

import schedule dialog

  • changed to widget
  • moved to 'conference' tab
File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/gui/importschedulewidget.cpp

    r01df23f rc15be10  
    1 #include "importscheduledialog.h"
     1#include "importschedulewidget.h"
    22
    33#include <schedulexmlparser.h>
     
    99#include <QDebug>
    1010
    11 ImportScheduleDialog::ImportScheduleDialog(SqlEngine *aSqlEngine, QWidget *aParent)
    12     : QDialog(aParent)
    13     , mSqlEngine(aSqlEngine)
     11ImportScheduleWidget::ImportScheduleWidget(QWidget *aParent)
     12    : QWidget(aParent)
     13    , mSqlEngine(NULL)
    1414{
    1515    setupUi(this);
     
    2525}
    2626
    27 ImportScheduleDialog::~ImportScheduleDialog()
     27ImportScheduleWidget::~ImportScheduleWidget()
    2828{
    2929    if(mXmlParser)
     
    3434}
    3535
    36 void ImportScheduleDialog::showParsingProgress(int progress)
     36void ImportScheduleWidget::setSqlEngine(SqlEngine *aSqlEngine)
     37{
     38    Q_ASSERT(aSqlEngine != NULL);
     39
     40    mSqlEngine = aSqlEngine;
     41}
     42
     43void ImportScheduleWidget::showParsingProgress(int progress)
    3744{
    3845    progressBar->setValue(progress);
    3946}
    4047
    41 void ImportScheduleDialog::searchSchedule()
     48void ImportScheduleWidget::searchSchedule()
    4249{
     50    Q_ASSERT(mSqlEngine != NULL);
     51
    4352    mScheduleFileName = QFileDialog::getOpenFileName(this, tr("Select Conference Schedule"), QDir::homePath(), tr("Schedule Files (*.xml)"));
    4453    if(QFile::exists(mScheduleFileName))
     
    5160}
    5261
    53 void ImportScheduleDialog::importSchedule()
     62void ImportScheduleWidget::importSchedule()
    5463{
     64    if(!mSqlEngine)
     65    {
     66        qDebug() << "ImportScheduleWidget::importSchedule(): sqlEngine not set";
     67        return;
     68    }
     69
    5570    QFile file(mScheduleFileName);
    5671    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
     
    6176
    6277    QByteArray data = file.readAll();
    63     if(mSqlEngine)
    64     {
    65         progressBar->show();
    66         mXmlParser->parseData(data,mSqlEngine);
    67         close();
    68     }
     78    progressBar->show();
     79    int confId = mXmlParser->parseData(data,mSqlEngine);
     80
     81    // hide stuff
     82    import->setEnabled(false);
     83    progressBar->hide();
     84
     85    emit(scheduleImported(confId));
    6986}
    7087
Note: See TracChangeset for help on using the changeset viewer.