From 8524da8e014372100b8ee4a579e3b8a4635c9a12 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Tue, 9 Nov 2010 00:00:49 +0000 Subject: Fixed strip name label colours, also name label auto-font-sizing. --- muse2/ChangeLog | 1 + muse2/muse/arranger/trackinfo.cpp | 43 +++++++++++++++----------- muse2/muse/mixer/strip.cpp | 65 +++++++++++++++++---------------------- muse2/muse/mixer/strip.h | 2 +- 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 3ea97a3f..c8e9d8c3 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,5 +1,6 @@ 08.11.2010 - Add missing link to libdl.so. Caused bulid failure on Fedora 14 (Orcan) + - Fixed strip name label colours, also name label auto-font-sizing. (Tim) 07.11.2010 - Mixer is fixed and converted to QT4. (Tim) - Conversion of TLLayout class to QT4. diff --git a/muse2/muse/arranger/trackinfo.cpp b/muse2/muse/arranger/trackinfo.cpp index ef191b97..0eed739e 100644 --- a/muse2/muse/arranger/trackinfo.cpp +++ b/muse2/muse/arranger/trackinfo.cpp @@ -5,19 +5,21 @@ // (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) //========================================================= -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include +#include //#include -#include -#include +#include +#include //#include -#include -#include -#include +#include +#include +//#include //Added by qt3to4: #include #include @@ -449,7 +451,7 @@ void Arranger::setTrackInfoLabelFont() // Set the label's font. midiTrackInfo->trackNameLabel->setFont(config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - //autoAdjustFontSize(midiTrackInfo->trackNameLabel, midiTrackInfo->trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); ddskrjo + autoAdjustFontSize(midiTrackInfo->trackNameLabel, midiTrackInfo->trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); } // Removed by Tim. p3.3.9 @@ -1199,18 +1201,23 @@ void Arranger::genMidiTrackInfo() recEchoIconSet.setPixmap(*recEchoIconOff, QIcon::Automatic, QIcon::Normal, QIcon::Off); midiTrackInfo->recEchoButton->setIconSet(recEchoIconSet); - //midiTrackInfo->trackNameLabel->setAlignment(AlignCenter | WordBreak); + + // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. + midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap); + // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence + // over word wrap, so I found it is not really desirable. Maybe with a user setting... + //midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); //midiTrackInfo->trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); - //frameShape WinPanel - //frameShadow Raised - //lineWidth 1 - //midLineWidth 0 - midiTrackInfo->trackNameLabel->setBackgroundColor(QColor(0, 160, 255)); // Med blue + + QPalette pal; + pal.setColor(midiTrackInfo->trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue + midiTrackInfo->trackNameLabel->setPalette(pal); + midiTrackInfo->trackNameLabel->setWordWrap(true); + midiTrackInfo->trackNameLabel->setAutoFillBackground(true); // Added by Tim. p3.3.9 setTrackInfoLabelText(); setTrackInfoLabelFont(); - connect(midiTrackInfo->iPatch, SIGNAL(released()), SLOT(instrPopup())); diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index a15ad44e..720b272d 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -6,9 +6,11 @@ // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) //========================================================= -#include -#include +#include +#include #include +#include +#include //Added by qt3to4: #include //#include @@ -82,7 +84,7 @@ void Strip::setLabelFont() // Set the label's font. label->setFont(config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - //autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); ddskrjo + autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -90,58 +92,43 @@ void Strip::setLabelFont() //--------------------------------------------------------- void Strip::setLabelText() - { - //label->setText(track->name()); - QString s; +{ + QColor c; switch(track->type()) { case Track::AUDIO_OUTPUT: - label->setBackgroundColor(Qt::green); - s = track->name(); + c = Qt::green; break; case Track::AUDIO_GROUP: - label->setBackgroundColor(Qt::yellow); - s = track->name(); + c = Qt::yellow; break; case Track::AUDIO_AUX: - //label->setBackgroundColor(cyan); - label->setBackgroundColor(QColor(120, 255, 255)); // Light blue - s = track->name(); + c = QColor(120, 255, 255); // Light blue break; case Track::WAVE: - label->setBackgroundColor(Qt::magenta); - s = track->name(); + c = Qt::magenta; break; case Track::AUDIO_INPUT: - label->setBackgroundColor(Qt::red); - s = track->name(); + c = Qt::red; break; case Track::AUDIO_SOFTSYNTH: - //label->setBackgroundColor(white); - label->setBackgroundColor(QColor(255, 130, 0)); // Med orange - s = track->name(); + c = QColor(255, 130, 0); // Med orange break; case Track::MIDI: case Track::DRUM: { - // Changed by Tim. p3.3.21 - /* - MidiTrack* mt = (MidiTrack*)track; - int port = mt->outPort(); - int channel = mt->outChannel(); - //QString s; - s.sprintf("%d-%d", port + 1, channel + 1); - //label->setText(s); - //label->setBackgroundColor(gray); - */ - label->setBackgroundColor(QColor(0, 160, 255)); // Med blue - s = track->name(); + c = QColor(0, 160, 255); // Med blue } break; + default: + return; } - // Added by Tim. p3.3.9 - label->setText(s); - - } + + label->setText(track->name()); + QPalette palette; + palette.setColor(label->backgroundRole(), c); + //palette.setColor(QPalette::Window, c); + label->setPalette(palette); +} //--------------------------------------------------------- // muteToggled @@ -208,7 +195,13 @@ Strip::Strip(QWidget* parent, Track* t) // Changed by Tim. p3.3.9 //label->setAlignment(AlignCenter); //label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); + // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence + // over word wrap, so I found it is not really desirable. Maybe with a user setting... + //label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap); + label->setWordWrap(true); + label->setAutoFillBackground(true); + //label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum)); label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h index 4202b3e3..4b4bfab1 100644 --- a/muse2/muse/mixer/strip.h +++ b/muse2/muse/mixer/strip.h @@ -11,7 +11,7 @@ //#include #include -#include +#include //Added by qt3to4: #include #include -- cgit v1.2.3