From bde6f40f73d85cff300b133a722e4f59bff77f84 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 10 Apr 2008 21:36:15 +0000 Subject: [PATCH 1/1] Adding some work-in-progress files for shortcut handling which I don't have time to work with right now, but which annoy me constantly with their showing up in svn stat... --- src/uisupport/action.cpp | 19 ++++++++++++ src/uisupport/action.h | 50 ++++++++++++++++++++++++++++++ src/uisupport/actioncollection.cpp | 19 ++++++++++++ src/uisupport/actioncollection.h | 20 ++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 src/uisupport/action.cpp create mode 100644 src/uisupport/action.h create mode 100644 src/uisupport/actioncollection.cpp create mode 100644 src/uisupport/actioncollection.h diff --git a/src/uisupport/action.cpp b/src/uisupport/action.cpp new file mode 100644 index 00000000..c98c321b --- /dev/null +++ b/src/uisupport/action.cpp @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ diff --git a/src/uisupport/action.h b/src/uisupport/action.h new file mode 100644 index 00000000..a26d55cd --- /dev/null +++ b/src/uisupport/action.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + +#ifndef ACTION_H_ +#define ACTION_H_ + +#include + +class Action : public QWidgetAction { + Q_OBJECT + + Q_PROPERTY(QShortcut shortcut READ shortcut WRITE setShortcut); + Q_PROPERTY(bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable); + Q_FLAGS(ShortcutType); + + public: + enum ShortcutType { + ActiveShortcut = 0x01, + DefaultShortcut = 0x02 + }; + Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType); + + explicit Action(QObject *parent); + Action(const QString &text, QObject *parent); + Action(const QIcon &icon, const QString &text, QObject *parent); + + QShortcut shortcut(ShortcutTypes types = ActiveShortcut) const; + void setShortcut(const QShortcut &shortcut, ShortcutTypes type = ActiveShortcut); + void setShortcut(const QKeySequence &shortcut, ShortcutTypes type = ActiveShortcut); + +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(ShortcutTypes); \ No newline at end of file diff --git a/src/uisupport/actioncollection.cpp b/src/uisupport/actioncollection.cpp new file mode 100644 index 00000000..c98c321b --- /dev/null +++ b/src/uisupport/actioncollection.cpp @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ diff --git a/src/uisupport/actioncollection.h b/src/uisupport/actioncollection.h new file mode 100644 index 00000000..d73b9732 --- /dev/null +++ b/src/uisupport/actioncollection.h @@ -0,0 +1,20 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + -- 2.20.1