diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 1 | ||||
-rw-r--r-- | muse2/muse/confmport.cpp | 194 | ||||
-rw-r--r-- | muse2/muse/mixer/astrip.cpp | 56 | ||||
-rw-r--r-- | muse2/muse/widgets/menutitleitem.h | 12 |
4 files changed, 135 insertions, 128 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 196d4838..331294e3 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,5 +1,6 @@ 04.11.2010 - Fixed LADSPA plugin dialog. TODO: fix sorting order. (Tim) + - Fixed MenuTitleItem class. Fixed some usages of it (Jack popup routes, midi cfg routes). (Tim) 02.11.2010 - Solved! All the MESS synths load now. Removed mpevent(.h, .cpp) and evdata.h from /libsynti, conflicting with copies in /muse, causing crashes. Versions in /muse are newer. diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index bbc6924f..0de3379b 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -17,10 +17,11 @@ #include <qcombobox.h> #include <qlabel.h> #include <QButtonGroup> +#include <QMenu> //Added by qt3to4: #include <QPixmap> #include <stdio.h> -#include <q3popupmenu.h> +//#include <q3popupmenu.h> #include <q3groupbox.h> #include <qradiobutton.h> #include <qspinbox.h> @@ -230,12 +231,14 @@ void MPConfig::rbClicked(Q3ListViewItem* item, const QPoint& cpt, int col) //RouteList* rl = (dev->rwFlags() & 1) ? dev->outRoutes() : dev->inRoutes(); RouteList* rl = (col == DEVCOL_OUTROUTES) ? dev->outRoutes() : dev->inRoutes(); // p3.3.55 - Q3PopupMenu* pup = 0; + ///Q3PopupMenu* pup = 0; + QMenu* pup = 0; int gid = 0; std::list<QString> sl; - pup = new Q3PopupMenu(this); - pup->setCheckable(true); + ///pup = new Q3PopupMenu(this); + pup = new QMenu(this); + ///pup->setCheckable(true); _redisplay: pup->clear(); @@ -253,18 +256,38 @@ void MPConfig::rbClicked(Q3ListViewItem* item, const QPoint& cpt, int col) //MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); //pup->insertItem(titel); - pup->insertItem(tr("Show first aliases"), gid); - pup->setItemChecked(gid, (_showAliases == 0)); + QAction* act; + + act = pup->addAction(tr("Show first aliases")); + act->setData(gid); + act->setCheckable(true); + act->setChecked(_showAliases == 0); + + ///pup->insertItem(tr("Show first aliases"), gid); + ///pup->setItemChecked(gid, (_showAliases == 0)); ++gid; - pup->insertItem(tr("Show second aliases"), gid); - pup->setItemChecked(gid, (_showAliases == 1)); + + + act = pup->addAction(tr("Show second aliases")); + act->setData(gid); + act->setCheckable(true); + act->setChecked(_showAliases == 1); + + ///pup->insertItem(tr("Show second aliases"), gid); + ///pup->setItemChecked(gid, (_showAliases == 1)); ++gid; - pup->insertSeparator(); + + ///pup->insertSeparator(); + pup->addSeparator(); for(std::list<QString>::iterator ip = sl.begin(); ip != sl.end(); ++ip) { //int id = pup->insertItem(*ip, gid); - pup->insertItem(*ip, gid); + ///pup->insertItem(*ip, gid); + act = pup->addAction(*ip); + act->setData(gid); + act->setCheckable(true); + //Route dst(*ip, true, i); //Route rt(*ip, (dev->rwFlags() & 1), -1, Route::JACK_ROUTE); Route rt(*ip, (col == DEVCOL_OUTROUTES), -1, Route::JACK_ROUTE); // p3.3.55 @@ -273,7 +296,8 @@ void MPConfig::rbClicked(Q3ListViewItem* item, const QPoint& cpt, int col) if (*ir == rt) { //pup->setItemChecked(id, true); - pup->setItemChecked(gid, true); + ///pup->setItemChecked(gid, true); + act->setChecked(true); break; } } @@ -283,82 +307,88 @@ void MPConfig::rbClicked(Q3ListViewItem* item, const QPoint& cpt, int col) // pup->insertSeparator(); //} - n = pup->exec(ppt, 0); - if (n != -1) + ///n = pup->exec(ppt, 0); + act = pup->exec(ppt); + if(act) { - if(n == 0) // Show first aliases - { - ///delete pup; - if(_showAliases == 0) - _showAliases = -1; - else - _showAliases = 0; - goto _redisplay; // Go back - } - else - if(n == 1) // Show second aliases - { - ///delete pup; - if(_showAliases == 1) - _showAliases = -1; - else - _showAliases = 1; - goto _redisplay; // Go back - } - - QString s(pup->text(n)); - - //if(dev->rwFlags() & 1) // Writable - if(col == DEVCOL_OUTROUTES) // Writable p3.3.55 - { - Route srcRoute(dev, -1); - Route dstRoute(s, true, -1, Route::JACK_ROUTE); - - iRoute iir = rl->begin(); - for(; iir != rl->end(); ++iir) + n = act->data().toInt(); + //if (n != -1) + //{ + if(n == 0) // Show first aliases { - if(*iir == dstRoute) - break; + //delete pup; + if(_showAliases == 0) + _showAliases = -1; + else + _showAliases = 0; + goto _redisplay; // Go back } - if(iir != rl->end()) - // disconnect - audio->msgRemoveRoute(srcRoute, dstRoute); - else - // connect - audio->msgAddRoute(srcRoute, dstRoute); - } - else - //if(dev->rwFlags() & 2) // Readable - //if(col == DEVCOL_INROUTES) // Readable p3.3.55 - { - Route srcRoute(s, false, -1, Route::JACK_ROUTE); - Route dstRoute(dev, -1); - - iRoute iir = rl->begin(); - for(; iir != rl->end(); ++iir) + else + if(n == 1) // Show second aliases { - if(*iir == srcRoute) - break; + //delete pup; + if(_showAliases == 1) + _showAliases = -1; + else + _showAliases = 1; + goto _redisplay; // Go back } - if(iir != rl->end()) - // disconnect - audio->msgRemoveRoute(srcRoute, dstRoute); - else - // connect - audio->msgAddRoute(srcRoute, dstRoute); - } - - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); - - // p3.3.46 - //delete pup; - // FIXME: - // Routes can't be re-read until the message sent from msgAddRoute1() - // has had time to be sent and actually affected the routes. - ///goto _redisplay; // Go back - - } + + ///QString s(pup->text(n)); + QString s(act->text()); + + //if(dev->rwFlags() & 1) // Writable + if(col == DEVCOL_OUTROUTES) // Writable p3.3.55 + { + Route srcRoute(dev, -1); + Route dstRoute(s, true, -1, Route::JACK_ROUTE); + + iRoute iir = rl->begin(); + for(; iir != rl->end(); ++iir) + { + if(*iir == dstRoute) + break; + } + if(iir != rl->end()) + // disconnect + audio->msgRemoveRoute(srcRoute, dstRoute); + else + // connect + audio->msgAddRoute(srcRoute, dstRoute); + } + else + //if(dev->rwFlags() & 2) // Readable + //if(col == DEVCOL_INROUTES) // Readable p3.3.55 + { + Route srcRoute(s, false, -1, Route::JACK_ROUTE); + Route dstRoute(dev, -1); + + iRoute iir = rl->begin(); + for(; iir != rl->end(); ++iir) + { + if(*iir == srcRoute) + break; + } + if(iir != rl->end()) + // disconnect + audio->msgRemoveRoute(srcRoute, dstRoute); + else + // connect + audio->msgAddRoute(srcRoute, dstRoute); + } + + audio->msgUpdateSoloStates(); + song->update(SC_ROUTE); + + // p3.3.46 + //delete pup; + // FIXME: + // Routes can't be re-read until the message sent from msgAddRoute1() + // has had time to be sent and actually affected the routes. + ///goto _redisplay; // Go back + + //} + } delete pup; //iR->setDown(false); // pup->exec() catches mouse release event diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index 56e1e3eb..dfcd741c 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -12,7 +12,7 @@ #include <qapplication.h> #include <qdialog.h> #include <qtoolbutton.h> -#include <qlabel.h> +#include <QLabel> #include <qdialog.h> #include <qcombobox.h> #include <qtooltip.h> @@ -54,48 +54,24 @@ #include "menutitleitem.h" #include "popupmenu.h" -/* //--------------------------------------------------------- // MenuTitleItem //--------------------------------------------------------- -class MenuTitleItem : public QCustomMenuItem { - QString s; - virtual bool fullSpan() const { return true; } - virtual bool isSeparator() const { return true; } - virtual void paint(QPainter* p, const QColorGroup& cg, bool act, - bool, int, int, int, int); - virtual QSize sizeHint(); - - public: - MenuTitleItem(QString s); - }; -*/ - -//--------------------------------------------------------- -// MenuTitleItem -//--------------------------------------------------------- - -MenuTitleItem::MenuTitleItem(QString ss) - : s(ss) - { - } - -QSize MenuTitleItem::sizeHint() +MenuTitleItem::MenuTitleItem(const QString& ss, QWidget* parent) + : QWidgetAction(parent) { - return QSize(60, 20); + s = ss; + // Don't allow to click on it. + setEnabled(false); } -//--------------------------------------------------------- -// drawItem -//--------------------------------------------------------- - -void MenuTitleItem::paint(QPainter* p, const QColorGroup&, bool, - bool, int x, int y, int w, int h) - { - p->fillRect(x, y, w, h, QBrush(Qt::lightGray)); - p->drawText(x, y, w, h, Qt::AlignCenter, s); - } +QWidget* MenuTitleItem::createWidget(QWidget *parent) +{ + QLabel* l = new QLabel(s, parent); + l->setAlignment(Qt::AlignCenter); + return l; +} //--------------------------------------------------------- // minimumSizeHint @@ -1895,8 +1871,10 @@ void AudioStrip::iRoutePressed() { char buffer[128]; snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1); - MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); + //MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); + MenuTitleItem* titel = new MenuTitleItem(QString(buffer), pup); //pup->insertItem(titel); //ddskrjo + pup->addAction(titel); if(!checkAudioDevice()) { @@ -2443,8 +2421,10 @@ void AudioStrip::oRoutePressed() { char buffer[128]; snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1); - MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); + //MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); + MenuTitleItem* titel = new MenuTitleItem(QString(buffer), pup); //pup->insertItem(titel); //ddskrjo + pup->addAction(titel); if(!checkAudioDevice()) { diff --git a/muse2/muse/widgets/menutitleitem.h b/muse2/muse/widgets/menutitleitem.h index 5f821512..016d4663 100644 --- a/muse2/muse/widgets/menutitleitem.h +++ b/muse2/muse/widgets/menutitleitem.h @@ -8,22 +8,18 @@ #ifndef __MENU_TITLE_ITEM_H__ #define __MENU_TITLE_ITEM_H__ -#include <qmenudata.h> +#include <QWidgetAction> //--------------------------------------------------------- // MenuTitleItem //--------------------------------------------------------- -class MenuTitleItem { //: public QCustomMenuItem { ddskrjo +class MenuTitleItem : public QWidgetAction { QString s; - virtual bool fullSpan() const { return true; } - virtual bool isSeparator() const { return true; } - virtual void paint(QPainter* p, const QColorGroup& cg, bool act, - bool, int, int, int, int); - virtual QSize sizeHint(); public: - MenuTitleItem(QString s); + MenuTitleItem(const QString&, QWidget* /*parent*/); + QWidget* createWidget(QWidget* /*parent*/); }; #endif |