Move Groove to global toolbar

This commit is contained in:
Hussam Eddin Alhomsi
2018-03-14 15:35:48 +03:00
parent 46fa1803d3
commit 3866cef8b3
7 changed files with 30 additions and 69 deletions

View File

@@ -16,7 +16,7 @@ class GrooveView : public QWidget
{
Q_OBJECT
public:
GrooveView();
GrooveView(QWidget * parent);
virtual ~GrooveView();
void clear();
@@ -30,7 +30,7 @@ public slots:
private:
void setView(Groove * groove);
QComboBox * m_dropDown;
QComboBox * m_comboBox;
QVBoxLayout * m_layout;
};

View File

@@ -166,7 +166,6 @@ public slots:
void toggleFxMixerWin();
void togglePianoRollWin();
void toggleControllerRack();
void toggleGrooveView();
void updatePlayPauseIcons();

View File

@@ -1046,10 +1046,7 @@ void Song::loadProject( const QString & fileName )
{
m_globalGroove = GrooveFactory::create("none");
}
if ( gui ) {
gui->grooveView()->update();
}
node = dataFile.content().firstChild();
QDomNodeList tclist=dataFile.content().elementsByTagName("trackcontainer");

View File

@@ -34,7 +34,6 @@
#include "ConfigManager.h"
#include "ControllerRackView.h"
#include "FxMixerView.h"
#include "GrooveView.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
#include "PianoRoll.h"
@@ -138,10 +137,6 @@ GuiApplication::GuiApplication()
m_fxMixerView = new FxMixerView;
connect(m_fxMixerView, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));
displayInitProgress(tr("Preparing groove"));
m_grooveView = new GrooveView;
connect(m_grooveView, 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*)));
@@ -197,10 +192,6 @@ void GuiApplication::childDestroyed(QObject *obj)
{
m_fxMixerView = nullptr;
}
else if (obj == m_grooveView)
{
m_grooveView = nullptr;
}
else if (obj == m_songEditor)
{
m_songEditor = nullptr;

View File

@@ -49,7 +49,6 @@
#include "FileBrowser.h"
#include "FileDialog.h"
#include "FxMixerView.h"
#include "GrooveView.h"
#include "GuiApplication.h"
#include "ImportFilter.h"
#include "PianoRoll.h"
@@ -582,14 +581,6 @@ void MainWindow::finalize()
m_toolBar );
controllers_window->setShortcut( Qt::Key_F11 );
ToolButton * groove_view = new ToolButton(
embed::getIconPixmap( "groove" ),
tr ( "Show/hide Groove" ) +
" (Calc)",
this, SLOT( toggleGrooveView() ),
m_toolBar);
groove_view->setShortcut( Qt::Key_Calculator );
m_toolBarLayout->addWidget( song_editor_window, 1, 1 );
m_toolBarLayout->addWidget( bb_editor_window, 1, 2 );
m_toolBarLayout->addWidget( piano_roll_window, 1, 3 );
@@ -597,7 +588,6 @@ 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( groove_view, 1, 8 );
m_toolBarLayout->setColumnStretch( 100, 1 );
// setup-dialog opened before?
@@ -651,7 +641,7 @@ void MainWindow::finalize()
int MainWindow::addWidgetToToolBar( QWidget * _w, int _row, int _col )
{
int col = ( _col == -1 ) ? m_toolBarLayout->columnCount() + 7 : _col;
int col = ( _col == -1 ) ? m_toolBarLayout->columnCount() + 6 : _col;
if( _w->height() > 32 || _row == -1 )
{
m_toolBarLayout->addWidget( _w, 0, col, 2, 1 );
@@ -669,7 +659,7 @@ int MainWindow::addWidgetToToolBar( QWidget * _w, int _row, int _col )
void MainWindow::addSpacingToToolBar( int _size )
{
m_toolBarLayout->setColumnMinimumWidth( m_toolBarLayout->columnCount() +
7, _size );
6, _size );
}
SubWindow* MainWindow::addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags)
@@ -1209,11 +1199,6 @@ void MainWindow::toggleFxMixerWin()
toggleWindow( gui->fxMixerView() );
}
void MainWindow::toggleGrooveView( void )
{
toggleWindow( gui->grooveView() );
}
void MainWindow::updateViewMenu()
{
m_viewMenu->clear();

View File

@@ -38,6 +38,7 @@
#include "ConfigManager.h"
#include "CPULoadWidget.h"
#include "embed.h"
#include "GrooveView.h"
#include "GuiApplication.h"
#include "LcdSpinBox.h"
#include "MainWindow.h"
@@ -147,6 +148,11 @@ SongEditor::SongEditor( Song * song ) :
gui->mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addWidgetToToolBar( new GrooveView( tb ) );
gui->mainWindow()->addSpacingToToolBar( 10 );
QLabel * master_vol_lbl = new QLabel( tb );
master_vol_lbl->setPixmap( embed::getIconPixmap( "master_volume" ) );

View File

@@ -21,42 +21,25 @@
#include "GrooveExperiments.h"
#include "MidiSwing.h"
//GrooveView::GrooveView(QWidget *parent) :
// QWidget(parent)
GrooveView::GrooveView( ) :
QWidget()
GrooveView::GrooveView(QWidget * parent) :
QWidget(parent)
{
setWindowIcon( embed::getIconPixmap( "groove" ) );
setWindowTitle( tr( "Groove" ) );
m_layout = new QVBoxLayout();
this->setLayout( m_layout );
m_dropDown = new QComboBox(this);
m_comboBox = new QComboBox(this);
// Insert reverse order.
m_dropDown->insertItem(0, tr("Experiment swing") , QVariant::fromValue(5) );
m_dropDown->insertItem(0, tr("Hydrogen swing") , QVariant::fromValue(4) );
m_dropDown->insertItem(0, tr("Half swing") , QVariant::fromValue(3) );
m_dropDown->insertItem(0, tr("MIDI swing") , QVariant::fromValue(2) );
m_dropDown->insertItem(0, tr("No swing") , QVariant::fromValue(1) );
m_dropDown->setCurrentIndex(0);
m_comboBox->insertItem(0, tr("Experiment swing") , QVariant::fromValue(5) );
m_comboBox->insertItem(0, tr("Hydrogen swing") , QVariant::fromValue(4) );
m_comboBox->insertItem(0, tr("Half swing") , QVariant::fromValue(3) );
m_comboBox->insertItem(0, tr("MIDI swing") , QVariant::fromValue(2) );
m_comboBox->insertItem(0, tr("No swing") , QVariant::fromValue(1) );
m_comboBox->setCurrentIndex(0);
m_layout->addWidget( m_dropDown );
m_layout->addWidget( m_comboBox );
m_layout->addWidget( new QLabel("") );
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this );
// No maximize button.
Qt::WindowFlags flags = subWin->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
subWin->setFixedSize( 170, 121 );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
parentWidget()->move( 1080, 450 );
connect( m_dropDown, SIGNAL( activated(int) ),
connect( m_comboBox, SIGNAL( activated(int) ),
this, SLOT( grooveChanged(int) ) );
connect( Engine::getSong(), SIGNAL( dataChanged() ),
@@ -70,7 +53,7 @@ GrooveView::GrooveView( ) :
GrooveView::~GrooveView()
{
delete m_dropDown;
delete m_comboBox;
}
void GrooveView::update()
@@ -78,23 +61,23 @@ void GrooveView::update()
Groove * groove = Engine::getSong()->globalGroove();
if (groove->nodeName() == "none")
{
m_dropDown->setCurrentIndex(0);
m_comboBox->setCurrentIndex(0);
}
if (groove->nodeName() == "midi")
{
m_dropDown->setCurrentIndex(1);
m_comboBox->setCurrentIndex(1);
}
if (groove->nodeName() == "half")
{
m_dropDown->setCurrentIndex(2);
m_comboBox->setCurrentIndex(2);
}
if (groove->nodeName() == "hydrogen")
{
m_dropDown->setCurrentIndex(3);
m_comboBox->setCurrentIndex(3);
}
if (groove->nodeName() == "experiment")
{
m_dropDown->setCurrentIndex(4);
m_comboBox->setCurrentIndex(4);
}
setView(groove);
}
@@ -105,7 +88,7 @@ void GrooveView::clear()
delete li->widget();
delete li;
m_dropDown->setCurrentIndex(0);
m_comboBox->setCurrentIndex(0);
m_layout->addWidget(new QLabel(""));
}
@@ -113,7 +96,7 @@ void GrooveView::grooveChanged(int index)
{
Groove * groove = NULL;
int selectedIdx = m_dropDown->currentIndex();
int selectedIdx = m_comboBox->currentIndex();
switch (selectedIdx) {
case 0 :
{