Remove Studio Controller
Per https://github.com/LMMS/lmms/pull/3296#issuecomment-366713198
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* AutomatableControlButton.h - A button with a model that accepts
|
||||
* values from 0 - 127 for MIDI
|
||||
*
|
||||
* Copyright (c) 2004-2014 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AUTOMATABLE_CONTROL_BUTTON_H
|
||||
#define AUTOMATABLE_CONTROL_BUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "AutomatableModelView.h"
|
||||
|
||||
|
||||
class automatableButtonGroup;
|
||||
|
||||
|
||||
class EXPORT AutomatableControlButton : public QPushButton, public FloatModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AutomatableControlButton( QWidget * _parent, const QString & _name = QString::null );
|
||||
virtual ~AutomatableControlButton();
|
||||
|
||||
virtual void modelChanged();
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void update();
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent( QContextMenuEvent * _me );
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -36,7 +36,6 @@ class BBEditor;
|
||||
class ControllerRackView;
|
||||
class FxMixerView;
|
||||
class GrooveView;
|
||||
class StudioControllerView;
|
||||
class MainWindow;
|
||||
class PianoRollWindow;
|
||||
class ProjectNotes;
|
||||
@@ -54,7 +53,6 @@ public:
|
||||
MainWindow* mainWindow() { return m_mainWindow; }
|
||||
FxMixerView* fxMixerView() { return m_fxMixerView; }
|
||||
GrooveView* grooveView() { return m_grooveView; }
|
||||
StudioControllerView* studioControllerView() { return m_studioControllerView; }
|
||||
SongEditorWindow* songEditor() { return m_songEditor; }
|
||||
BBEditor* getBBEditor() { return m_bbEditor; }
|
||||
PianoRollWindow* pianoRoll() { return m_pianoRoll; }
|
||||
@@ -74,7 +72,6 @@ private:
|
||||
MainWindow* m_mainWindow;
|
||||
FxMixerView* m_fxMixerView;
|
||||
GrooveView* m_grooveView;
|
||||
StudioControllerView* m_studioControllerView;
|
||||
SongEditorWindow* m_songEditor;
|
||||
AutomationEditorWindow* m_automationEditor;
|
||||
BBEditor* m_bbEditor;
|
||||
|
||||
@@ -166,7 +166,6 @@ public slots:
|
||||
void toggleFxMixerWin();
|
||||
void togglePianoRollWin();
|
||||
void toggleControllerRack();
|
||||
void toggleStudioControllerView();
|
||||
void toggleGrooveView();
|
||||
|
||||
void updatePlayPauseIcons();
|
||||
|
||||
@@ -53,7 +53,6 @@ public:
|
||||
}
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
|
||||
virtual void saveControllerSettings( QDomDocument & _doc, QDomElement & _this );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
virtual QString nodeName() const;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
virtual void wheelEvent( QWheelEvent * we );
|
||||
|
||||
virtual bool allowRubberband() const;
|
||||
void scrollToPos( const MidiTime & t );
|
||||
|
||||
|
||||
Song * m_song;
|
||||
|
||||
@@ -159,18 +159,11 @@ public:
|
||||
protected:
|
||||
virtual void resizeEvent( QResizeEvent * event );
|
||||
|
||||
public slots:
|
||||
protected slots:
|
||||
void play();
|
||||
void record();
|
||||
void stop();
|
||||
void home();
|
||||
void next();
|
||||
void prev();
|
||||
void end();
|
||||
|
||||
|
||||
protected slots:
|
||||
void recordAccompany();
|
||||
void stop();
|
||||
|
||||
void lostFocus();
|
||||
void adjustUiAfterProjectLoad();
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
|
||||
#ifndef STUDIOCONTROLLERVIEW_H
|
||||
#define STUDIOCONTROLLERVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "SerializingObject.h"
|
||||
#include "AutomatableControlButton.h"
|
||||
|
||||
class StudioControllerView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StudioControllerView();
|
||||
virtual ~StudioControllerView();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void controllerChanged(int index);
|
||||
void doHome();
|
||||
void doPlay();
|
||||
void doStop();
|
||||
void doRecord();
|
||||
void doNext();
|
||||
void doPrev();
|
||||
void doScroll();
|
||||
void saveControllers();
|
||||
void loadControllers();
|
||||
|
||||
private:
|
||||
float m_scrollLast;
|
||||
|
||||
QVBoxLayout * m_layout;
|
||||
QComboBox * m_dropDown;
|
||||
QLabel * m_controllerLabel;
|
||||
QLabel * m_actionsLabel;
|
||||
AutomatableControlButton * m_homeButton;
|
||||
AutomatableControlButton * m_playButton;
|
||||
AutomatableControlButton * m_stopButton;
|
||||
AutomatableControlButton * m_recordButton;
|
||||
AutomatableControlButton * m_nextButton;
|
||||
AutomatableControlButton * m_prevButton;
|
||||
AutomatableControlButton * m_scrollButton;
|
||||
AutomatableControlButton * m_saveButton;
|
||||
};
|
||||
|
||||
#endif // STUDIOCONTROLLERVIEW_H
|
||||
@@ -127,13 +127,7 @@ void MidiController::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
}
|
||||
|
||||
void MidiController::saveControllerSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
qWarning("inputChannel...");
|
||||
_this.setAttribute("channel", m_midiPort.inputChannel());
|
||||
qWarning("inputController...");
|
||||
_this.setAttribute("controller", m_midiPort.inputController());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MidiController::loadSettings( const QDomElement & _this )
|
||||
|
||||
@@ -44,7 +44,6 @@ SET(LMMS_SRCS
|
||||
gui/editors/SongEditor.cpp
|
||||
|
||||
gui/widgets/AutomatableButton.cpp
|
||||
gui/widgets/AutomatableControlButton.cpp
|
||||
gui/widgets/AutomatableSlider.cpp
|
||||
gui/widgets/CaptionMenu.cpp
|
||||
gui/widgets/ComboBox.cpp
|
||||
@@ -79,7 +78,6 @@ SET(LMMS_SRCS
|
||||
gui/widgets/SendButtonIndicator.cpp
|
||||
gui/widgets/SideBar.cpp
|
||||
gui/widgets/SideBarWidget.cpp
|
||||
gui/widgets/StudioControllerView.cpp
|
||||
gui/widgets/TabBar.cpp
|
||||
gui/widgets/TabWidget.cpp
|
||||
gui/widgets/TempoSyncKnob.cpp
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "ControllerRackView.h"
|
||||
#include "FxMixerView.h"
|
||||
#include "GrooveView.h"
|
||||
#include "StudioControllerView.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "PianoRoll.h"
|
||||
@@ -143,10 +142,6 @@ GuiApplication::GuiApplication()
|
||||
m_grooveView = new GrooveView;
|
||||
connect(m_grooveView, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));
|
||||
|
||||
displayInitProgress(tr("Preparing studio controller"));
|
||||
m_studioControllerView = new StudioControllerView;
|
||||
connect(m_studioControllerView, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));
|
||||
|
||||
displayInitProgress(tr("Preparing controller rack"));
|
||||
m_controllerRackView = new ControllerRackView;
|
||||
connect(m_controllerRackView, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));
|
||||
@@ -206,10 +201,6 @@ void GuiApplication::childDestroyed(QObject *obj)
|
||||
{
|
||||
m_grooveView = nullptr;
|
||||
}
|
||||
else if (obj == m_studioControllerView)
|
||||
{
|
||||
m_studioControllerView = nullptr;
|
||||
}
|
||||
else if (obj == m_songEditor)
|
||||
{
|
||||
m_songEditor = nullptr;
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "FileDialog.h"
|
||||
#include "FxMixerView.h"
|
||||
#include "GrooveView.h"
|
||||
#include "StudioControllerView.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "ImportFilter.h"
|
||||
#include "PianoRoll.h"
|
||||
@@ -565,7 +564,7 @@ void MainWindow::finalize()
|
||||
|
||||
ToolButton * project_notes_window = new ToolButton(
|
||||
embed::getIconPixmap( "project_notes" ),
|
||||
tr( "Show/hide Project Notes" ) +
|
||||
tr( "Show/hide project notes" ) +
|
||||
" (F10)",
|
||||
this, SLOT( toggleProjectNotesWin() ),
|
||||
m_toolBar );
|
||||
@@ -583,14 +582,6 @@ void MainWindow::finalize()
|
||||
m_toolBar );
|
||||
controllers_window->setShortcut( Qt::Key_F11 );
|
||||
|
||||
ToolButton * studio_controller_window = new ToolButton(
|
||||
embed::getIconPixmap( "note_double_whole" ),
|
||||
tr ( "Show/hide Studio Controller" ) +
|
||||
" (F12)",
|
||||
this, SLOT( toggleStudioControllerView() ),
|
||||
m_toolBar);
|
||||
studio_controller_window->setShortcut( Qt::Key_F12 );
|
||||
|
||||
ToolButton * groove_view = new ToolButton(
|
||||
embed::getIconPixmap( "groove" ),
|
||||
tr ( "Show/hide Groove" ) +
|
||||
@@ -606,8 +597,7 @@ void MainWindow::finalize()
|
||||
m_toolBarLayout->addWidget( fx_mixer_window, 1, 5 );
|
||||
m_toolBarLayout->addWidget( project_notes_window, 1, 6 );
|
||||
m_toolBarLayout->addWidget( controllers_window, 1, 7 );
|
||||
m_toolBarLayout->addWidget( studio_controller_window, 1, 8 );
|
||||
m_toolBarLayout->addWidget( groove_view, 1, 9 );
|
||||
m_toolBarLayout->addWidget( groove_view, 1, 8 );
|
||||
m_toolBarLayout->setColumnStretch( 100, 1 );
|
||||
|
||||
// setup-dialog opened before?
|
||||
@@ -1224,11 +1214,6 @@ void MainWindow::toggleGrooveView( void )
|
||||
toggleWindow( gui->grooveView() );
|
||||
}
|
||||
|
||||
void MainWindow::toggleStudioControllerView( void )
|
||||
{
|
||||
toggleWindow( gui->studioControllerView() );
|
||||
}
|
||||
|
||||
void MainWindow::updateViewMenu()
|
||||
{
|
||||
m_viewMenu->clear();
|
||||
|
||||
@@ -339,19 +339,7 @@ void SongEditor::keyPressEvent( QKeyEvent * ke )
|
||||
}
|
||||
else if( ke->key() == Qt::Key_Home )
|
||||
{
|
||||
gui->songEditor()->home();
|
||||
}
|
||||
else if( ke->key() == Qt::Key_PageUp || ke->key() == Qt::Key_MediaPrevious )
|
||||
{
|
||||
gui->songEditor()->prev();
|
||||
}
|
||||
else if( ke->key() == Qt::Key_PageDown || ke->key() == Qt::Key_MediaNext )
|
||||
{
|
||||
gui->songEditor()->next();
|
||||
}
|
||||
else if( ke->key() == Qt::Key_End )
|
||||
{
|
||||
gui->songEditor()->end();
|
||||
m_song->setPlayPos( 0, Song::Mode_PlaySong );
|
||||
}
|
||||
else if( ke->key() == Qt::Key_Delete )
|
||||
{
|
||||
@@ -653,36 +641,6 @@ bool SongEditor::allowRubberband() const
|
||||
}
|
||||
|
||||
|
||||
void SongEditor::scrollToPos( const MidiTime & t )
|
||||
{
|
||||
int widgetWidth, trackOpWidth;
|
||||
if( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() )
|
||||
{
|
||||
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT;
|
||||
trackOpWidth = TRACK_OP_WIDTH_COMPACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
|
||||
trackOpWidth = TRACK_OP_WIDTH;
|
||||
}
|
||||
|
||||
m_smoothScroll = ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt();
|
||||
const int w = width() - widgetWidth
|
||||
- trackOpWidth
|
||||
- contentWidget()->verticalScrollBar()->width(); // width of right scrollbar
|
||||
if( t > m_currentPosition + w * MidiTime::ticksPerTact() /
|
||||
pixelsPerTact() )
|
||||
{
|
||||
animateScroll( m_leftRightScroll, t.getTact(), m_smoothScroll );
|
||||
}
|
||||
else if( t < m_currentPosition )
|
||||
{
|
||||
animateScroll( m_leftRightScroll, t.getTact(), m_smoothScroll );
|
||||
}
|
||||
m_scrollBack = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ComboBoxModel *SongEditor::zoomingModel() const
|
||||
@@ -809,7 +767,7 @@ void SongEditorWindow::play()
|
||||
|
||||
void SongEditorWindow::record()
|
||||
{
|
||||
Engine::getSong()->record();
|
||||
m_editor->m_song->record();
|
||||
}
|
||||
|
||||
|
||||
@@ -817,7 +775,7 @@ void SongEditorWindow::record()
|
||||
|
||||
void SongEditorWindow::recordAccompany()
|
||||
{
|
||||
Engine::getSong()->playAndRecord();
|
||||
m_editor->m_song->playAndRecord();
|
||||
}
|
||||
|
||||
|
||||
@@ -825,46 +783,11 @@ void SongEditorWindow::recordAccompany()
|
||||
|
||||
void SongEditorWindow::stop()
|
||||
{
|
||||
Engine::getSong()->stop();
|
||||
m_editor->m_song->stop();
|
||||
gui->pianoRoll()->stopRecording();
|
||||
}
|
||||
|
||||
|
||||
void SongEditorWindow::home()
|
||||
{
|
||||
MidiTime mTime = MidiTime(0, 0);
|
||||
Engine::getSong()->setPlayPos(mTime.getTicks(), Song::Mode_PlaySong );
|
||||
m_editor->m_timeLine->updatePosition( mTime );
|
||||
m_editor->scrollToPos( mTime );
|
||||
}
|
||||
|
||||
|
||||
void SongEditorWindow::next()
|
||||
{
|
||||
MidiTime mTime = MidiTime(Engine::getSong()->getPlayPos(Song::Mode_PlaySong).getTact() + 1, 0);
|
||||
Engine::getSong()->setPlayPos(mTime.getTicks(), Song::Mode_PlaySong );
|
||||
m_editor->m_timeLine->updatePosition( mTime );
|
||||
m_editor->scrollToPos( mTime );
|
||||
}
|
||||
|
||||
|
||||
void SongEditorWindow::prev()
|
||||
{
|
||||
int tact = Engine::getSong()->getPlayPos(Song::Mode_PlaySong).getTact() - 1;
|
||||
MidiTime mTime = MidiTime(tact > 0 ? tact : 0, 0);
|
||||
Engine::getSong()->setPlayPos(mTime.getTicks(), Song::Mode_PlaySong );
|
||||
m_editor->m_timeLine->updatePosition( mTime );
|
||||
m_editor->scrollToPos( mTime );
|
||||
}
|
||||
|
||||
|
||||
void SongEditorWindow::end()
|
||||
{
|
||||
MidiTime mTime = MidiTime(Engine::getSong()->length(), 0);
|
||||
Engine::getSong()->setPlayPos(mTime.getTicks(), Song::Mode_PlaySong );
|
||||
m_editor->m_timeLine->updatePosition( mTime );
|
||||
m_editor->scrollToPos( mTime );
|
||||
}
|
||||
|
||||
|
||||
void SongEditorWindow::lostFocus()
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* AutomatableControlButton.cpp - A button with a model that accepts
|
||||
* values from 0 - 127 for MIDI
|
||||
*
|
||||
* Copyright (c) 2004-2014 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AutomatableControlButton.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QMouseEvent>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "CaptionMenu.h"
|
||||
#include "Engine.h"
|
||||
#include "embed.h"
|
||||
#include "MainWindow.h"
|
||||
#include "StringPairDrag.h"
|
||||
|
||||
|
||||
AutomatableControlButton::AutomatableControlButton( QWidget * _parent, const QString & _name ) :
|
||||
QPushButton( _parent ),
|
||||
FloatModelView( new FloatModel( 0.0, 0.0, 127.0, 1.0 ), this )
|
||||
{
|
||||
setWindowTitle( _name );
|
||||
doConnections();
|
||||
setFocusPolicy( Qt::NoFocus );
|
||||
}
|
||||
|
||||
|
||||
AutomatableControlButton::~AutomatableControlButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AutomatableControlButton::modelChanged()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AutomatableControlButton::update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AutomatableControlButton::contextMenuEvent( QContextMenuEvent * _me )
|
||||
{
|
||||
// for the case, the user clicked right while pressing left mouse-
|
||||
// button, the context-menu appears while mouse-cursor is still hidden
|
||||
// and it isn't shown again until user does something which causes
|
||||
// an QApplication::restoreOverrideCursor()-call...
|
||||
mouseReleaseEvent( NULL );
|
||||
|
||||
CaptionMenu contextMenu( model()->displayName() );
|
||||
addDefaultActions( &contextMenu );
|
||||
contextMenu.exec( QCursor::pos() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AutomatableControlButton::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
! ( _me->modifiers() & Qt::ControlModifier ) )
|
||||
{
|
||||
// User simply clicked
|
||||
_me->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, drag the standalone button
|
||||
AutomatableModelView::mousePressEvent( _me );
|
||||
QPushButton::mousePressEvent( _me );
|
||||
}
|
||||
}
|
||||
|
||||
void AutomatableControlButton::mouseReleaseEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me && _me->button() == Qt::LeftButton )
|
||||
{
|
||||
emit clicked();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMdiArea>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QDomElement>
|
||||
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Song.h"
|
||||
#include "SongEditor.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "StudioControllerView.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "MidiController.h"
|
||||
|
||||
StudioControllerView::StudioControllerView( ) :
|
||||
QWidget()
|
||||
{
|
||||
setWindowIcon( embed::getIconPixmap( "note_double_whole" ) );
|
||||
setWindowTitle( tr( "Studio Controller" ) );
|
||||
|
||||
m_layout = new QVBoxLayout();
|
||||
this->setLayout( m_layout );
|
||||
|
||||
m_controllerLabel = new QLabel( tr( "Controller:" ), this );
|
||||
m_actionsLabel = new QLabel( tr( "Actions:" ), this );
|
||||
|
||||
m_dropDown = new QComboBox(this);
|
||||
m_dropDown->setInsertPolicy(QComboBox::InsertAtTop);
|
||||
// Insert reverse order.
|
||||
m_dropDown->insertItem(0, "nanoKontrol" , QVariant::fromValue(1));
|
||||
m_dropDown->insertItem(0, tr("No controller") , QVariant::fromValue(0));
|
||||
|
||||
m_dropDown->setCurrentIndex(0);
|
||||
|
||||
m_layout->addWidget( m_controllerLabel );
|
||||
m_layout->addWidget( m_dropDown );
|
||||
m_layout->addWidget( m_actionsLabel );
|
||||
|
||||
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this );
|
||||
|
||||
// No maximize button.
|
||||
Qt::WindowFlags flags = subWin->windowFlags();
|
||||
flags &= ~Qt::WindowMaximizeButtonHint;
|
||||
subWin->setWindowFlags( flags );
|
||||
|
||||
subWin->setFixedSize( 170, 340 );
|
||||
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
|
||||
parentWidget()->move( 1080, 90 );
|
||||
|
||||
// LMMS MIDI configurable actions.
|
||||
m_homeButton = new AutomatableControlButton(this, "home");
|
||||
m_homeButton->setText(tr("Home"));
|
||||
m_layout->addWidget( m_homeButton );
|
||||
connect( m_homeButton->model(), SIGNAL( dataChanged() ), this, SLOT( doHome() ) );
|
||||
|
||||
m_playButton = new AutomatableControlButton(this, "play");
|
||||
m_playButton->setText(tr("Play"));
|
||||
m_layout->addWidget( m_playButton );
|
||||
connect( m_playButton->model(), SIGNAL( dataChanged() ), this, SLOT( doPlay() ) );
|
||||
|
||||
m_stopButton = new AutomatableControlButton(this, "stop");
|
||||
m_stopButton->setText(tr("Stop"));
|
||||
m_layout->addWidget( m_stopButton );
|
||||
connect( m_stopButton->model(), SIGNAL( dataChanged() ), this, SLOT( doStop() ) );
|
||||
|
||||
m_recordButton = new AutomatableControlButton(this, "record");
|
||||
m_recordButton->setText(tr("Record"));
|
||||
m_layout->addWidget( m_recordButton );
|
||||
connect( m_recordButton->model(), SIGNAL( dataChanged() ), this, SLOT( doRecord() ) );
|
||||
|
||||
m_nextButton = new AutomatableControlButton(this, "next");
|
||||
m_nextButton->setText(tr("Next"));
|
||||
m_layout->addWidget( m_nextButton );
|
||||
connect( m_nextButton->model(), SIGNAL( dataChanged() ), this, SLOT( doNext() ) );
|
||||
|
||||
m_prevButton = new AutomatableControlButton(this, "prev");
|
||||
m_prevButton->setText(tr("Previous"));
|
||||
m_layout->addWidget( m_prevButton );
|
||||
connect( m_prevButton->model(), SIGNAL( dataChanged() ), this, SLOT( doPrev() ) );
|
||||
|
||||
m_scrollLast = 0.0f;
|
||||
m_scrollButton = new AutomatableControlButton(this, "scroll");
|
||||
m_scrollButton->setText(tr("Scroll"));
|
||||
m_layout->addWidget( m_scrollButton );
|
||||
connect( m_scrollButton->model(), SIGNAL( dataChanged() ), this, SLOT( doScroll() ) );
|
||||
|
||||
QPushButton* m_saveButton = new QPushButton(tr("Save"), this);
|
||||
m_layout->addWidget( m_saveButton );
|
||||
connect( m_saveButton, SIGNAL( clicked() ), this, SLOT( saveControllers() ) );
|
||||
|
||||
// Controller actions.
|
||||
connect( m_dropDown, SIGNAL( activated(int) ), this, SLOT( controllerChanged(int) ) );
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
StudioControllerView::~StudioControllerView()
|
||||
{
|
||||
delete m_dropDown;
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doHome()
|
||||
{
|
||||
// Korg: NOTE ON=0.496094, OFF=126.503906
|
||||
// TODO: Confirm for other controllers
|
||||
bool click = m_homeButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->home();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doPlay()
|
||||
{
|
||||
bool click = m_playButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->play();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doStop()
|
||||
{
|
||||
// Receive 127 for note on (pressed) and 0 for released
|
||||
bool click = m_stopButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->stop();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doRecord()
|
||||
{
|
||||
bool click = m_recordButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->record();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doNext()
|
||||
{
|
||||
bool click = m_playButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->next();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doPrev()
|
||||
{
|
||||
bool click = m_playButton->model()->value() < 1.0f;
|
||||
if (click) gui->songEditor()->prev();
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::doScroll()
|
||||
{
|
||||
// Korg: Value range 1-127, LMMS: 0.0-126.0.
|
||||
float pos = m_scrollButton->model()->value();
|
||||
if (pos > m_scrollLast ) gui->songEditor()->next();
|
||||
if (pos < m_scrollLast ) gui->songEditor()->prev();
|
||||
m_scrollLast = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void StudioControllerView::controllerChanged(int index)
|
||||
{
|
||||
// TODO: load a file of mappings.
|
||||
}
|
||||
|
||||
QDomElement saveSettings(QDomDocument & doc, AutomatableControlButton* button)
|
||||
{
|
||||
QDomElement elem = doc.createElement( button->text() );
|
||||
AutomatableModel* amp = dynamic_cast<AutomatableModel*>(button->model());
|
||||
amp->saveSettings(doc, elem, button->text() );
|
||||
return elem;
|
||||
}
|
||||
|
||||
void StudioControllerView::saveControllers()
|
||||
{
|
||||
QDomDocument doc = QDomDocument( "lmms-studio-controller" );
|
||||
QDomElement root = doc.createElement( "lmms-studio-controller" );
|
||||
root.setAttribute( "creator", "LMMS" );
|
||||
doc.appendChild(root);
|
||||
|
||||
root.appendChild(saveSettings(doc, m_homeButton));
|
||||
root.appendChild(saveSettings(doc, m_playButton));
|
||||
root.appendChild(saveSettings(doc, m_stopButton));
|
||||
root.appendChild(saveSettings(doc, m_recordButton));
|
||||
root.appendChild(saveSettings(doc, m_nextButton));
|
||||
root.appendChild(saveSettings(doc, m_prevButton));
|
||||
root.appendChild(saveSettings(doc, m_scrollButton));
|
||||
root.appendChild(saveSettings(doc, m_saveButton));
|
||||
|
||||
// FIXME: Make this platform independent.
|
||||
QFile outfile( "/var/tmp/lmms-studio-controller.xml" );
|
||||
if (! outfile.open(QIODevice::WriteOnly | QIODevice::Text) ) {
|
||||
QMessageBox::critical( NULL, "Could not open file", "Could not open file /var/tmp/lmms-studio-controller.xml" );
|
||||
}
|
||||
else {
|
||||
QTextStream ts( &outfile );
|
||||
ts << doc.toString();
|
||||
outfile.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StudioControllerView::loadControllers()
|
||||
{
|
||||
QDomDocument doc = QDomDocument( "lmms-studio-controller" );
|
||||
QDomElement root = doc.createElement( "lmms-studio-controller" );
|
||||
|
||||
AutomatableModel* am = dynamic_cast<AutomatableModel*>(m_homeButton->model());
|
||||
am->setControllerConnection(NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user