11 MainWindow::MainWindow(QWidget *parent) : |
11 MainWindow::MainWindow(QWidget *parent) : |
12 QMainWindow(parent), |
12 QMainWindow(parent), |
13 ui(new Ui::MainWindow) |
13 ui(new Ui::MainWindow) |
14 { |
14 { |
15 ui->setupUi(this); |
15 ui->setupUi(this); |
|
16 this->createMenus(); |
|
17 |
16 this->ce = new ContactsEngine(this); |
18 this->ce = new ContactsEngine(this); |
17 |
19 |
18 connect(this->ce, SIGNAL(errorOccurred(QString)), |
20 connect(this->ce, SIGNAL(errorOccurred(QString)), |
19 this,SLOT(errorOccurred(QString))); |
21 this,SLOT(errorOccurred(QString))); |
20 |
22 |
24 this->ce->createManager(); |
26 this->ce->createManager(); |
25 |
27 |
26 ui->comboBox->addItems(this->ce->dataSources()); |
28 ui->comboBox->addItems(this->ce->dataSources()); |
27 ui->listView->setModel(this->ce); |
29 ui->listView->setModel(this->ce); |
28 |
30 |
29 this->createMenus(); |
31 this->details = new DetailsGV(this,ui->graphicsView); |
|
32 connect(this->details,SIGNAL(closeMe()),this,SLOT(close())); |
|
33 connect(this->details,SIGNAL(backToList()),this, SLOT(displayList())); |
|
34 |
|
35 ui->stackedWidget->setCurrentIndex(MainWindow::EListPage); |
|
36 |
30 } |
37 } |
31 |
38 |
32 void MainWindow::createMenus() |
39 void MainWindow::createMenus() |
33 { |
40 { |
|
41 detailsAction = new QAction(tr("&Details"),this); |
|
42 menuBar()->addAction(detailsAction); |
|
43 connect(detailsAction, SIGNAL(triggered()),this, SLOT(displayDetails())); |
|
44 |
34 verAction = new QAction(tr("&Version"),this); |
45 verAction = new QAction(tr("&Version"),this); |
35 menuBar()->addAction(verAction); |
46 menuBar()->addAction(verAction); |
36 connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion())); |
47 connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion())); |
37 |
48 |
38 exitAction = new QAction(tr("&Exit"),this); |
49 exitAction = new QAction(tr("&Exit"),this); |
39 menuBar()->addAction(exitAction); |
50 menuBar()->addAction(exitAction); |
40 connect(exitAction, SIGNAL(triggered()),this, SLOT(close())); |
51 connect(exitAction, SIGNAL(triggered()),this, SLOT(close())); |
41 } |
52 } |
|
53 |
|
54 void MainWindow::displayDetails() |
|
55 { |
|
56 ui->stackedWidget->setCurrentIndex(MainWindow::EDetailsGV); |
|
57 } |
|
58 |
|
59 void MainWindow::displayList() |
|
60 { |
|
61 ui->stackedWidget->setCurrentIndex(MainWindow::EListPage); |
|
62 } |
42 |
63 |
43 void MainWindow::displayVersion() |
64 void MainWindow::displayVersion() |
44 { |
65 { |
45 QMessageBox::information(this,"Qt Version", qVersion()); |
66 QMessageBox::information(this,"Qt Version", qVersion()); |
46 } |
67 } |