From b1b4e15d4eba560fa1898c1ba840a24d66e439c0 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Thu, 18 Nov 2010 03:34:35 +0000 Subject: Qt4 port of .ui widgets --- muse2/ChangeLog | 1 + muse2/muse/app.cpp | 6 +- muse2/muse/midiedit/dcanvas.cpp | 2 +- muse2/muse/midiedit/prcanvas.cpp | 2 +- muse2/muse/mplugins/mitplugin.cpp | 2 - muse2/muse/mplugins/mittranspose.cpp | 10 +- muse2/muse/mplugins/mittranspose.h | 23 +- muse2/muse/muse.pro | 1 + muse2/muse/widgets/CMakeLists.txt | 7 +- muse2/muse/widgets/mittransposebase.ui | 232 +++++++++-------- muse2/muse/widgets/songinfo.h | 37 +++ muse2/muse/widgets/songinfo.ui | 222 ++++++++--------- muse2/muse/widgets/velocity.cpp | 23 +- muse2/muse/widgets/velocity.h | 25 +- muse2/muse/widgets/velocitybase.ui | 438 ++++++++++++++++----------------- 15 files changed, 534 insertions(+), 497 deletions(-) create mode 100644 muse2/muse/widgets/songinfo.h diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 3585d00a..27a35b8c 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,6 +1,7 @@ 17.11.2010 - Removed a fix which cured graphic corruption for me in MusE-1. Not required now. (Tim) - Small change to Orcan's filedialog, re-enabled global button. (Tim) + - Ported the following .ui widgets to Qt4: songinfo, mittransposebase, velocitybase (Orcan) 16.11.2010 - Fixed track info sizing problems. In Arranger::switchInfo() added tgrid->update(). (Tim) QLayout::update() seems to be a new method, we needed to call it here. diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 1bdcee8e..234897be 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -3124,13 +3124,13 @@ void MusE::startWaveEditor(PartList* pl) void MusE::startSongInfo(bool editable) { printf("startSongInfo!!!!\n"); - SongInfo info; - info.songInfoText->setText(song->getSongInfo()); + SongInfoWidget info; + info.songInfoText->setPlainText(song->getSongInfo()); info.songInfoText->setReadOnly(!editable); info.show(); if( info.exec() == QDialog::Accepted) { if (editable) - song->setSongInfo(info.songInfoText->text()); + song->setSongInfo(info.songInfoText->toPlainText()); } } diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 65138bb4..9ad99b0e 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -765,7 +765,7 @@ void DrumCanvas::cmd(int cmd) break; case CMD_MODIFY_VELOCITY: { - Velocity w(this); + Velocity w; w.setRange(0); //TODO: Make this work! Probably put _to & _toInit in ecanvas instead if (!w.exec()) break; diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 484a12ad..b9116628 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -1055,7 +1055,7 @@ void PianoCanvas::cmd(int cmd, int quantStrength, case CMD_MODIFY_VELOCITY: { - Velocity w(this); + Velocity w; w.setRange(range); if (!w.exec()) break; diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp index d8066e2c..1923f1d6 100644 --- a/muse2/muse/mplugins/mitplugin.cpp +++ b/muse2/muse/mplugins/mitplugin.cpp @@ -6,8 +6,6 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include - #include "mitplugin.h" #include "app.h" #include "event.h" diff --git a/muse2/muse/mplugins/mittranspose.cpp b/muse2/muse/mplugins/mittranspose.cpp index b9a260c9..95b3b3de 100644 --- a/muse2/muse/mplugins/mittranspose.cpp +++ b/muse2/muse/mplugins/mittranspose.cpp @@ -6,12 +6,8 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include -#include -#include -#include -//Added by qt3to4: #include +#include #include "mittranspose.h" #include "song.h" @@ -26,8 +22,8 @@ MITPluginTranspose* mitPluginTranspose; // MITPluginTranspose //--------------------------------------------------------- -MITPluginTranspose::MITPluginTranspose(QWidget* parent, const char* name, Qt::WFlags fl) - : MITTransposeBase(parent, name, fl) +MITPluginTranspose::MITPluginTranspose(QWidget* parent, Qt::WFlags fl) + : MITTransposeBaseWidget(parent, fl) { on = false; transpose = 0; diff --git a/muse2/muse/mplugins/mittranspose.h b/muse2/muse/mplugins/mittranspose.h index b942eddf..b794e274 100644 --- a/muse2/muse/mplugins/mittranspose.h +++ b/muse2/muse/mplugins/mittranspose.h @@ -10,10 +10,10 @@ #define __MITTRANSPOSE_H__ #include "mitplugin.h" -#include "mittransposebase.h" +#include "ui_mittransposebase.h" #include -//Added by qt3to4: -#include + +class QCloseEvent; struct KeyOn { unsigned char pitch; @@ -33,11 +33,24 @@ typedef KeyOnList::iterator iKeyOn; class Xml; +//--------------------------------------------------------- +// MITTransposeBaseWidget +// Wrapper around Ui::MITTransposeBase +//--------------------------------------------------------- + +class MITTransposeBaseWidget : public QWidget, public Ui::MITTransposeBase +{ + Q_OBJECT + + public: + MITTransposeBaseWidget(QWidget *parent = 0, Qt::WFlags f = 0) : QWidget(parent, f) { setupUi(this); } +}; + //--------------------------------------------------------- // MITPluginTranspose //--------------------------------------------------------- -class MITPluginTranspose : public MITTransposeBase, public MITPlugin { +class MITPluginTranspose : public MITTransposeBaseWidget, public MITPlugin { Q_OBJECT KeyOnList keyOnList; @@ -58,7 +71,7 @@ class MITPluginTranspose : public MITTransposeBase, public MITPlugin { void noteReceived(); public: - MITPluginTranspose(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0); + MITPluginTranspose(QWidget* parent = 0, Qt::WFlags fl = 0); virtual void process(MEvent&); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; diff --git a/muse2/muse/muse.pro b/muse2/muse/muse.pro index 183ac3a8..2931e82d 100644 --- a/muse2/muse/muse.pro +++ b/muse2/muse/muse.pro @@ -153,6 +153,7 @@ HEADERS = \ ./widgets/sliderbase.h \ ./widgets/scldraw.h \ ./widgets/citem.h \ + ./widgets/songinfo.h \ ./mididev.h \ ./midictrl.h \ ./midiseq.h \ diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index f7be819a..7cbcb959 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -128,10 +128,14 @@ QT4_WRAP_CPP (widget_mocs checkbox.h vscale.h action.h + songinfo.h ) QT4_WRAP_UI (UIC fdialogbuttons.ui + mittransposebase.ui + songinfo.ui + velocitybase.ui ) @@ -147,7 +151,6 @@ QT4_WRAP_UI3 (widget_ui_headers commentbase.ui synthconfigbase.ui gatetimebase.ui - velocitybase.ui metronomebase.ui mtrackinfobase.ui wtrackinfobase.ui @@ -156,11 +159,9 @@ QT4_WRAP_UI3 (widget_ui_headers editnotedialogbase.ui editsysexdialogbase.ui cliplisteditorbase.ui - mittransposebase.ui shortcutconfigbase.ui shortcutcapturedialogbase.ui aboutbox.ui - songinfo.ui didyouknow.ui configmidifilebase.ui ) diff --git a/muse2/muse/widgets/mittransposebase.ui b/muse2/muse/widgets/mittransposebase.ui index 60cd4d9b..20b8c8c3 100644 --- a/muse2/muse/widgets/mittransposebase.ui +++ b/muse2/muse/widgets/mittransposebase.ui @@ -1,117 +1,115 @@ - -MITTransposeBase - - - MITTransposeBase - - - - 0 - 0 - 423 - 50 - - - - MusE: Midi Input Plugin: Transpose - - - - unnamed - - - 11 - - - 6 - - - - onCheckBox - - - On - - - - - TextLabel1 - - - TriggerKey - - - AlignVCenter|AlignRight - - - 5 - - - - - triggerKeySpinBox - - - - - TextLabel2 - - - Transpose: - - - AlignVCenter|AlignRight - - - 5 - - - - - transposeLabel - - - - 5 - 0 - 0 - 0 - - - - - 255 - 255 - 255 - - - - Panel - - - 2 - - - 2 - - - 2 - - - +0 - - - AlignVCenter|AlignRight - - - 5 - - - - - - - pitchedit.h - - - + + + MITTransposeBase + + + + 0 + 0 + 423 + 50 + + + + MusE: Midi Input Plugin: Transpose + + + + 6 + + + 11 + + + + + On + + + + + + + TriggerKey + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 5 + + + + + + + + + + Transpose: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 5 + + + + + + + + 0 + 0 + + + + QFrame::Panel + + + 2 + + + 2 + + + +0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 2 + + + 5 + + + + + + + qPixmapFromMimeSource + + + PitchEdit + QWidget +
pitchedit.h
+
+
+ + pitchedit.h + + + +
diff --git a/muse2/muse/widgets/songinfo.h b/muse2/muse/widgets/songinfo.h new file mode 100644 index 00000000..d566e00a --- /dev/null +++ b/muse2/muse/widgets/songinfo.h @@ -0,0 +1,37 @@ +//============================================================================= +// MusE +// Linux Music Editor +// $Id: songinfo.h,v 1.0.0.0 2010/11/17 01:01:01 ogetbilo Exp $ +// +// Copyright (C) 1999-2010 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// 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., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#include "ui_songinfo.h" + +class QDialog; + + +//--------------------------------------------------------- +// SongInfoWidget +// Wrapper around Ui::SongInfo +//--------------------------------------------------------- + +class SongInfoWidget : public QDialog, public Ui::SongInfo +{ + Q_OBJECT + + public: + SongInfoWidget(QDialog *parent = 0) : QDialog(parent) { setupUi(this); } +}; diff --git a/muse2/muse/widgets/songinfo.ui b/muse2/muse/widgets/songinfo.ui index 2e4e7e80..f98c2ffa 100644 --- a/muse2/muse/widgets/songinfo.ui +++ b/muse2/muse/widgets/songinfo.ui @@ -1,115 +1,109 @@ - -SongInfo - - - SongInfo - - - - 0 - 0 - 403 - 274 - - - - Song Information - - - - unnamed - - - - layout2 - - - - unnamed - - - 0 - - - - songInfoText - - - - - layout1 - - - - unnamed - - - - spacer1 - - - Horizontal - - - Expanding - - - - 311 - 20 - - - - - - buttonCancel - - - &Cancel - - - Alt+C - - - - - buttonOk - - - &Ok - - - Alt+O - - - true - - - - - + + + SongInfo + + + + 0 + 0 + 403 + 274 + + + + Song Information + + + + + + 0 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 311 + 20 + + + + + + + + &Cancel + + + Alt+C + - - - - - buttonOk - clicked() - SongInfo - accept() - - - buttonCancel - clicked() - SongInfo - reject() - - - - songinfo.ui.h - - - buttonOk_clicked() - - - + + + + + &Ok + + + Alt+O + + + true + + + + + + + + + + + qPixmapFromMimeSource + + + + buttonOk + clicked() + SongInfo + accept() + + + 20 + 20 + + + 20 + 20 + + + + + buttonCancel + clicked() + SongInfo + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp index 42eed7c9..209caa72 100644 --- a/muse2/muse/widgets/velocity.cpp +++ b/muse2/muse/widgets/velocity.cpp @@ -5,22 +5,21 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include -#include -//#include -#include - +#include #include "velocity.h" -#include "song.h" - //--------------------------------------------------------- // Velocity //--------------------------------------------------------- -Velocity::Velocity(QWidget* parent, const char* name) - : VelocityBase(parent, name, true) +Velocity::Velocity(QDialog* parent) + : VelocityBaseWidget(parent) { + rangeGroup = new QButtonGroup; + rangeGroup->addButton(allEvents,0); + rangeGroup->addButton(selectedEvents,1); + rangeGroup->addButton(loopedEvents,2); + rangeGroup->addButton(selectedLooped,3); } //--------------------------------------------------------- @@ -29,10 +28,10 @@ Velocity::Velocity(QWidget* parent, const char* name) void Velocity::accept() { - _range = rangeGroup->id(rangeGroup->selected()); + _range = rangeGroup->checkedId(); _rateVal = rate->value(); _offsetVal = offset->value(); - VelocityBase::accept(); + VelocityBaseWidget::accept(); } //--------------------------------------------------------- @@ -41,6 +40,6 @@ void Velocity::accept() void Velocity::setRange(int id) { - rangeGroup->setButton(id); + rangeGroup->button(id)->setChecked(true); } diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h index 6d2ca60a..ad8a3b8d 100644 --- a/muse2/muse/widgets/velocity.h +++ b/muse2/muse/widgets/velocity.h @@ -8,24 +8,43 @@ #ifndef __VELOCITY_H__ #define __VELOCITY_H__ -#include "velocitybase.h" +#include "ui_velocitybase.h" + +class QButtonGroup; + +//--------------------------------------------------------- +// VelocityBaseWidget +// Wrapper around Ui::VelocityBase +//--------------------------------------------------------- + +class VelocityBaseWidget : public QDialog, public Ui::VelocityBase +{ + Q_OBJECT + + public: + VelocityBaseWidget(QDialog *parent = 0) + : QDialog(parent) + { setupUi(this); } +}; + //--------------------------------------------------------- // Velocity //--------------------------------------------------------- -class Velocity : public VelocityBase { +class Velocity : public VelocityBaseWidget { int _range; int _rateVal; int _offsetVal; Q_OBJECT + QButtonGroup* rangeGroup; protected slots: void accept(); public: - Velocity(QWidget* parent, const char* name = 0); + Velocity(QDialog* parent = 0); void setRange(int id); int range() const { return _range; } int rateVal() const { return _rateVal; } diff --git a/muse2/muse/widgets/velocitybase.ui b/muse2/muse/widgets/velocitybase.ui index e1510348..9b169c3a 100644 --- a/muse2/muse/widgets/velocitybase.ui +++ b/muse2/muse/widgets/velocitybase.ui @@ -1,232 +1,212 @@ - -VelocityBase - - - VelocityBase - - - - 0 - 0 - 275 - 274 - - - - MusE: Modify Velocity - - - - unnamed + + + VelocityBase + + + + 0 + 0 + 275 + 316 + + + + MusE: Modify Velocity + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events - - 11 + + + + + + Selected Events - - 6 + + true - - - rangeGroup - - - Range - - - true - - - - unnamed - - - 11 - - - 6 - - - - RadioButton5 - - - All Events - - - 0 - - - - - RadioButton6 - - - Selected Events - - - true - - - 1 - - - - - RadioButton7 - - - Looped Events - - - 2 - - - - - RadioButton8 - - - Selected & Looped - - - 3 - - - - - - - GroupBox3 - - - Values - - - - unnamed - - - 11 - - - 6 - - - - TextLabel3 - - - Rate: - - - - - TextLabel4 - - - Offset: - - - - - rate - - - % - - - 200 - - - 100 - - - - - offset - - - 127 - - - 1 - - - 1 - - - - - - - Layout3 - - - - unnamed - - - 0 - - - 6 - - - - Spacer1 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - okButton - - - OK - - - false - - - true - - - - - cancelButton - - - Cancel - - - - - - - - - okButton - clicked() - VelocityBase - accept() - - - cancelButton - clicked() - VelocityBase - reject() - - - - + + + + + + Looped Events + + + + + + + Selected & Looped + + + + + + + + + + Values + + + + 11 + + + 6 + + + + + Rate: + + + false + + + + + + + % + + + 200 + + + 100 + + + + + + + Offset: + + + false + + + + + + + 1 + + + 127 + + + 1 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + qPixmapFromMimeSource + + + + okButton + clicked() + VelocityBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + VelocityBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + -- cgit v1.2.3