Seafood/mainwindow.cpp
author John Kern <johnk@symbian.org>
Wed, 31 Mar 2010 16:09:36 -0700
changeset 11 f3dbeee07821
parent 10 79eeacfd15ff
child 14 a16afe3df8c9
permissions -rwxr-xr-x
instrumented with debugging output
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     1
#include <QFile>
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     2
#include <QIcon>
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     3
#include <QListWidget>
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     4
#include <QMessageBox>
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
     5
#include <QStackedWidget>
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     6
#include <QTableWidget>
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     7
#include <QDesktopServices>
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
     8
#include <QWebView>
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     9
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    10
#include "Fishes.h"
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    11
#include "mainwindow.h"
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    12
#include "ui_mainwindow.h"
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    13
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    14
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    15
MainWindow::MainWindow(QWidget *parent) :
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    16
    QMainWindow(parent),
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    17
    ui(new Ui::MainWindow)
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    18
{
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    19
    ui->setupUi(this);
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    20
    setContextMenuPolicy(Qt::NoContextMenu);
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    21
    this->fishDb = new Fishes(this);
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    22
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    23
    this->stackedWidget = new QStackedWidget;
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    24
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    25
    // lists of fish
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    26
    this->tabWidget = new QTabWidget;
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    27
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    28
    this->bestList = new QListWidget;
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    29
    this->bestList->addItems(this->fishDb->GetBest());
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    30
    this->tabWidget->addTab(this->bestList, "best");
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    31
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    32
    this->okList = new QListWidget;
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    33
    this->okList->addItems(this->fishDb->GetOK());
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    34
    this->tabWidget->addTab(this->okList, "ok");
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    35
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    36
    this->worstList = new QListWidget;
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    37
    this->worstList->addItems(this->fishDb->GetWorst());
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    38
    this->tabWidget->addTab(this->worstList, "worst");
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    39
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    40
    this->index = EBestList;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    41
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    42
    connect(this->tabWidget, SIGNAL(currentChanged(int)),
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    43
            this, SLOT(setCurrentList(int)));
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    44
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    45
    this->stackedWidget->addWidget(tabWidget); // associated with EListPage
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    46
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    47
    // Eco details
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    48
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    49
    this->ecoDetails = new QWebView;
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    50
    this->ecoDetails->setHtml("<html><title>Eco Details</title><ul><li>not yet implemented</li></ul></html>");
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    51
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    52
    this->stackedWidget->addWidget(this->ecoDetails); // associated with EEcoPage
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    53
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    54
    // Nutrition page
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    55
    // this->model = new QSqlQueryModel;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    56
    // this->model->
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    57
    this->stackedWidget->addWidget(ui->centralWidget); // associated with ENutritionPage
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    58
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    59
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    60
    setCentralWidget(stackedWidget);
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    61
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    62
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    63
}
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    64
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    65
MainWindow::~MainWindow()
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    66
{
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    67
    delete ui;
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    68
}
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    69
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    70
void MainWindow::createMenus()
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    71
    {
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    72
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    73
        ecoAction = new QAction(tr("&eco details"),this);
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    74
        menuBar()->addAction(ecoAction);
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    75
        connect(ecoAction, SIGNAL(triggered()),this, SLOT(displayEcoDetails()));
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    76
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    77
        nuAction = new QAction(tr("&Nutrition"),this);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    78
        menuBar()->addAction(nuAction);
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    79
        connect(nuAction, SIGNAL(triggered()),this, SLOT(displayNutrition()));
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    80
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    81
        fishesAction = new QAction(tr("&List Fishes"),this);
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    82
        menuBar()->addAction(fishesAction);
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    83
        connect(fishesAction, SIGNAL(triggered()),this, SLOT(displayList()));
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    84
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    85
        verAction = new QAction(tr("&Version"),this);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    86
        menuBar()->addAction(verAction);
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
    87
        connect(verAction, SIGNAL(triggered()),this, SLOT(displayPath()));
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    88
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    89
        exitAction = new QAction(tr("&Exit"),this);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    90
        menuBar()->addAction(exitAction);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    91
        connect(exitAction, SIGNAL(triggered()),this, SLOT(close()));
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    92
    }
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    93
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    94
void MainWindow::displayVersion()
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    95
{
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
    96
    QMessageBox::information(this,"Qt Version", qVersion());
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    97
}
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    98
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    99
void MainWindow::displayNutrition()
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   100
{
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   101
    this->stackedWidget->setCurrentIndex(MainWindow::ENutritionPage);
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   102
}
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   103
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   104
void MainWindow::displayEcoDetails()
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   105
{
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   106
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   107
    QString selectedName;
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   108
    QListWidgetItem *item=NULL;
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   109
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   110
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   111
    switch (this->index)
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   112
    {
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   113
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   114
    case EBestList:
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   115
        item = this->bestList->currentItem();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   116
        if (item)
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   117
        {
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   118
            selectedName = item->text();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   119
        }
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   120
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   121
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   122
    case EOkList:
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   123
        item = this->okList->currentItem();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   124
        if (item) {
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   125
            selectedName = item->text();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   126
        }
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   127
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   128
    case EWorstList:
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   129
        item = this->worstList->currentItem();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   130
        if (item) {
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   131
            selectedName = item->text();
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   132
        }
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   133
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   134
    }
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   135
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   136
    if (!item) {
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   137
        QMessageBox::information(this,"warning","select an item from list." );
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   138
    } else {
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   139
        this->ecoDetails->setHtml( this->fishDb->getEcoDetails(selectedName));
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   140
        this->stackedWidget->setCurrentIndex(MainWindow::EEcoPage);
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   141
    }
7
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   142
}
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   143
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   144
void MainWindow::displayList()
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   145
{
John Kern <johnk@symbian.org>
parents: 3
diff changeset
   146
    this->stackedWidget->setCurrentIndex(MainWindow::EListPage);
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   147
}
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   148
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   149
void MainWindow::displayPath()
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   150
{
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 10
diff changeset
   151
    QMessageBox::information(this, "db Error",this->fishDb->GetDbErr());
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   152
}
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   153
10
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   154
void MainWindow::setCurrentList(int l)
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   155
{
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   156
    switch (l)
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   157
    {
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   158
    case 0:
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   159
        this->index = EBestList;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   160
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   161
    case 1:
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   162
        this->index = EOkList;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   163
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   164
    case 2:
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   165
        this->index = EWorstList;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   166
        break;
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   167
    }
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   168
}
79eeacfd15ff implement eco details with webview
User@User-PC.domain_not_set.invalid
parents: 7
diff changeset
   169
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   170
void MainWindow::changeEvent(QEvent *e)
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   171
{
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   172
    QMainWindow::changeEvent(e);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   173
    switch (e->type()) {
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   174
    case QEvent::LanguageChange:
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   175
        ui->retranslateUi(this);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   176
        break;
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   177
    default:
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   178
        break;
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   179
    }
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
   180
}