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