Rev 247 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/***************************************************************************
* Copyright (C) 2007 - 2009 by Andreas Theofilu *
* andreas@theosys.at *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation version 3 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <KApplication>
#include <KLocale>
#include <KAction>
#include <KActionCollection>
#include <KStandardAction>
#include "sportwatcher.h"
#include "sportwatcherwidget.h"
sportwatcher::sportwatcher(QWidget *parent, Qt::WindowFlags f)
: KXmlGuiWindow(parent, f),
m_view(new sportwatcherWidget(this))
{
setXMLFile("sportwatcherui.rc");
setCentralWidget(m_view);
setupActions();
setupGUI();
m_view->Initialize();
}
sportwatcher::~sportwatcher()
{
delete m_view;
}
void sportwatcher::setupActions()
{
// File menu
KAction* fileNewAction = new KAction(this);
fileNewAction->setText(i18n("Read data ..."));
fileNewAction->setIcon(KIcon("connect_creating"));
fileNewAction->setShortcut(Qt::CTRL + Qt::Key_R);
actionCollection()->addAction("fileNewAction", fileNewAction);
connect(fileNewAction, SIGNAL(triggered(bool)),
m_view, SLOT(fileNew()));
KAction* fileOpenAction = new KAction(this);
fileOpenAction->setText(i18n("Open ..."));
fileOpenAction->setIcon(KIcon("document-open"));
fileOpenAction->setShortcut(Qt::CTRL + Qt::Key_O);
actionCollection()->addAction("fileOpenAction", fileOpenAction);
connect(fileOpenAction, SIGNAL(triggered(bool)),
m_view, SLOT(fileOpen()));
KAction* fileImportAction = new KAction(this);
fileImportAction->setText(i18n("Import ..."));
fileImportAction->setIcon(KIcon("document-import"));
fileImportAction->setShortcut(Qt::CTRL + Qt::Key_I);
actionCollection()->addAction("fileImportAction", fileImportAction);
connect(fileImportAction, SIGNAL(triggered(bool)),
m_view, SLOT(fileImport()));
KAction* extrasSaveHRAction = new KAction(this);
extrasSaveHRAction->setText(i18n("Save heart rate ..."));
extrasSaveHRAction->setIcon(KIcon("document-save-hr"));
actionCollection()->addAction("extrasSaveHRAction", extrasSaveHRAction);
connect(extrasSaveHRAction, SIGNAL(triggered(bool)),
m_view, SLOT(extrasSaveHR()));
KAction* fileSaveAsAction = new KAction(this);
fileSaveAsAction->setText(i18n("Save as ..."));
fileSaveAsAction->setIcon(KIcon("document-save-as"));
fileSaveAsAction->setShortcut(Qt::CTRL + Qt::Key_S);
actionCollection()->addAction("fileSaveAsAction", fileSaveAsAction);
connect(fileSaveAsAction, SIGNAL(triggered(bool)),
m_view, SLOT(fileSaveAs()));
KAction* filePrintAction = new KAction(this);
filePrintAction->setText(i18n("Print ..."));
filePrintAction->setIcon(KIcon("document-print"));
actionCollection()->addAction("filePrintAction", filePrintAction);
connect(filePrintAction, SIGNAL(triggered(bool)),
m_view, SLOT(filePrint()));
KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
// Edit menu
KAction* editRenameAction = new KAction(this);
editRenameAction->setText(i18n("Rename ..."));
editRenameAction->setIcon(KIcon("edit-rename"));
actionCollection()->addAction("editRenameAction", editRenameAction);
connect(editRenameAction, SIGNAL(triggered(bool)),
m_view, SLOT(editRename()));
// Settings menu
KAction* setSportwatcherAction = new KAction(this);
setSportwatcherAction->setText(i18n("Configure SportWatcher ..."));
actionCollection()->addAction("setSportwatcherAction", setSportwatcherAction);
connect(setSportwatcherAction, SIGNAL(triggered(bool)),
m_view, SLOT(extrasSettings()));
KAction* setMapAction = new KAction(this);
setMapAction->setText(i18n("Configure Map ..."));
actionCollection()->addAction("setMapAction", setMapAction);
connect(setMapAction, SIGNAL(triggered(bool)),
m_view, SLOT(extrasWMSSettings()));
}
#include "sportwatcher.moc"