From 0c1270634a883fc0de097db7099cfbfc3feed282 Mon Sep 17 00:00:00 2001 From: w1z7ard Date: Sun, 2 Mar 2008 06:03:42 +0000 Subject: [PATCH] stubs for preset text editor git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@880 6778bc44-b910-0410-a7a0-be141de4315d --- src/qprojectM/CMakeLists.txt | 3 + src/qprojectM/qpreseteditordialog.ui | 83 ++++++++++++++++++++++++ src/qprojectM/qpresettextedit.cpp | 23 +++++++ src/qprojectM/qpresettextedit.hpp | 96 ++-------------------------- 4 files changed, 116 insertions(+), 89 deletions(-) create mode 100644 src/qprojectM/qpreseteditordialog.ui create mode 100644 src/qprojectM/qpresettextedit.cpp diff --git a/src/qprojectM/CMakeLists.txt b/src/qprojectM/CMakeLists.txt index b6fa414ca..f1b019918 100644 --- a/src/qprojectM/CMakeLists.txt +++ b/src/qprojectM/CMakeLists.txt @@ -52,6 +52,8 @@ set(qprojectM_SRCS qprojectmconfigdialog.cpp qprojectmconfigdialog.hpp qplaylisttableview.hpp + qpresettextedit.cpp + qpresettextedit.hpp ) @@ -67,6 +69,7 @@ set(qprojectM_MOC_HDRS set(qprojectM_UIS qprojectm_mainwindow.ui qprojectmconfigdialog.ui + qpreseteditordialog.ui ) # Qt resource file diff --git a/src/qprojectM/qpreseteditordialog.ui b/src/qprojectM/qpreseteditordialog.ui new file mode 100644 index 000000000..25789a5af --- /dev/null +++ b/src/qprojectM/qpreseteditordialog.ui @@ -0,0 +1,83 @@ + + Dialog + + + + 0 + 0 + 459 + 305 + + + + Dialog + + + + + 0 + 10 + 451 + 291 + + + + + + + + + + Qt::Vertical + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::Reset + + + + + + + + + QPresetTextEdit + QTextEdit +
qpresettextedit.h
+
+
+ + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/src/qprojectM/qpresettextedit.cpp b/src/qprojectM/qpresettextedit.cpp new file mode 100644 index 000000000..c49b2c601 --- /dev/null +++ b/src/qprojectM/qpresettextedit.cpp @@ -0,0 +1,23 @@ +/*************************************************************************** + * Copyright (C) 2007 by carm * + * carm@localhost * + * * + * 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. * + ***************************************************************************/ + + +#include "qpresettextedit.hpp" + diff --git a/src/qprojectM/qpresettextedit.hpp b/src/qprojectM/qpresettextedit.hpp index 9f700a298..9cb214f2b 100644 --- a/src/qprojectM/qpresettextedit.hpp +++ b/src/qprojectM/qpresettextedit.hpp @@ -21,105 +21,23 @@ #ifndef QPRESET_EDITOR_HPP #define QPRESET_EDITOR_HPP - -#include +#include #include -#include -#include -#include -class QPlaylistTableView : public QTableView + +class QPresetTextEdit: QTextEdit { Q_OBJECT // must include this if you use Qt signals/slots public: - inline QPlaylistTableView(QWidget * parent = 0): - QTableView(parent) {} + inline QPresetTextEdit(QWidget * parent = 0): QTextEdit(parent) {} + signals: - void resized(QResizeEvent * event); - void deletesRequested(const QModelIndexList & items); - void internalDragAndDropRequested(const QModelIndexList & items, const QModelIndex & target = QModelIndex()); - public slots: - void dropEvent ( QDropEvent * event ) { - - QModelIndex dropIndex = this->indexAt(event->pos()); - - if (!dropIndex.isValid()) { - event->ignore(); - return; - } - - const QModelIndexList & items = selectedIndexes(); - - if (items.empty()) { - event->ignore(); - return; - } - - int i = items[0].row(); - - m_firstContiguousBlock.clear(); - foreach (QModelIndex index, items) { - if (index.row() == i) - m_firstContiguousBlock.append(index); - else - break; - i++; - } - - emit(internalDragAndDropRequested(m_firstContiguousBlock, dropIndex)); - event->accept(); - } - - void dragLeaveEvent ( QDragLeaveEvent * event ) { - qDebug() << "drag leave"; - } - - void dragEnterEvent ( QDragEnterEvent * event ) { - qDebug() << "drag enter event"; - event->accept(); - - } - - - void dragMoveEvent ( QDragMoveEvent * event ) { - qDebug() << "drag move event"; - event->accept(); - } - - inline void resizeEvent(QResizeEvent * event) { - - emit(resized(event)); - } - - - - - inline void keyReleaseEvent(QKeyEvent * event) { - - switch (event->key()) { - case Qt::Key_Delete: - emit(deletesRequested(selectedIndexes())); - break; - - case Qt::Key_E: - if (!(event->modifiers() & Qt::ControlModifier)) { - // TODO: load an editor for selected preset - } - - break; - - default: - event->ignore(); - break; - } - } - - private: - QModelIndexList m_firstContiguousBlock; + private: + };