From 16dbc206d810e3c753800b9503e38f129847592f Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sat, 27 Nov 2010 00:49:10 +0000 Subject: Converted comboQuant widget to Qt4 (in miditransform dialog). --- muse2/ChangeLog | 2 ++ muse2/muse/miditransform.cpp | 2 +- muse2/muse/mplugins/midiitransform.cpp | 5 ++-- muse2/muse/widgets/comboQuant.cpp | 49 +++++++++++++++++++++++++++------- muse2/muse/widgets/comboQuant.h | 12 ++++++--- muse2/muse/widgets/tb1.cpp | 10 +++---- muse2/muse/widgets/tb1.h | 6 +---- muse2/muse/widgets/transformbase.ui | 2 +- 8 files changed, 60 insertions(+), 28 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 0fd05dd4..2790e03f 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -5,6 +5,8 @@ (maxValue -> maximum, minValue -> minimum etc). (Tim) - Fixed SpinBoxFP class. Was never right before. (Tim) - Fixed transform and input transform ui files and dialogs - using the corrected SpinBoxFP. (Tim) + - Converted comboQuant widget to Qt4 (found in miditransform dialog). + TODO: Doesn't actually open - why? (Tim) 25.11.2010 - Fixed column widths, alignments, device renaming and jack device creation issues in synthconfigbase. Somehow the last changelog entry about this didn't get committed. That's added too. (Orcan) diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 60ab7517..6593e826 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -22,7 +22,7 @@ #include "xml.h" #include "globals.h" #include "comboQuant.h" -#include "pitchedit.h" +//#include "pitchedit.h" #include "audio.h" #include "gconfig.h" #include "midictrl.h" diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index c31ac7ec..22f3630f 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -25,8 +25,9 @@ #include "xml.h" #include "globals.h" #include "gconfig.h" -#include "comboQuant.h" -#include "pitchedit.h" +//#include "comboQuant.h" +//#include "pitchedit.h" +#include "helper.h" #define MIDITRANSFORM_NOTE 0 #define MIDITRANSFORM_POLY 1 diff --git a/muse2/muse/widgets/comboQuant.cpp b/muse2/muse/widgets/comboQuant.cpp index 4a81bc8e..ec3a4f4a 100644 --- a/muse2/muse/widgets/comboQuant.cpp +++ b/muse2/muse/widgets/comboQuant.cpp @@ -5,7 +5,10 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include +#include +#include +#include + #include "comboQuant.h" static int quantTable[] = { @@ -24,15 +27,33 @@ static const char* quantStrings[] = { // ComboQuant //--------------------------------------------------------- -ComboQuant::ComboQuant(QWidget* parent, const char* name) - : QComboBox(parent, name) +ComboQuant::ComboQuant(QWidget* parent) + : QComboBox(parent) { - Q3ListBox* qlist = new Q3ListBox(this); - qlist->setMinimumWidth(95); + ///Q3ListBox* qlist = new Q3ListBox(this); + ///qlist->setMinimumWidth(95); //setListBox(qlist); ddskrjo - qlist->setColumnMode(3); - for (int i = 0; i < 24; i++) - qlist->insertItem(tr(quantStrings[i]), i); + ///qlist->setColumnMode(3); + + + qlist = new QTableWidget(8, 3); + qlist->verticalHeader()->setDefaultSectionSize(22); + qlist->horizontalHeader()->setDefaultSectionSize(32); + qlist->setSelectionMode(QAbstractItemView::SingleSelection); + qlist->verticalHeader()->hide(); + qlist->horizontalHeader()->hide(); + + qlist->setMinimumWidth(96); + + setView(qlist); + + ///for (int i = 0; i < 24; i++) + /// qlist->insertItem(tr(quantStrings[i]), i); + for (int j = 0; j < 3; j++) + for (int i = 0; i < 8; i++) + qlist->setItem(i, j, new QTableWidgetItem(tr(quantStrings[i + j * 8]))); + + connect(this, SIGNAL(activated(int)), SLOT(activated(int))); } @@ -42,7 +63,8 @@ ComboQuant::ComboQuant(QWidget* parent, const char* name) void ComboQuant::activated(int index) { - emit valueChanged(quantTable[index]); + ///emit valueChanged(quantTable[index]); + emit valueChanged(quantTable[qlist->currentRow() + qlist->currentColumn() * 8]); } //--------------------------------------------------------- @@ -57,5 +79,14 @@ void ComboQuant::setValue(int val) return; } } + + for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) { + if (val == quantTable[i]) { + setCurrentIndex(i); + return; + } + } + printf("ComboQuant::setValue(%d) not defined\n", val); + setCurrentIndex(0); } diff --git a/muse2/muse/widgets/comboQuant.h b/muse2/muse/widgets/comboQuant.h index 0031fa33..501f0a14 100644 --- a/muse2/muse/widgets/comboQuant.h +++ b/muse2/muse/widgets/comboQuant.h @@ -8,8 +8,12 @@ #ifndef __COMBOQUANT_H__ #define __COMBOQUANT_H__ -#include -#include +#include +//#include +//#include + +class QWidget; +class QTableWidget; //--------------------------------------------------------- // ComboQuant @@ -18,6 +22,8 @@ class ComboQuant : public QComboBox { Q_OBJECT + QTableWidget* qlist; + private slots: void activated(int); @@ -25,7 +31,7 @@ class ComboQuant : public QComboBox { void valueChanged(int); public: - ComboQuant(QWidget* parent = 0, const char* name = 0); + ComboQuant(QWidget* parent = 0); void setValue(int val); }; diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 180632eb..ab4961cc 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -5,20 +5,16 @@ // (C) Copyright 1999 Werner Schweer (ws@seh.de) //========================================================= -#include +//#include #include #include -//#include -//#include -//#include -//#include -// p4.0.3 #include #include #include #include -#include +#include +#include #include "config.h" #include "lcombo.h" diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h index 803f55fd..bbd52469 100644 --- a/muse2/muse/widgets/tb1.h +++ b/muse2/muse/widgets/tb1.h @@ -8,9 +8,6 @@ #ifndef __TB1_H__ #define __TB1_H__ -//#include -//#include - #include #include @@ -25,8 +22,7 @@ class QTableWidget; // Toolbar1 //--------------------------------------------------------- -//class Toolbar1 : public Q3ToolBar { -class Toolbar1 : public QToolBar { // p4.0.4 +class Toolbar1 : public QToolBar { QToolButton* solo; PosLabel* pos; PitchLabel* pitch; diff --git a/muse2/muse/widgets/transformbase.ui b/muse2/muse/widgets/transformbase.ui index 1b8ca5f2..578b4a97 100644 --- a/muse2/muse/widgets/transformbase.ui +++ b/muse2/muse/widgets/transformbase.ui @@ -992,7 +992,7 @@ ComboQuant - QWidget + QComboBox
comboQuant.h
-- cgit v1.2.3