diff options
author | Florian Jung <flo@windfisch.org> | 2012-03-15 18:21:23 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2012-03-15 18:21:23 +0000 |
commit | 27b7bf6815cda7abb67026c37b3e44daee1803cb (patch) | |
tree | 0b9d1c0bc84ac7ff8032e707f2b5fb4e0aaabb5c /muse2/muse/widgets | |
parent | 2d6f113a10eb485694e20a78500f650776d701e3 (diff) |
merged with trunk
Diffstat (limited to 'muse2/muse/widgets')
27 files changed, 644 insertions, 409 deletions
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index d037f06e..fae0d614 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -45,6 +45,7 @@ QT4_WRAP_CPP (widget_mocs dentry.h didyouknow.h doublelabel.h + doublespinbox.h filedialog.h genset.h mdisettings.h @@ -155,6 +156,7 @@ file (GLOB widgets_source_files dentry.cpp dimap.cpp doublelabel.cpp + doublespinbox.cpp drange.cpp filedialog.cpp genset.cpp diff --git a/muse2/muse/widgets/doublespinbox.cpp b/muse2/muse/widgets/doublespinbox.cpp new file mode 100644 index 00000000..71ca4149 --- /dev/null +++ b/muse2/muse/widgets/doublespinbox.cpp @@ -0,0 +1,102 @@ +//========================================================= +// MusE +// Linux Music Editor +// doublespinbox.cpp (C) Copyright 2012 Tim E. Real (terminator356 at users dot sourceforge dot net) +// +// 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; 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#include <QKeyEvent> +#include <QLineEdit> +#include <QMouseEvent> +#include "doublespinbox.h" + +namespace MusEGui { + +//void DoubleSpinBoxLineEdit::mouseDoubleClickEvent(QMouseEvent* e) +//{ +// QLineEdit::mouseDoubleClickEvent(e); +// emit doubleClicked(); +// if((e->buttons() & Qt::LeftButton) && (e->modifiers() & Qt::ControlModifier)) +// emit ctrlDoubleClicked(); +//} + +void DoubleSpinBoxLineEdit::mousePressEvent(QMouseEvent* e) +{ + QLineEdit::mousePressEvent(e); + //selectAll(); + if((e->buttons() & Qt::LeftButton) && (e->modifiers() & Qt::ControlModifier)) + emit ctrlClicked(); +} + +//--------------------------------------------------------- +// DoubleSpinBox +//--------------------------------------------------------- + +DoubleSpinBox::DoubleSpinBox(QWidget* parent) + : QDoubleSpinBox(parent) +{ + DoubleSpinBoxLineEdit* le = new DoubleSpinBoxLineEdit(this); + setLineEdit(le); + setKeyboardTracking(false); + + //connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); + //connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); + connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); +} + +DoubleSpinBox::DoubleSpinBox(double minValue, double maxValue, double step, QWidget* parent) + : QDoubleSpinBox(parent) +{ + DoubleSpinBoxLineEdit* le = new DoubleSpinBoxLineEdit(this); + setLineEdit(le); + setRange(minValue, maxValue); + setSingleStep(step); + setKeyboardTracking(false); + + //connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); + //connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); + connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); +} + +void DoubleSpinBox::keyPressEvent(QKeyEvent* ev) +{ + switch (ev->key()) { + case Qt::Key_Return: + QDoubleSpinBox::keyPressEvent(ev); + emit returnPressed(); + return; + break; + case Qt::Key_Escape: + emit escapePressed(); + return; + break; + default: + break; + } + QDoubleSpinBox::keyPressEvent(ev); +} + +void DoubleSpinBox::wheelEvent(QWheelEvent* e) +{ + QDoubleSpinBox::wheelEvent(e); + // Need this because Qt doesn't deselect the text if not focused. + if(!hasFocus() && lineEdit()) + lineEdit()->deselect(); +} + +} // namespace MusEGui + diff --git a/muse2/muse/widgets/doublespinbox.h b/muse2/muse/widgets/doublespinbox.h new file mode 100644 index 00000000..f3dfcdb0 --- /dev/null +++ b/muse2/muse/widgets/doublespinbox.h @@ -0,0 +1,73 @@ +//========================================================= +// MusE +// Linux Music Editor +// doublespinbox.h (C) Copyright 2012 Tim E. Real (terminator356 at users dot sourceforge dot net) +// +// 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; 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __DOUBLESPINBOX_H__ +#define __DOUBLESPINBOX_H__ + +#include <QDoubleSpinBox> +#include <QLineEdit> + +namespace MusEGui { + +class DoubleSpinBoxLineEdit : public QLineEdit +{ + Q_OBJECT + + protected: + //virtual void mouseDoubleClickEvent(QMouseEvent* e); + virtual void mousePressEvent(QMouseEvent* e); + + signals: + //void doubleClicked(); + //void ctrlDoubleClicked(); + void ctrlClicked(); + + public: + DoubleSpinBoxLineEdit(QWidget* parent = 0) : QLineEdit(parent) {}; +}; + +//--------------------------------------------------------- +// DoubleSpinBox +//--------------------------------------------------------- + +class DoubleSpinBox : public QDoubleSpinBox { + Q_OBJECT + + protected: + virtual void keyPressEvent(QKeyEvent*); + virtual void wheelEvent(QWheelEvent*); + + signals: + //void doubleClicked(); + //void ctrlDoubleClicked(); + void ctrlClicked(); + void returnPressed(); + void escapePressed(); + + public: + DoubleSpinBox(QWidget* parent=0); + DoubleSpinBox(double minValue, double maxValue, double step = 1.0, QWidget* parent=0); +}; + +} // namespace MusEGui + +#endif + diff --git a/muse2/muse/widgets/fdialogbuttons.ui b/muse2/muse/widgets/fdialogbuttons.ui index a2196b66..fdd2a22c 100644 --- a/muse2/muse/widgets/fdialogbuttons.ui +++ b/muse2/muse/widgets/fdialogbuttons.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>150</width> + <width>154</width> <height>438</height> </rect> </property> @@ -146,6 +146,29 @@ Configuration</string> </layout> </widget> </item> + <item> + <widget class="QFrame" name="writeWinStateGroup"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QCheckBox" name="writeWinStateButton"> + <property name="text"> + <string>write window +states</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <layoutdefault spacing="6" margin="11"/> diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 5fbae28b..b41f807e 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -240,6 +240,7 @@ MFileDialog::MFileDialog(const QString& dir, } buttons.readMidiPortsGroup->setVisible(false); + buttons.writeWinStateGroup->setVisible(false); } } @@ -314,7 +315,7 @@ QString getOpenFileName(const QString &startWith, const char** filters_chararray //--------------------------------------------------------- QString getSaveFileName(const QString &startWith, - const char** filters_chararray, QWidget* parent, const QString& name) + const char** filters_chararray, QWidget* parent, const QString& name, bool* writeWinState) { QStringList filters = localizedStringListFromCharArray(filters_chararray, "file_patterns"); @@ -322,12 +323,20 @@ QString getSaveFileName(const QString &startWith, dlg->setNameFilters(filters); dlg->setWindowTitle(name); dlg->setFileMode(QFileDialog::AnyFile); + if (writeWinState) + { + dlg->buttons.writeWinStateGroup->setVisible(true); + dlg->buttons.writeWinStateButton->setChecked(*writeWinState); + } + QStringList files; QString result; if (dlg->exec() == QDialog::Accepted) { files = dlg->selectedFiles(); if (!files.isEmpty()) result = files[0]; + if (writeWinState) + *writeWinState = dlg->buttons.writeWinStateButton->isChecked(); } // Added by T356. diff --git a/muse2/muse/widgets/filedialog.h b/muse2/muse/widgets/filedialog.h index c9ab8e09..1e2616da 100644 --- a/muse2/muse/widgets/filedialog.h +++ b/muse2/muse/widgets/filedialog.h @@ -91,7 +91,7 @@ class ContentsPreview : public QWidget, public Q3FilePreview { */ QString getSaveFileName(const QString& startWidth, const char** filters, - QWidget* parent, const QString& name); + QWidget* parent, const QString& name, bool* writeWinState=NULL); QString getOpenFileName(const QString& startWidth, const char** filters, QWidget* parent, const QString& name, bool* doReadMidiPorts, MFileDialog::ViewType viewType = MFileDialog::PROJECT_VIEW); QString getImageFileName(const QString& startWith, const char** filters, diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 422f5110..60127a0a 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -72,129 +72,9 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) recDrumGroup->addButton(dontRecMutedButton, MusECore::DONT_REC_MUTED); recDrumGroup->addButton(dontRecBothButton, MusECore::DONT_REC_MUTED_OR_HIDDEN); - for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) { - if (rtcResolutions[i] == MusEGlobal::config.rtcTicks) { - rtcResolutionSelect->setCurrentIndex(i); - break; - } - } - for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEGlobal::config.division) { - midiDivisionSelect->setCurrentIndex(i); - break; - } - } - for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEGlobal::config.guiDivision) { - guiDivisionSelect->setCurrentIndex(i); - break; - } - } - for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) { - if (dummyAudioBufSizes[i] == MusEGlobal::config.dummyAudioBufSize) { - dummyAudioSize->setCurrentIndex(i); - break; - } - } - - for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { - if (minControlProcessPeriods[i] == MusEGlobal::config.minControlProcessPeriod) { - minControlProcessPeriodComboBox->setCurrentIndex(i); - break; - } - } - - guiRefreshSelect->setValue(MusEGlobal::config.guiRefresh); - minSliderSelect->setValue(int(MusEGlobal::config.minSlider)); - minMeterSelect->setValue(MusEGlobal::config.minMeter); - freewheelCheckBox->setChecked(MusEGlobal::config.freewheelMode); - denormalCheckBox->setChecked(MusEGlobal::config.useDenormalBias); - outputLimiterCheckBox->setChecked(MusEGlobal::config.useOutputLimiter); - vstInPlaceCheckBox->setChecked(MusEGlobal::config.vstInPlace); - dummyAudioRate->setValue(MusEGlobal::config.dummyAudioSampleRate); + updateSettings(); - //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); - //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); - //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 - // Just a record of what the gensetbase.ui file contained for dummyAudioRate whats this: - /* <property name="whatsThis"> - <string>Actual rate used depends on limitations of - timer used. If a high rate timer is available, - short periods can be used with high sample rates. -Period affects midi playback resolution. -Shorter periods are desirable.</string> - </property> */ - - projDirEntry->setText(MusEGlobal::config.projectBaseFolder); projDirOpenToolButton->setIcon(*openIcon); - - startSongEntry->setText(MusEGlobal::config.startSong); - startSongGroup->button(MusEGlobal::config.startMode)->setChecked(true); - - recDrumGroup->button(MusEGlobal::config.newDrumRecordCondition)->setChecked(true); - - showTransport->setChecked(MusEGlobal::config.transportVisible); - showBigtime->setChecked(MusEGlobal::config.bigTimeVisible); - //showMixer->setChecked(MusEGlobal::config.mixerVisible); - showMixer->setChecked(MusEGlobal::config.mixer1Visible); - showMixer2->setChecked(MusEGlobal::config.mixer2Visible); - - mainX->setValue(MusEGlobal::config.geometryMain.x()); - mainY->setValue(MusEGlobal::config.geometryMain.y()); - mainW->setValue(MusEGlobal::config.geometryMain.width()); - mainH->setValue(MusEGlobal::config.geometryMain.height()); - - transportX->setValue(MusEGlobal::config.geometryTransport.x()); - transportY->setValue(MusEGlobal::config.geometryTransport.y()); - - bigtimeX->setValue(MusEGlobal::config.geometryBigTime.x()); - bigtimeY->setValue(MusEGlobal::config.geometryBigTime.y()); - bigtimeW->setValue(MusEGlobal::config.geometryBigTime.width()); - bigtimeH->setValue(MusEGlobal::config.geometryBigTime.height()); - - //mixerX->setValue(MusEGlobal::config.geometryMixer.x()); - //mixerY->setValue(MusEGlobal::config.geometryMixer.y()); - //mixerW->setValue(MusEGlobal::config.geometryMixer.width()); - //mixerH->setValue(MusEGlobal::config.geometryMixer.height()); - mixerX->setValue(MusEGlobal::config.mixer1.geometry.x()); - mixerY->setValue(MusEGlobal::config.mixer1.geometry.y()); - mixerW->setValue(MusEGlobal::config.mixer1.geometry.width()); - mixerH->setValue(MusEGlobal::config.mixer1.geometry.height()); - mixer2X->setValue(MusEGlobal::config.mixer2.geometry.x()); - mixer2Y->setValue(MusEGlobal::config.mixer2.geometry.y()); - mixer2W->setValue(MusEGlobal::config.mixer2.geometry.width()); - mixer2H->setValue(MusEGlobal::config.mixer2.geometry.height()); - - //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); - setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); - setMixer2Current->setEnabled(MusEGlobal::muse->mixer2Window()); - - setBigtimeCurrent->setEnabled(MusEGlobal::muse->bigtimeWindow()); - setTransportCurrent->setEnabled(MusEGlobal::muse->transportWindow()); - - showSplash->setChecked(MusEGlobal::config.showSplashScreen); - showDidYouKnow->setChecked(MusEGlobal::config.showDidYouKnow); - externalWavEditorSelect->setText(MusEGlobal::config.externalWavEditor); - oldStyleStopCheckBox->setChecked(MusEGlobal::config.useOldStyleStopShortCut); - moveArmedCheckBox->setChecked(MusEGlobal::config.moveArmedCheckBox); - projectSaveCheckBox->setChecked(MusEGlobal::config.useProjectSaveDialog); - popsDefStayOpenCheckBox->setChecked(MusEGlobal::config.popupsDefaultStayOpen); - lmbDecreasesCheckBox->setChecked(MusEGlobal::config.leftMouseButtonCanDecrease); - rangeMarkerWithoutMMBCheckBox->setChecked(MusEGlobal::config.rangeMarkerWithoutMMB); - - addHiddenCheckBox->setChecked(MusEGlobal::config.addHiddenTracks); - unhideTracksCheckBox->setChecked(MusEGlobal::config.unhideTracks); - - switch (MusEGlobal::config.drumTrackPreference) - { - case MusEGlobal::ONLY_NEW: onlyNewDrumBtn->setChecked(true); break; - case MusEGlobal::ONLY_OLD: onlyOldDrumBtn->setChecked(true); break; - case MusEGlobal::PREFER_NEW: preferNewDrumBtn->setChecked(true); break; - case MusEGlobal::PREFER_OLD: preferOldDrumBtn->setChecked(true); break; - } - - //updateSettings(); // TESTING - connect(projDirOpenToolButton, SIGNAL(clicked()), SLOT(browseProjDir())); connect(applyButton, SIGNAL(clicked()), SLOT(apply())); @@ -279,7 +159,7 @@ void GlobalSettingsConfig::updateSettings() //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); - //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 + //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 DELETETHIS? projDirEntry->setText(MusEGlobal::config.projectBaseFolder); @@ -290,7 +170,6 @@ void GlobalSettingsConfig::updateSettings() showTransport->setChecked(MusEGlobal::config.transportVisible); showBigtime->setChecked(MusEGlobal::config.bigTimeVisible); - //showMixer->setChecked(MusEGlobal::config.mixerVisible); showMixer->setChecked(MusEGlobal::config.mixer1Visible); showMixer2->setChecked(MusEGlobal::config.mixer2Visible); @@ -307,10 +186,6 @@ void GlobalSettingsConfig::updateSettings() bigtimeW->setValue(MusEGlobal::config.geometryBigTime.width()); bigtimeH->setValue(MusEGlobal::config.geometryBigTime.height()); - //mixerX->setValue(MusEGlobal::config.geometryMixer.x()); - //mixerY->setValue(MusEGlobal::config.geometryMixer.y()); - //mixerW->setValue(MusEGlobal::config.geometryMixer.width()); - //mixerH->setValue(MusEGlobal::config.geometryMixer.height()); mixerX->setValue(MusEGlobal::config.mixer1.geometry.x()); mixerY->setValue(MusEGlobal::config.mixer1.geometry.y()); mixerW->setValue(MusEGlobal::config.mixer1.geometry.width()); @@ -320,7 +195,6 @@ void GlobalSettingsConfig::updateSettings() mixer2W->setValue(MusEGlobal::config.mixer2.geometry.width()); mixer2H->setValue(MusEGlobal::config.mixer2.geometry.height()); - //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); setMixer2Current->setEnabled(MusEGlobal::muse->mixer2Window()); @@ -336,6 +210,7 @@ void GlobalSettingsConfig::updateSettings() popsDefStayOpenCheckBox->setChecked(MusEGlobal::config.popupsDefaultStayOpen); lmbDecreasesCheckBox->setChecked(MusEGlobal::config.leftMouseButtonCanDecrease); rangeMarkerWithoutMMBCheckBox->setChecked(MusEGlobal::config.rangeMarkerWithoutMMB); + smartFocusCheckBox->setChecked(MusEGlobal::config.smartFocus); addHiddenCheckBox->setChecked(MusEGlobal::config.addHiddenTracks); unhideTracksCheckBox->setChecked(MusEGlobal::config.unhideTracks); @@ -370,7 +245,7 @@ void GlobalSettingsConfig::applyMdiSettings() void GlobalSettingsConfig::showEvent(QShowEvent* e) { QDialog::showEvent(e); - //updateSettings(); // TESTING + updateSettings(); } //--------------------------------------------------------- @@ -408,7 +283,6 @@ void GlobalSettingsConfig::apply() MusEGlobal::config.transportVisible = showTransport->isChecked(); MusEGlobal::config.bigTimeVisible = showBigtime->isChecked(); - //MusEGlobal::config.mixerVisible = showMixer->isChecked(); MusEGlobal::config.mixer1Visible = showMixer->isChecked(); MusEGlobal::config.mixer2Visible = showMixer2->isChecked(); @@ -427,10 +301,6 @@ void GlobalSettingsConfig::apply() MusEGlobal::config.geometryBigTime.setWidth(bigtimeW->value()); MusEGlobal::config.geometryBigTime.setHeight(bigtimeH->value()); - //MusEGlobal::config.geometryMixer.setX(mixerX->value()); - //MusEGlobal::config.geometryMixer.setY(mixerY->value()); - //MusEGlobal::config.geometryMixer.setWidth(mixerW->value()); - //MusEGlobal::config.geometryMixer.setHeight(mixerH->value()); MusEGlobal::config.mixer1.geometry.setX(mixerX->value()); MusEGlobal::config.mixer1.geometry.setY(mixerY->value()); MusEGlobal::config.mixer1.geometry.setWidth(mixerW->value()); @@ -449,11 +319,11 @@ void GlobalSettingsConfig::apply() MusEGlobal::config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); MusEGlobal::config.leftMouseButtonCanDecrease = lmbDecreasesCheckBox->isChecked(); MusEGlobal::config.rangeMarkerWithoutMMB = rangeMarkerWithoutMMBCheckBox->isChecked(); + MusEGlobal::config.smartFocus = smartFocusCheckBox->isChecked(); MusEGlobal::config.addHiddenTracks = addHiddenCheckBox->isChecked(); MusEGlobal::config.unhideTracks = unhideTracksCheckBox->isChecked(); - //MusEGlobal::muse->showMixer(MusEGlobal::config.mixerVisible); MusEGlobal::muse->showMixer1(MusEGlobal::config.mixer1Visible); MusEGlobal::muse->showMixer2(MusEGlobal::config.mixer2Visible); @@ -464,11 +334,6 @@ void GlobalSettingsConfig::apply() w->resize(MusEGlobal::config.geometryTransport.size()); w->move(MusEGlobal::config.geometryTransport.topLeft()); } - //w = MusEGlobal::muse->mixerWindow(); - //if (w) { - // w->resize(MusEGlobal::config.geometryMixer.size()); - // w->move(MusEGlobal::config.geometryMixer.topLeft()); - // } w = MusEGlobal::muse->mixer1Window(); if (w) { w->resize(MusEGlobal::config.mixer1.geometry.size()); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index aec753f1..2803c198 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -1470,6 +1470,49 @@ left button behave like the middle button in such areas.</string> </property> </widget> </item> + <item row="9" column="0"> + <widget class="QLabel" name="label5"> + <property name="text"> + <string>Smart focus (restart required)</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QCheckBox" name="smartFocusCheckBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + <property name="toolTip"> + <string>Smart focus</string> + </property> + <property name="whatsThis"> + <string>After editing, controls will return + focus to their respective canvas</string> + </property> + </widget> + </item> + <item row="10" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp index e53e1a05..1c35a3c2 100644 --- a/muse2/muse/widgets/knob.cpp +++ b/muse2/muse/widgets/knob.cpp @@ -340,6 +340,7 @@ void Knob::mousePressEvent(QMouseEvent *e) } setValue(v * halfRange + midValue); SliderBase::valueChange(); + emit sliderMoved(value(),id()); // sliderMoved is used by auxChanged // fake a left-click to make the knob still "stick" to // the mouse. diff --git a/muse2/muse/widgets/midisync.ui b/muse2/muse/widgets/midisync.ui index 81d7451e..a7464aaf 100644 --- a/muse2/muse/widgets/midisync.ui +++ b/muse2/muse/widgets/midisync.ui @@ -391,7 +391,7 @@ Enabled inputs in the list will <item row="5" column="0"> <widget class="QLabel" name="toBeDoneLabel"> <property name="text"> - <string>Note: Sync delay and MTC sync currently not fully implemeted</string> + <string>Note: Sync delay and MTC sync currently not fully implemented</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index c02bd7f1..06bf10d2 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -104,18 +104,43 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid //iChanDetectLabel->setPixmap(*darkgreendotIcon); iChanDetectLabel->setPixmap(*darkRedLedIcon); + recEchoButton->setFocusPolicy(Qt::NoFocus); recEchoButton->setIcon((selected && ((MusECore::MidiTrack*)selected)->recEcho()) ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon)); recEchoButton->setIconSize(midiThruOnIcon->size()); //recEchoButton->setOffPixmap(midiThruOffIcon); //recEchoButton->setOnPixmap(midiThruOnIcon); + iRButton->setFocusPolicy(Qt::NoFocus); iRButton->setIcon(QIcon(*routesMidiInIcon)); iRButton->setIconSize(routesMidiInIcon->size()); //iRButton->setOffPixmap(routesMidiInIcon); + oRButton->setFocusPolicy(Qt::NoFocus); oRButton->setIcon(QIcon(*routesMidiOutIcon)); oRButton->setIconSize(routesMidiOutIcon->size()); //oRButton->setOffPixmap(routesMidiOutIcon); + + recordButton->setFocusPolicy(Qt::NoFocus); + progRecButton->setFocusPolicy(Qt::NoFocus); + volRecButton->setFocusPolicy(Qt::NoFocus); + panRecButton->setFocusPolicy(Qt::NoFocus); + + iOutput->setFocusPolicy(Qt::StrongFocus); + iOutputChannel->setFocusPolicy(Qt::StrongFocus); + iHBank->setFocusPolicy(Qt::StrongFocus); + iLBank->setFocusPolicy(Qt::StrongFocus); + iProgram->setFocusPolicy(Qt::StrongFocus); + iHBank->setFocusPolicy(Qt::StrongFocus); + iLBank->setFocusPolicy(Qt::StrongFocus); + iProgram->setFocusPolicy(Qt::StrongFocus); + iLautst->setFocusPolicy(Qt::StrongFocus); + iLautst->setFocusPolicy(Qt::StrongFocus); + iTransp->setFocusPolicy(Qt::StrongFocus); + iAnschl->setFocusPolicy(Qt::StrongFocus); + iVerz->setFocusPolicy(Qt::StrongFocus); + iLen->setFocusPolicy(Qt::StrongFocus); + iKompr->setFocusPolicy(Qt::StrongFocus); + iPan->setFocusPolicy(Qt::StrongFocus); // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. trackNameLabel->setAlignment(Qt::AlignCenter); @@ -180,18 +205,18 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid connect(iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged())); connect(iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged())); connect(iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged())); - connect(iHBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); - connect(iLBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); - connect(iProgram, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); + connect(iHBank, SIGNAL(ctrlClicked()), SLOT(iProgramDoubleClicked())); + connect(iLBank, SIGNAL(ctrlClicked()), SLOT(iProgramDoubleClicked())); + connect(iProgram, SIGNAL(ctrlClicked()), SLOT(iProgramDoubleClicked())); connect(iLautst, SIGNAL(valueChanged(int)), SLOT(iLautstChanged(int))); - connect(iLautst, SIGNAL(doubleClicked()), SLOT(iLautstDoubleClicked())); + connect(iLautst, SIGNAL(ctrlClicked()), SLOT(iLautstDoubleClicked())); connect(iTransp, SIGNAL(valueChanged(int)), SLOT(iTranspChanged(int))); connect(iAnschl, SIGNAL(valueChanged(int)), SLOT(iAnschlChanged(int))); connect(iVerz, SIGNAL(valueChanged(int)), SLOT(iVerzChanged(int))); connect(iLen, SIGNAL(valueChanged(int)), SLOT(iLenChanged(int))); connect(iKompr, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int))); connect(iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int))); - connect(iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked())); + connect(iPan, SIGNAL(ctrlClicked()), SLOT(iPanDoubleClicked())); connect(iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int))); ///connect(iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&))); connect(recordButton, SIGNAL(clicked()), SLOT(recordClicked())); @@ -200,6 +225,38 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid connect(panRecButton, SIGNAL(clicked()), SLOT(panRecClicked())); connect(recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool))); connect(iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed())); + + connect(iOutputChannel, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iHBank, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iLBank, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iProgram, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iHBank, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iLBank, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iProgram, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iLautst, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iLautst, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iTransp, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iAnschl, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iVerz, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iLen, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iKompr, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(iPan, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + + connect(iOutputChannel, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iHBank, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iLBank, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iProgram, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iHBank, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iLBank, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iProgram, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iLautst, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iLautst, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iTransp, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iAnschl, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iVerz, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iLen, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iKompr, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(iPan, SIGNAL(escapePressed()), SIGNAL(escapePressed())); // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values... // Enabled (for Midi Port to Audio Input routing). p4.0.14 Tim. diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h index b816f289..a38dcf20 100644 --- a/muse2/muse/widgets/mtrackinfo.h +++ b/muse2/muse/widgets/mtrackinfo.h @@ -80,6 +80,10 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase void configChanged(); void songChanged(int); + signals: + void returnPressed(); + void escapePressed(); + public: MidiTrackInfo(QWidget*, MusECore::Track* = 0); MusECore::Track* track() const { return selected; } diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui index 0bf58d76..c9298a5f 100644 --- a/muse2/muse/widgets/mtrackinfobase.ui +++ b/muse2/muse/widgets/mtrackinfobase.ui @@ -588,7 +588,7 @@ </sizepolicy> </property> <property name="toolTip"> - <string>Bank Select MSB. Double-click on/off.</string> + <string>Bank Select MSB. Ctrl-click on/off.</string> </property> <property name="autoFillBackground"> <bool>false</bool> @@ -641,7 +641,7 @@ </sizepolicy> </property> <property name="toolTip"> - <string>Bank Select LSB. Double-click on/off.</string> + <string>Bank Select LSB. Ctrl-click on/off.</string> </property> <property name="autoFillBackground"> <bool>false</bool> @@ -694,7 +694,7 @@ </sizepolicy> </property> <property name="toolTip"> - <string>Program. Double-click on/off.</string> + <string>Program. Ctrl-click on/off.</string> </property> <property name="autoFillBackground"> <bool>false</bool> @@ -761,7 +761,7 @@ </sizepolicy> </property> <property name="toolTip"> - <string>Volume. Double-click on/off.</string> + <string>Volume. Ctrl-click on/off.</string> </property> <property name="autoFillBackground"> <bool>false</bool> @@ -828,10 +828,10 @@ </sizepolicy> </property> <property name="toolTip"> - <string>Change stereo position. Double-click on/off.</string> + <string>Change stereo position. Ctrl-click on/off.</string> </property> <property name="whatsThis"> - <string>Change stereo position. Double-click on/off.</string> + <string>Change stereo position. Ctrl-click on/off.</string> </property> <property name="autoFillBackground"> <bool>false</bool> diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 6cdc3812..398b6f5c 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -221,7 +221,8 @@ MusEGlobal::GlobalConfigValues config = { MusECore::DONT_REC_MUTED_OR_HIDDEN, true, // addHiddenTracks true, // unhideTracks - MusEGlobal::PREFER_NEW // drumTrackPreference + MusEGlobal::PREFER_NEW, // drumTrackPreference + false // smartFocus }; //--------------------------------------------------------- diff --git a/muse2/muse/widgets/noteinfo.cpp b/muse2/muse/widgets/noteinfo.cpp index 1411b7b5..a5002540 100644 --- a/muse2/muse/widgets/noteinfo.cpp +++ b/muse2/muse/widgets/noteinfo.cpp @@ -45,7 +45,7 @@ NoteInfo::NoteInfo(QWidget* parent) { setObjectName("Note Info"); deltaMode = false; - + //QLabel* label = new QLabel(tr("Start"), this, "Start"); QLabel* label = new QLabel(tr("Start")); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -55,6 +55,7 @@ NoteInfo::NoteInfo(QWidget* parent) //selTime = new PosEdit(this, "Start"); ///selTime = new PosEdit(0, "Start"); selTime = new Awl::PosEdit; + selTime->setFocusPolicy(Qt::StrongFocus); selTime->setObjectName("Start"); addWidget(selTime); @@ -65,7 +66,8 @@ NoteInfo::NoteInfo(QWidget* parent) label->setIndent(3); addWidget(label); //selLen = new QSpinBox(0, 100000, 1, this); - selLen = new QSpinBox(); + selLen = new SpinBox(); + selLen->setFocusPolicy(Qt::StrongFocus); selLen->setRange(0, 100000); selLen->setSingleStep(1); addWidget(selLen); @@ -77,6 +79,8 @@ NoteInfo::NoteInfo(QWidget* parent) addWidget(label); //selPitch = new PitchEdit(this, "selPitch"); selPitch = new PitchEdit; + selPitch->setFocusPolicy(Qt::StrongFocus); + selPitch->setDeltaMode(deltaMode); addWidget(selPitch); //label = new QLabel(tr("Velo On"), this, "Velocity On"); @@ -85,7 +89,8 @@ NoteInfo::NoteInfo(QWidget* parent) label->setIndent(3); addWidget(label); //selVelOn = new QSpinBox(0, 127, 1, this); - selVelOn = new QSpinBox(); + selVelOn = new SpinBox(); + selVelOn->setFocusPolicy(Qt::StrongFocus); selVelOn->setRange(0, 127); selVelOn->setSingleStep(1); addWidget(selVelOn); @@ -96,7 +101,8 @@ NoteInfo::NoteInfo(QWidget* parent) label->setIndent(3); addWidget(label); //selVelOff = new QSpinBox(0, 127, 1, this); - selVelOff = new QSpinBox(); + selVelOff = new SpinBox(); + selVelOff->setFocusPolicy(Qt::StrongFocus); selVelOff->setRange(0, 127); selVelOff->setSingleStep(1); addWidget(selVelOff); @@ -106,6 +112,18 @@ NoteInfo::NoteInfo(QWidget* parent) connect(selVelOn, SIGNAL(valueChanged(int)), SLOT(velOnChanged(int))); connect(selVelOff, SIGNAL(valueChanged(int)), SLOT(velOffChanged(int))); connect(selTime, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(timeChanged(const MusECore::Pos&))); + + connect(selLen, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(selPitch, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(selVelOn, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(selVelOff, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(selTime, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + + connect(selLen, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(selPitch, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(selVelOn, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(selVelOff, SIGNAL(escapePressed()), SIGNAL(escapePressed())); + connect(selTime, SIGNAL(escapePressed()), SIGNAL(escapePressed())); } //--------------------------------------------------------- @@ -114,6 +132,8 @@ NoteInfo::NoteInfo(QWidget* parent) void NoteInfo::setDeltaMode(bool val) { + if(val == deltaMode) + return; deltaMode = val; selPitch->setDeltaMode(val); if (val) { diff --git a/muse2/muse/widgets/noteinfo.h b/muse2/muse/widgets/noteinfo.h index 078ba85c..56079f34 100644 --- a/muse2/muse/widgets/noteinfo.h +++ b/muse2/muse/widgets/noteinfo.h @@ -29,8 +29,6 @@ namespace Awl { //class PitchEdit; }; -class QSpinBox; - ///class PosEdit; namespace MusECore { class Pos; @@ -39,6 +37,7 @@ class Pos; namespace MusEGui { class PitchEdit; +class SpinBox; //--------------------------------------------------------- // NoteInfo @@ -46,17 +45,15 @@ class PitchEdit; class NoteInfo : public QToolBar { Q_OBJECT - + ///PosEdit* selTime; Awl::PosEdit* selTime; - QSpinBox* selLen; + SpinBox* selLen; PitchEdit* selPitch; - QSpinBox* selVelOn; - QSpinBox* selVelOff; + SpinBox* selVelOn; + SpinBox* selVelOff; bool deltaMode; - - public: enum ValType {VAL_TIME, VAL_LEN, VAL_VELON, VAL_VELOFF, VAL_PITCH }; //NoteInfo(QMainWindow* parent); @@ -76,6 +73,8 @@ class NoteInfo : public QToolBar { signals: void valueChanged(MusEGui::NoteInfo::ValType, int); + void returnPressed(); + void escapePressed(); }; } // namespace MusEGui diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp index 3cbe882e..dd7524a2 100644 --- a/muse2/muse/widgets/pitchedit.cpp +++ b/muse2/muse/widgets/pitchedit.cpp @@ -31,7 +31,7 @@ namespace MusEGui { //--------------------------------------------------------- PitchEdit::PitchEdit(QWidget* parent) - : QSpinBox(parent) + : SpinBox(parent) { setMinimum(0); setMaximum(127); diff --git a/muse2/muse/widgets/pitchedit.h b/muse2/muse/widgets/pitchedit.h index bcd77100..83e117fd 100644 --- a/muse2/muse/widgets/pitchedit.h +++ b/muse2/muse/widgets/pitchedit.h @@ -23,7 +23,7 @@ #ifndef __PITCHEDIT_H__ #define __PITCHEDIT_H__ -#include <QSpinBox> +#include "spinbox.h" namespace MusEGui { @@ -31,7 +31,7 @@ namespace MusEGui { // PitchEdit //--------------------------------------------------------- -class PitchEdit : public QSpinBox { +class PitchEdit : public SpinBox { Q_OBJECT bool deltaMode; diff --git a/muse2/muse/widgets/projectcreate.ui b/muse2/muse/widgets/projectcreate.ui index d03f093c..7d42628e 100644 --- a/muse2/muse/widgets/projectcreate.ui +++ b/muse2/muse/widgets/projectcreate.ui @@ -7,197 +7,208 @@ <x>0</x> <y>0</y> <width>569</width> - <height>340</height> + <height>378</height> </rect> </property> <property name="windowTitle"> <string>Create Project</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QVBoxLayout" name="verticalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_8"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Projects folder:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="projDirLineEdit"> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="projDirToolButton"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Projects folder:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="projDirLineEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> </item> <item> - <widget class="Line" name="line"> + <widget class="QToolButton" name="projDirToolButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="gridLayout"> + <property name="horizontalSpacing"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Project Name:</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QCheckBox" name="templateCheckBox"> + <property name="text"> + <string>Project is a Template</string> + </property> + </widget> + </item> + <item row="0" column="4" rowspan="2"> + <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="3"> + <widget class="QCheckBox" name="winStateCheckbox"> + <property name="text"> + <string>Write window state</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="projectNameEdit"/> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Project song file type:</string> + </property> </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Project Name:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="projectNameEdit"/> - </item> - <item> - <widget class="QCheckBox" name="templateCheckBox"> - <property name="text"> - <string>Project is a Template</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <widget class="QComboBox" name="projectFileTypeCB"/> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Project Path to song file:</string> + </property> + </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Project song file type:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="projectFileTypeCB"/> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Project Path to song file:</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="createFolderCheckbox"> - <property name="text"> - <string>Create project folder (recommended for audio projects)</string> - </property> - </widget> - </item> - </layout> + <widget class="QCheckBox" name="createFolderCheckbox"> + <property name="text"> + <string>Create project folder (recommended for audio projects)</string> + </property> + </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLineEdit" name="storageDirEdit"> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="browseDirButton"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="restorePathButton"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> + <widget class="QLineEdit" name="storageDirEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> </item> <item> - <widget class="QLabel" name="label_3"> + <widget class="QToolButton" name="browseDirButton"> <property name="text"> - <string>Song information:</string> + <string>...</string> </property> </widget> </item> <item> - <widget class="QPlainTextEdit" name="commentEdit"/> + <widget class="QToolButton" name="restorePathButton"> + <property name="text"> + <string>...</string> + </property> + </widget> </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Song information:</string> + </property> + </widget> + </item> + <item> + <widget class="QPlainTextEdit" name="commentEdit"/> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> </item> </layout> </item> </layout> </widget> <tabstops> - <tabstop>projectNameEdit</tabstop> <tabstop>templateCheckBox</tabstop> <tabstop>projectFileTypeCB</tabstop> <tabstop>createFolderCheckbox</tabstop> diff --git a/muse2/muse/widgets/projectcreateimpl.cpp b/muse2/muse/widgets/projectcreateimpl.cpp index 665d725e..d34ccd2d 100644 --- a/muse2/muse/widgets/projectcreateimpl.cpp +++ b/muse2/muse/widgets/projectcreateimpl.cpp @@ -76,7 +76,7 @@ ProjectCreateImpl::ProjectCreateImpl(QWidget *parent) : //createFolderCheckbox->setChecked(MusEGlobal::config.projectStoreInFolder && is_new); // Suggest no folder if not new. - connect(templateCheckBox,SIGNAL(clicked()), this, SLOT(templateButtonChanged())); + connect(templateCheckBox,SIGNAL(toggled(bool)), this, SLOT(templateButtonChanged(bool))); //connect(templateCheckBox,SIGNAL(clicked()), this, SLOT(updateDirectoryPath())); connect(projDirToolButton,SIGNAL(clicked()), this, SLOT(browseProjDir())); connect(restorePathButton,SIGNAL(clicked()), this, SLOT(restorePath())); @@ -215,9 +215,10 @@ void ProjectCreateImpl::browseProjDir() } } -void ProjectCreateImpl::templateButtonChanged() +void ProjectCreateImpl::templateButtonChanged(bool v) { - restorePathButton->setEnabled(templateCheckBox->isChecked() ? !overrideTemplDirPath.isEmpty() : !overrideDirPath.isEmpty()); + restorePathButton->setEnabled(v ? !overrideTemplDirPath.isEmpty() : !overrideDirPath.isEmpty()); + winStateCheckbox->setChecked(!v); updateDirectoryPath(); } @@ -231,12 +232,18 @@ void ProjectCreateImpl::restorePath() updateDirectoryPath(); } -/* -bool ProjectCreateImpl::getProjectIsTemplate() const + +bool ProjectCreateImpl::getWriteTopwins() const { - return templateCheckBox->isChecked(); + return winStateCheckbox->isChecked(); } +void ProjectCreateImpl::setWriteTopwins(bool v) +{ + winStateCheckbox->setChecked(v); +} + +/* QString ProjectCreateImpl::getTemplatePath() const { return templDirPath; diff --git a/muse2/muse/widgets/projectcreateimpl.h b/muse2/muse/widgets/projectcreateimpl.h index f08cb1bc..3cee0c52 100644 --- a/muse2/muse/widgets/projectcreateimpl.h +++ b/muse2/muse/widgets/projectcreateimpl.h @@ -42,7 +42,8 @@ public: explicit ProjectCreateImpl(QWidget *parent = 0); QString getProjectPath() const; QString getSongInfo() const; - //bool getProjectIsTemplate() const; + bool getWriteTopwins() const; + void setWriteTopwins(bool); //QString getTemplatePath() const; signals: @@ -54,7 +55,7 @@ protected slots: void ok(); void createProjFolderChanged(); void browseProjDir(); - void templateButtonChanged(); + void templateButtonChanged(bool); void restorePath(); }; diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp index 3e2ad008..72bcb05d 100644 --- a/muse2/muse/widgets/routepopup.cpp +++ b/muse2/muse/widgets/routepopup.cpp @@ -671,7 +671,7 @@ int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id #ifdef _USE_CUSTOM_WIDGET_ACTIONS_ - PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + md->name(), + PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + (md ? md->name() : tr("<none>")), redLedIcon, darkRedLedIcon,MIDI_CHANNELS, chanmask, pup); MusECore::Route srcRoute(i, 0); // Ignore the routing channels - our action holds the channels. //wa->setData(id++); @@ -1331,7 +1331,7 @@ void RoutePopupMenu::prepare() #ifdef _USE_CUSTOM_WIDGET_ACTIONS_ - PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + md->name(), + PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + (md ? md->name() : tr("<none>")), redLedIcon, darkRedLedIcon, MIDI_CHANNELS, chanmask, this); MusECore::Route srcRoute(i, 0); // Ignore the routing channels - our action holds the channels. //wa->setData(id++); diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp index 730e4828..b0b5d4ce 100644 --- a/muse2/muse/widgets/spinbox.cpp +++ b/muse2/muse/widgets/spinbox.cpp @@ -22,10 +22,28 @@ #include <QKeyEvent> #include <QEvent> +#include <QLineEdit> +#include <QMouseEvent> #include "spinbox.h" namespace MusEGui { +//void SpinBoxLineEdit::mouseDoubleClickEvent(QMouseEvent* e) +//{ +// QLineEdit::mouseDoubleClickEvent(e); +// emit doubleClicked(); +// if((e->buttons() & Qt::LeftButton) && (e->modifiers() & Qt::ControlModifier)) +// emit ctrlDoubleClicked(); +//} + +void SpinBoxLineEdit::mousePressEvent(QMouseEvent* e) +{ + QLineEdit::mousePressEvent(e); + //selectAll(); + if((e->buttons() & Qt::LeftButton) && (e->modifiers() & Qt::ControlModifier)) + emit ctrlClicked(); +} + //--------------------------------------------------------- // SpinBox //--------------------------------------------------------- @@ -33,85 +51,54 @@ namespace MusEGui { SpinBox::SpinBox(QWidget* parent) : QSpinBox(parent) { - _clearFocus = true; + SpinBoxLineEdit* le = new SpinBoxLineEdit(this); + setLineEdit(le); + setKeyboardTracking(false); + + //connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); + //connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); + connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); } SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent) : QSpinBox(parent) { + SpinBoxLineEdit* le = new SpinBoxLineEdit(this); + setLineEdit(le); setRange(minValue, maxValue); setSingleStep(step); - _clearFocus = true; -} + setKeyboardTracking(false); -bool SpinBox::eventFilter(QObject* o, QEvent* ev) -{ - // if (o != (QObject*)editor()) ddskrjo can't find editor() - // return QSpinBox::eventFilter(o,ev); - - bool retval = false; - if(ev->type() == QEvent::KeyPress) - { - QKeyEvent* k = (QKeyEvent*)ev; - if(k->key() == Qt::Key_Up || k->key() == Qt::Key_Down) - { - // stepUp/stepDown will be called. Set this now. - _clearFocus = false; - } - else if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return) - { - // With this line, two enter presses after an edit will clear focus. - // Without, just one enter press clears the focus. - //if(!editor()->isModified()) - { - clearFocus(); - return true; - } - } - } - else - if(ev->type() == QEvent::MouseButtonDblClick) - { - emit doubleClicked(); - return true; - } - - retval = QSpinBox::eventFilter(o, ev); - - return retval; -} - -void SpinBox::stepUp() -{ - QSpinBox::stepUp(); - if(_clearFocus) - clearFocus(); - else - _clearFocus = true; -} - -void SpinBox::stepDown() -{ - QSpinBox::stepDown(); - if(_clearFocus) - clearFocus(); - else - _clearFocus = true; + //connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); + //connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); + connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); } void SpinBox::keyPressEvent(QKeyEvent* ev) { switch (ev->key()) { case Qt::Key_Return: - clearFocus(); - //emit returnPressed(); - // return; - break; + QSpinBox::keyPressEvent(ev); + emit returnPressed(); + return; + break; + case Qt::Key_Escape: + emit escapePressed(); + return; + break; default: - break; + break; } QSpinBox::keyPressEvent(ev); } +void SpinBox::wheelEvent(QWheelEvent* e) +{ + QSpinBox::wheelEvent(e); + // Need this because Qt doesn't deselect the text if not focused. + if(!hasFocus() && lineEdit()) + lineEdit()->deselect(); +} + } // namespace MusEGui diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h index cd37fb32..261ba05e 100644 --- a/muse2/muse/widgets/spinbox.h +++ b/muse2/muse/widgets/spinbox.h @@ -24,14 +24,43 @@ // Click up/down, or mousewheel, or hit enter with un-modified text (which means enter TWICE for modified text), // and the control will give up focus, thereby allowing you to use global shortcut keys afterwards. // Up/down keys still keep the focus. +// +// < Old. That was the SpinBox behaviour in MusE1 (Qt3). They are still desirable goals for MusE2 (Qt4). +// < Flaw: Calling clearFocus() means nothing has focus, not canvases, not even the active top level window. We want canvases to have it. +// < That requires (here in MusE2) setting top win focus proxies and using Application::focusChanged() to redirect focus to the +// < active window's proxy. +// < Very ugly. And with MDI, even more complicated to give focus back to current sub-window. Tried, was crash-prone. +// < Also, toolbars can be floated, so calling clearFocus() from a SpinBox on a floating toolbar means nothing has focus but the +// < toolbar itself is the active window, which requires setting a focus proxy on the toolbar so that Application::focusChanged() +// < can figure out who to give the focus to! +// < It seems we will have to use signals/slots instead of clearFocus()... +// < Flaw: Clearing focus when up/down clicked (when stepBy() is called), auto-repeat might not work because the control has lost focus. + #ifndef __SPINBOX_H__ #define __SPINBOX_H__ #include <QSpinBox> -#include <QEvent> +#include <QLineEdit> namespace MusEGui { +class SpinBoxLineEdit : public QLineEdit +{ + Q_OBJECT + + protected: + //virtual void mouseDoubleClickEvent(QMouseEvent* e); + virtual void mousePressEvent(QMouseEvent* e); + + signals: + //void doubleClicked(); + //void ctrlDoubleClicked(); + void ctrlClicked(); + + public: + SpinBoxLineEdit(QWidget* parent = 0) : QLineEdit(parent) {}; +}; + //--------------------------------------------------------- // SpinBox //--------------------------------------------------------- @@ -39,18 +68,16 @@ namespace MusEGui { class SpinBox : public QSpinBox { Q_OBJECT - bool _clearFocus; - protected: - bool eventFilter(QObject* obj, QEvent* ev); virtual void keyPressEvent(QKeyEvent*); + virtual void wheelEvent(QWheelEvent*); - public slots: - virtual void stepUp(); - virtual void stepDown(); - signals: - void doubleClicked(); + //void doubleClicked(); + //void ctrlDoubleClicked(); + void ctrlClicked(); + void returnPressed(); + void escapePressed(); public: SpinBox(QWidget* parent=0); diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 589726a9..60140ee2 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -69,6 +69,7 @@ Toolbar1::Toolbar1(QWidget* parent, int r, bool sp) solo = new QToolButton(); solo->setText(tr("Solo")); solo->setCheckable(true); + solo->setFocusPolicy(Qt::NoFocus); addWidget(solo); //--------------------------------------------------- @@ -94,6 +95,7 @@ Toolbar1::Toolbar1(QWidget* parent, int r, bool sp) //--------------------------------------------------- raster = new LabelCombo(tr("Snap"), 0); + raster->setFocusPolicy(Qt::TabFocus); rlist = new QTableWidget(10, 3); rlist->verticalHeader()->setDefaultSectionSize(22); @@ -130,6 +132,7 @@ void Toolbar1::_rasterChanged(int /*i*/) //void Toolbar1::_rasterChanged(int r, int c) { emit rasterChanged(rasterTable[rlist->currentRow() + rlist->currentColumn() * 10]); + //parentWidget()->setFocus(); //emit rasterChanged(rasterTable[r + c * 10]); } diff --git a/muse2/muse/widgets/tempolabel.cpp b/muse2/muse/widgets/tempolabel.cpp index cc628f50..565a61c1 100644 --- a/muse2/muse/widgets/tempolabel.cpp +++ b/muse2/muse/widgets/tempolabel.cpp @@ -80,7 +80,7 @@ QSize TempoLabel::sizeHint() const //--------------------------------------------------------- TempoEdit::TempoEdit(QWidget* parent) - : QDoubleSpinBox(parent) + : DoubleSpinBox(parent) { curVal = -1.0; setSingleStep(1.0); diff --git a/muse2/muse/widgets/tempolabel.h b/muse2/muse/widgets/tempolabel.h index 50d70180..555b985d 100644 --- a/muse2/muse/widgets/tempolabel.h +++ b/muse2/muse/widgets/tempolabel.h @@ -24,7 +24,7 @@ #define __TEMPOLABEL_H__ #include <QLabel> -#include <QDoubleSpinBox> +#include "doublespinbox.h" namespace MusEGui { @@ -54,7 +54,7 @@ class TempoLabel : public QLabel { // TempoEdit //--------------------------------------------------------- -class TempoEdit : public QDoubleSpinBox { +class TempoEdit : public DoubleSpinBox { Q_OBJECT double curVal; |