author | Sebastian Brannstrom <sebastianb@symbian.org> |
Mon, 23 Aug 2010 17:07:32 +0100 | |
changeset 37 | 1ced6e446fd4 |
parent 34 | 93c5a58496b6 |
permissions | -rwxr-xr-x |
23 | 1 |
#include <QComboBox> |
30 | 2 |
#include <QMenuBar> |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
3 |
#include <QMessageBox> |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
4 |
|
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
5 |
#include <QDebug> |
23 | 6 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
7 |
#include "mainwindow.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
8 |
#include "ui_mainwindow.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
9 |
#include "contactsengine.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
10 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
11 |
MainWindow::MainWindow(QWidget *parent) : |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
12 |
QMainWindow(parent), |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
13 |
ui(new Ui::MainWindow) |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
14 |
{ |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
15 |
ui->setupUi(this); |
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
16 |
this->createMenus(); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
17 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
18 |
this->ce = new ContactsEngine(this); |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
19 |
|
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
20 |
connect(this->ce, SIGNAL(errorOccurred(QString)), |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
21 |
this,SLOT(errorOccurred(QString))); |
23 | 22 |
|
23 |
connect(ui->comboBox, SIGNAL( activated ( const QString & )), |
|
24 |
this->ce, SLOT(setManager(const QString &) )); |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
25 |
|
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
26 |
this->ce->createManager(); |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
27 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
28 |
ui->comboBox->addItems(this->ce->dataSources()); |
23 | 29 |
ui->listView->setModel(this->ce); |
30 | 30 |
|
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
31 |
this->details = new DetailsGV(this,ui->graphicsView); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
32 |
connect(this->details,SIGNAL(closeMe()),this,SLOT(close())); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
33 |
connect(this->details,SIGNAL(backToList()),this, SLOT(displayList())); |
37
1ced6e446fd4
Major contribution: Connected clicked signal from listbox to displayDetails slot
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
34
diff
changeset
|
34 |
connect(ui->listView, SIGNAL(clicked(QModelIndex)),this, SLOT(displayDetails())); |
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
35 |
ui->stackedWidget->setCurrentIndex(MainWindow::EListPage); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
36 |
|
30 | 37 |
} |
38 |
||
39 |
void MainWindow::createMenus() |
|
40 |
{ |
|
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
41 |
detailsAction = new QAction(tr("&Details"),this); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
42 |
menuBar()->addAction(detailsAction); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
43 |
connect(detailsAction, SIGNAL(triggered()),this, SLOT(displayDetails())); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
44 |
|
30 | 45 |
verAction = new QAction(tr("&Version"),this); |
46 |
menuBar()->addAction(verAction); |
|
47 |
connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion())); |
|
48 |
||
49 |
exitAction = new QAction(tr("&Exit"),this); |
|
50 |
menuBar()->addAction(exitAction); |
|
51 |
connect(exitAction, SIGNAL(triggered()),this, SLOT(close())); |
|
52 |
} |
|
53 |
||
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
54 |
void MainWindow::displayDetails() |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
55 |
{ |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
56 |
ui->stackedWidget->setCurrentIndex(MainWindow::EDetailsGV); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
57 |
} |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
58 |
|
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
59 |
void MainWindow::displayList() |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
60 |
{ |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
61 |
ui->stackedWidget->setCurrentIndex(MainWindow::EListPage); |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
62 |
} |
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
30
diff
changeset
|
63 |
|
30 | 64 |
void MainWindow::displayVersion() |
65 |
{ |
|
66 |
QMessageBox::information(this,"Qt Version", qVersion()); |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
67 |
} |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
68 |
|
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
69 |
void MainWindow::errorOccurred(QString errMsg) |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
70 |
{ |
30 | 71 |
QMessageBox::information(this,"Err Routed",errMsg); |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
72 |
qDebug() << errMsg << endl; |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
73 |
} |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
74 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
75 |
MainWindow::~MainWindow() |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
76 |
{ |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
77 |
delete ui; |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
78 |
} |