mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-03 14:05:17 +00:00
stubs for preset text editor
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@880 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -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
|
||||
|
||||
83
src/qprojectM/qpreseteditordialog.ui
Normal file
83
src/qprojectM/qpreseteditordialog.ui
Normal file
@ -0,0 +1,83 @@
|
||||
<ui version="4.0" >
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>459</width>
|
||||
<height>305</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>451</width>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPresetTextEdit" name="presetTextEdit" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QPresetTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header location="global" >qpresettextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
23
src/qprojectM/qpresettextedit.cpp
Normal file
23
src/qprojectM/qpresettextedit.cpp
Normal file
@ -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"
|
||||
|
||||
@ -21,105 +21,23 @@
|
||||
|
||||
#ifndef QPRESET_EDITOR_HPP
|
||||
#define QPRESET_EDITOR_HPP
|
||||
|
||||
#include <QTextBox>
|
||||
#include <QTextEdit>
|
||||
#include <QtDebug>
|
||||
#include <QKeyEvent>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
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:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user