88 |
andreas |
1 |
/***************************************************************************
|
232 |
andreas |
2 |
* Copyright (C) 2007 - 2009 by Andreas Theofilu *
|
|
|
3 |
* andreas@theosys.at *
|
88 |
andreas |
4 |
* *
|
|
|
5 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
6 |
* it under the terms of the GNU General Public License as published by *
|
|
|
7 |
* the Free Software Foundation version 3 of the License. *
|
|
|
8 |
* *
|
|
|
9 |
* This program is distributed in the hope that it will be useful, *
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
12 |
* GNU General Public License for more details. *
|
|
|
13 |
* *
|
|
|
14 |
* You should have received a copy of the GNU General Public License *
|
|
|
15 |
* along with this program; if not, write to the *
|
|
|
16 |
* Free Software Foundation, Inc., *
|
|
|
17 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
18 |
***************************************************************************/
|
|
|
19 |
|
245 |
andreas |
20 |
#include <KApplication>
|
|
|
21 |
#include <KLocale>
|
|
|
22 |
#include <KAction>
|
|
|
23 |
#include <KActionCollection>
|
|
|
24 |
#include <KStandardAction>
|
88 |
andreas |
25 |
|
|
|
26 |
#include "sportwatcher.h"
|
|
|
27 |
#include "sportwatcherwidget.h"
|
|
|
28 |
|
232 |
andreas |
29 |
sportwatcher::sportwatcher(QWidget *parent, Qt::WindowFlags f)
|
245 |
andreas |
30 |
: KXmlGuiWindow(parent, f),
|
|
|
31 |
m_view(new sportwatcherWidget(this))
|
88 |
andreas |
32 |
{
|
245 |
andreas |
33 |
setXMLFile("sportwatcherui.rc");
|
|
|
34 |
setCentralWidget(m_view);
|
|
|
35 |
setupActions();
|
|
|
36 |
setupGUI();
|
|
|
37 |
m_view->Initialize();
|
88 |
andreas |
38 |
}
|
|
|
39 |
|
|
|
40 |
sportwatcher::~sportwatcher()
|
|
|
41 |
{
|
245 |
andreas |
42 |
delete m_view;
|
88 |
andreas |
43 |
}
|
|
|
44 |
|
245 |
andreas |
45 |
void sportwatcher::setupActions()
|
|
|
46 |
{
|
|
|
47 |
// File menu
|
|
|
48 |
KAction* fileNewAction = new KAction(this);
|
|
|
49 |
fileNewAction->setText(i18n("Read data ..."));
|
247 |
andreas |
50 |
fileNewAction->setIcon(KIcon("connect_creating"));
|
245 |
andreas |
51 |
fileNewAction->setShortcut(Qt::CTRL + Qt::Key_R);
|
|
|
52 |
actionCollection()->addAction("fileNewAction", fileNewAction);
|
|
|
53 |
connect(fileNewAction, SIGNAL(triggered(bool)),
|
|
|
54 |
m_view, SLOT(fileNew()));
|
|
|
55 |
|
|
|
56 |
KAction* fileOpenAction = new KAction(this);
|
|
|
57 |
fileOpenAction->setText(i18n("Open ..."));
|
254 |
andreas |
58 |
fileOpenAction->setIcon(KIcon("document-open"));
|
245 |
andreas |
59 |
fileOpenAction->setShortcut(Qt::CTRL + Qt::Key_O);
|
|
|
60 |
actionCollection()->addAction("fileOpenAction", fileOpenAction);
|
|
|
61 |
connect(fileOpenAction, SIGNAL(triggered(bool)),
|
|
|
62 |
m_view, SLOT(fileOpen()));
|
|
|
63 |
|
|
|
64 |
KAction* fileImportAction = new KAction(this);
|
|
|
65 |
fileImportAction->setText(i18n("Import ..."));
|
254 |
andreas |
66 |
fileImportAction->setIcon(KIcon("document-import"));
|
245 |
andreas |
67 |
fileImportAction->setShortcut(Qt::CTRL + Qt::Key_I);
|
|
|
68 |
actionCollection()->addAction("fileImportAction", fileImportAction);
|
|
|
69 |
connect(fileImportAction, SIGNAL(triggered(bool)),
|
|
|
70 |
m_view, SLOT(fileImport()));
|
|
|
71 |
|
|
|
72 |
KAction* extrasSaveHRAction = new KAction(this);
|
|
|
73 |
extrasSaveHRAction->setText(i18n("Save heart rate ..."));
|
254 |
andreas |
74 |
extrasSaveHRAction->setIcon(KIcon("document-save-hr"));
|
245 |
andreas |
75 |
actionCollection()->addAction("extrasSaveHRAction", extrasSaveHRAction);
|
|
|
76 |
connect(extrasSaveHRAction, SIGNAL(triggered(bool)),
|
|
|
77 |
m_view, SLOT(extrasSaveHR()));
|
|
|
78 |
|
|
|
79 |
KAction* fileSaveAsAction = new KAction(this);
|
|
|
80 |
fileSaveAsAction->setText(i18n("Save as ..."));
|
254 |
andreas |
81 |
fileSaveAsAction->setIcon(KIcon("document-save-as"));
|
245 |
andreas |
82 |
fileSaveAsAction->setShortcut(Qt::CTRL + Qt::Key_S);
|
|
|
83 |
actionCollection()->addAction("fileSaveAsAction", fileSaveAsAction);
|
|
|
84 |
connect(fileSaveAsAction, SIGNAL(triggered(bool)),
|
|
|
85 |
m_view, SLOT(fileSaveAs()));
|
|
|
86 |
|
|
|
87 |
KAction* filePrintAction = new KAction(this);
|
|
|
88 |
filePrintAction->setText(i18n("Print ..."));
|
254 |
andreas |
89 |
filePrintAction->setIcon(KIcon("document-print"));
|
245 |
andreas |
90 |
actionCollection()->addAction("filePrintAction", filePrintAction);
|
|
|
91 |
connect(filePrintAction, SIGNAL(triggered(bool)),
|
|
|
92 |
m_view, SLOT(filePrint()));
|
|
|
93 |
|
246 |
andreas |
94 |
KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
|
245 |
andreas |
95 |
|
|
|
96 |
// Edit menu
|
|
|
97 |
KAction* editRenameAction = new KAction(this);
|
|
|
98 |
editRenameAction->setText(i18n("Rename ..."));
|
|
|
99 |
editRenameAction->setIcon(KIcon("edit-rename"));
|
|
|
100 |
actionCollection()->addAction("editRenameAction", editRenameAction);
|
|
|
101 |
connect(editRenameAction, SIGNAL(triggered(bool)),
|
|
|
102 |
m_view, SLOT(editRename()));
|
|
|
103 |
|
|
|
104 |
// Settings menu
|
|
|
105 |
KAction* setSportwatcherAction = new KAction(this);
|
|
|
106 |
setSportwatcherAction->setText(i18n("Configure SportWatcher ..."));
|
|
|
107 |
actionCollection()->addAction("setSportwatcherAction", setSportwatcherAction);
|
|
|
108 |
connect(setSportwatcherAction, SIGNAL(triggered(bool)),
|
|
|
109 |
m_view, SLOT(extrasSettings()));
|
|
|
110 |
|
|
|
111 |
KAction* setMapAction = new KAction(this);
|
|
|
112 |
setMapAction->setText(i18n("Configure Map ..."));
|
|
|
113 |
actionCollection()->addAction("setMapAction", setMapAction);
|
|
|
114 |
connect(setMapAction, SIGNAL(triggered(bool)),
|
|
|
115 |
m_view, SLOT(extrasWMSSettings()));
|
|
|
116 |
|
|
|
117 |
}
|
|
|
118 |
|
88 |
andreas |
119 |
#include "sportwatcher.moc"
|