|
1 #include <QLabel> |
|
2 #include <QVBoxLayout> |
|
3 |
|
4 #include <OLApplication.h> |
|
5 #include <OLButton.h> |
|
6 #include <OLPixmapWidget.h> |
|
7 #include "mainview.h" |
|
8 |
|
9 |
|
10 #include "mainwindow.h" |
|
11 |
|
12 MainView::MainView(QWidget *parent) : |
|
13 QWidget(parent) |
|
14 { |
|
15 // setup toolbar |
|
16 OLButton* btn = 0; |
|
17 btn = addToolbarButton(":/images/icn_addmenu.png", "call"); |
|
18 connect(btn, SIGNAL(clicked()), this, SLOT(showAllContacts())); |
|
19 |
|
20 btn = addToolbarButton(":/images/icn_addview.png", "SMS"); |
|
21 connect(btn, SIGNAL(clicked()), this, SLOT(sortByGeo())); |
|
22 } |
|
23 |
|
24 OLButton* MainView::addToolbarButton(const QString& icon, const QString& text) |
|
25 { |
|
26 OLWidgetList wgtList; |
|
27 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
28 OLButton* btn = new OLButton(); |
|
29 QVBoxLayout* btnLayout = new QVBoxLayout(btn); |
|
30 btnLayout->setMargin(0); |
|
31 btnLayout->setSpacing(5); |
|
32 btnLayout->setAlignment(Qt::AlignCenter); |
|
33 OLPixmapWidget* btnIcon = new OLPixmapWidget(icon); |
|
34 QLabel* btnText = new QLabel(text); |
|
35 btnText->setStyleSheet("font-size: 10px;"); |
|
36 btnLayout->addWidget(btnIcon, 0, Qt::AlignHCenter); |
|
37 btnLayout->addWidget(btnText, 0, Qt::AlignHCenter); |
|
38 wgtList.append(btnText); |
|
39 btn->setLayout(btnLayout); |
|
40 app->addToolbarButton(btn, wgtList); |
|
41 |
|
42 return btn; |
|
43 } |
|
44 |
|
45 void MainView::startApp() |
|
46 { |
|
47 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
48 QSize viewSize = app->viewSize(); |
|
49 app->setView(this, OLApplication::systemdefault, true); |
|
50 } |
|
51 |
|
52 // just should all contacts. |
|
53 void MainView::showAllContacts() |
|
54 { |
|
55 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
56 app->showBanner("(all) NYI", false); |
|
57 } |
|
58 |
|
59 // source the list of contacts by proximity to the phone. |
|
60 void MainView::sortByGeo() |
|
61 { |
|
62 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
63 app->showBanner("(geo) NYI", false); |
|
64 } |
|
65 |
|
66 // show all contacts at a particular event. |
|
67 void MainView::showEvents() |
|
68 { |
|
69 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
70 app->showBanner("(events) NYI", false); |
|
71 } |
|
72 |
|
73 // show call log |
|
74 void MainView::showLogs() |
|
75 { |
|
76 OLApplication* app = dynamic_cast<OLApplication*>(qApp); |
|
77 app->showBanner("(logs) NYI", false); |
|
78 } |