From ecb258f0a7525983a980ebb94b01dd9c24f5aaa1 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 12 Feb 2016 15:58:45 +0100 Subject: [PATCH 01/39] First version of artwork tabs for the InstrumentTrackWindow. This version can only display & manage artwork tabs, which breaks the InstrumentSoundShapingView as it still uses text tabs. I'm planing to improve this implementation to let these artwork tabs fall back to text mode when no artwork is given. This would solve the problem of the InstrumentSoundShapingView. --- include/TabWidget.h | 10 ++-- .../widgets/InstrumentSoundShapingView.cpp | 3 +- src/gui/widgets/TabWidget.cpp | 59 ++++++++++++------- src/tracks/InstrumentTrack.cpp | 12 ++-- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index f4888f0cce4..97808baee02 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -29,6 +29,7 @@ #include #include +#include class TabWidget : public QWidget { @@ -37,7 +38,7 @@ class TabWidget : public QWidget TabWidget( const QString & _caption, QWidget * _parent ); virtual ~TabWidget(); - void addTab( QWidget * _w, const QString & _name, int _idx = -1 ); + void addTab( QWidget * _w, const QString & _name, const char * pixmapName, int _idx = -1 ); void setActiveTab( int _idx ); @@ -57,9 +58,10 @@ class TabWidget : public QWidget private: struct widgetDesc { - QWidget * w; // ptr to widget - QString name; // name for widget - int nwidth; // width of name when painting + QWidget * w; // ptr to widget + const char *pixmapName; // artwork for the widget + QString name; // name for widget + int nwidth; // width of name when painting } ; typedef QMap widgetStack; diff --git a/src/gui/widgets/InstrumentSoundShapingView.cpp b/src/gui/widgets/InstrumentSoundShapingView.cpp index 20eaaba5eec..8feef2bc5f6 100644 --- a/src/gui/widgets/InstrumentSoundShapingView.cpp +++ b/src/gui/widgets/InstrumentSoundShapingView.cpp @@ -76,7 +76,8 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : { m_envLfoViews[i] = new EnvelopeAndLfoView( m_targetsTabWidget ); m_targetsTabWidget->addTab( m_envLfoViews[i], - tr( InstrumentSoundShaping::targetNames[i][0].toUtf8().constData() ) ); + tr( InstrumentSoundShaping::targetNames[i][0].toUtf8().constData() ), + "dummy" ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 8048ecc0e6b..f4a85e523ab 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -29,6 +29,7 @@ #include #include "gui_templates.h" +#include "embed.h" @@ -59,17 +60,25 @@ TabWidget::~TabWidget() -void TabWidget::addTab( QWidget * _w, const QString & _name, int _idx ) +void TabWidget::addTab( QWidget * _w, const QString & _name, const char * pixmapName, int _idx ) { setFont( pointSize<8>( font() ) ); - widgetDesc d = { _w, _name, fontMetrics().width( _name ) + 10 } ; + + // Append tab when position is not given if( _idx < 0/* || m_widgets.contains( _idx ) == true*/ ) { while( m_widgets.contains( ++_idx ) == true ) { } } + + fprintf( stderr, "adding tab %s. idx=%d\n", pixmapName, _idx); + + // Register new tab + widgetDesc d = { _w, pixmapName, _name, fontMetrics().width( _name ) + 10 } ; m_widgets[_idx] = d; + + // Initialize tab's window _w->setFixedSize( width() - 4, height() - 14 ); _w->move( 2, 13 ); _w->hide(); @@ -106,21 +115,22 @@ void TabWidget::setActiveTab( int _idx ) void TabWidget::mousePressEvent( QMouseEvent * _me ) { + + fprintf( stderr, "TabWidget::mousePressEvent x=%d y=%d\n", _me->x(), _me->y() ); + if( _me->y() > 1 && _me->y() < 13 ) { - int cx = ( ( m_caption == "" ) ? 4 : 14 ) + - fontMetrics().width( m_caption ); for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - if( _me->x() >= cx && - _me->x() <= cx + ( *it ).nwidth ) + if( _me->x() >= 8 + it.key() * 30 && + _me->x() <= 8 + it.key() * 30 + 14 ) { + fprintf( stderr, "TabWidget::mousePressEvent Pressed tab %d\n", it.key() ); setActiveTab( it.key() ); update(); return; } - cx += ( *it ).nwidth; } } } @@ -175,9 +185,6 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) p.drawText( 5, 11, m_caption ); } - // Calculate the tabs' x (tabs are painted next to the caption) - int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); - QColor cap_col( 160, 160, 160 ); if( big_tab_captions ) { @@ -190,19 +197,29 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) } p.setPen( cap_col ); - - for( widgetStack::iterator it = m_widgets.begin(); - it != m_widgets.end(); ++it ) - { - if( it.key() == m_activeTab ) + // Draw all tabs + int tab_x_offset = 8; + for( widgetStack::iterator it = m_widgets.begin(); + it != m_widgets.end(); ++it ) + { + + // Get active or inactive artwork + std::string tab = string( ( *it).pixmapName ); + if( it.key() == m_activeTab ) + { + tab += "_active"; + } else { - p.setPen( QColor( 32, 48, 64 ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, 10, cap_col ); + tab += "_inactive"; } - p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); - p.setPen( cap_col ); - tab_x_offset += ( *it ).nwidth; - } + QPixmap *artwork = new QPixmap( embed::getIconPixmap( tab.c_str() ) ); + + // Draw tab + p.drawPixmap(tab_x_offset, 0, *artwork ); + + // Next tab's horizontal position + tab_x_offset += 30; + } } diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 80b5427b17a..aa67d13ffdc 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1439,11 +1439,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); - m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), 5 ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "usr_wave", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "sin_wave", 2 ); + m_tabWidget->addTab( m_effectView, tr( "FX" ), "saw_wave", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "round_square_wave", 4 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), "exp_wave", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "moog_saw_wave", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From 91872f10224b9eb39d0a81c3bf2aa0654e7d075b Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Tue, 16 Feb 2016 16:29:56 +0100 Subject: [PATCH 02/39] Second version of artwork tabs for the InstrumentTrackWindow. This version will draw an artwork tab when the TabWidget::addTab function is given a pixmapName. Otherwise, when pixmapName is NULL, it will fall back drawing a text tab. --- .../widgets/InstrumentSoundShapingView.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 71 ++++++++++++------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/gui/widgets/InstrumentSoundShapingView.cpp b/src/gui/widgets/InstrumentSoundShapingView.cpp index 8feef2bc5f6..aa64b5596a3 100644 --- a/src/gui/widgets/InstrumentSoundShapingView.cpp +++ b/src/gui/widgets/InstrumentSoundShapingView.cpp @@ -77,7 +77,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_envLfoViews[i] = new EnvelopeAndLfoView( m_targetsTabWidget ); m_targetsTabWidget->addTab( m_envLfoViews[i], tr( InstrumentSoundShaping::targetNames[i][0].toUtf8().constData() ), - "dummy" ); + NULL ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index f4a85e523ab..fbf5289d9de 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -72,10 +72,16 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char * pixma } } - fprintf( stderr, "adding tab %s. idx=%d\n", pixmapName, _idx); + // Compute tab's width + int w; + if ( pixmapName == NULL ) { + w = fontMetrics().width( _name ) + 10; + } else { + w = 30; + } // Register new tab - widgetDesc d = { _w, pixmapName, _name, fontMetrics().width( _name ) + 10 } ; + widgetDesc d = { _w, pixmapName, _name, w } ; m_widgets[_idx] = d; // Initialize tab's window @@ -116,21 +122,21 @@ void TabWidget::setActiveTab( int _idx ) void TabWidget::mousePressEvent( QMouseEvent * _me ) { - fprintf( stderr, "TabWidget::mousePressEvent x=%d y=%d\n", _me->x(), _me->y() ); - if( _me->y() > 1 && _me->y() < 13 ) { + int cx = ( ( m_caption == "" ) ? 4 : 14 ) + + fontMetrics().width( m_caption ); for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - if( _me->x() >= 8 + it.key() * 30 && - _me->x() <= 8 + it.key() * 30 + 14 ) + if( _me->x() >= cx && + _me->x() <= cx + ( *it ).nwidth ) { - fprintf( stderr, "TabWidget::mousePressEvent Pressed tab %d\n", it.key() ); setActiveTab( it.key() ); update(); return; } + cx += ( *it ).nwidth; } } } @@ -185,6 +191,9 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) p.drawText( 5, 11, m_caption ); } + // Calculate the tabs' x (tabs are painted next to the caption) + int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); + QColor cap_col( 160, 160, 160 ); if( big_tab_captions ) { @@ -198,27 +207,42 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) p.setPen( cap_col ); // Draw all tabs - int tab_x_offset = 8; for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - // Get active or inactive artwork - std::string tab = string( ( *it).pixmapName ); - if( it.key() == m_activeTab ) - { - tab += "_active"; - } else + // Draw a text tab when no artwork has been defined for the tab. + if ( (*it ).pixmapName == NULL ) { - tab += "_inactive"; - } - QPixmap *artwork = new QPixmap( embed::getIconPixmap( tab.c_str() ) ); + // Highlight text tabs when they are active + if ( it.key() == m_activeTab ) { + p.setPen( QColor( 32, 48, 64 ) ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, 10, cap_col ); + } + + // Draw tab + p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); + p.setPen( cap_col ); + } else + { + // Get active or inactive artwork + std::string tab = std::string( ( *it ).pixmapName ); + if( it.key() == m_activeTab ) + { + tab += "_active"; + } else + { + tab += "_inactive"; + } + QPixmap *artwork = new QPixmap( embed::getIconPixmap( tab.c_str() ) ); - // Draw tab - p.drawPixmap(tab_x_offset, 0, *artwork ); + // Draw tab + p.drawPixmap(tab_x_offset, 0, *artwork ); + } // Next tab's horizontal position - tab_x_offset += 30; + tab_x_offset += ( *it ).nwidth; + } } @@ -243,10 +267,3 @@ void TabWidget::wheelEvent( QWheelEvent * _we ) } setActiveTab( tab ); } - - - - - - - From e2e8369a56e361ecc5f09c608cdcf08e1c90635a Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 18 Feb 2016 16:45:30 +0100 Subject: [PATCH 03/39] Created artwork for the artwork tabs. --- data/themes/default/env_lfo_active.png | Bin 0 -> 411 bytes data/themes/default/env_lfo_inactive.png | Bin 0 -> 634 bytes data/themes/default/functions_active.png | Bin 0 -> 290 bytes data/themes/default/functions_inactive.png | Bin 0 -> 418 bytes data/themes/default/fx_active.png | Bin 0 -> 230 bytes data/themes/default/fx_inactive.png | Bin 0 -> 378 bytes data/themes/default/midi_active.png | Bin 0 -> 235 bytes data/themes/default/midi_inactive.png | Bin 0 -> 378 bytes data/themes/default/miscellaneous_active.png | Bin 0 -> 242 bytes data/themes/default/miscellaneous_inactive.png | Bin 0 -> 378 bytes data/themes/default/plugin_active.png | Bin 0 -> 300 bytes data/themes/default/plugin_inactive.png | Bin 0 -> 442 bytes src/gui/widgets/TabWidget.cpp | 2 +- src/tracks/InstrumentTrack.cpp | 12 ++++++------ 14 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 data/themes/default/env_lfo_active.png create mode 100644 data/themes/default/env_lfo_inactive.png create mode 100644 data/themes/default/functions_active.png create mode 100644 data/themes/default/functions_inactive.png create mode 100644 data/themes/default/fx_active.png create mode 100644 data/themes/default/fx_inactive.png create mode 100644 data/themes/default/midi_active.png create mode 100644 data/themes/default/midi_inactive.png create mode 100644 data/themes/default/miscellaneous_active.png create mode 100644 data/themes/default/miscellaneous_inactive.png create mode 100644 data/themes/default/plugin_active.png create mode 100644 data/themes/default/plugin_inactive.png diff --git a/data/themes/default/env_lfo_active.png b/data/themes/default/env_lfo_active.png new file mode 100644 index 0000000000000000000000000000000000000000..3336e9038e59f20dec6ea4aca38eacdf6d4339f6 GIT binary patch literal 411 zcmV;M0c8G(P)l&j5Qcl5y2d9W zcoc&oNM;Z`0~&+p0eA(d0*64hb%;Cx3SnxNY0IuJ3{VO%$9n zrDa*r9Ya+Pt=TjU&XaO$R|-9!FX)6v2EZGDbRl;#bo+a7da-y!Fbo3#ZvfJJ ziQ0kC!NGF5lzvEn81MR*+Y;0I+pX4p20VFvu%0pcaCQChI+;x3V$+#Nr%z9Lo*#{_ zz`-Uz)%67kT$H U)D~z9X#fBK07*qoM6N<$f;LMS-~a#s literal 0 HcmV?d00001 diff --git a/data/themes/default/functions_active.png b/data/themes/default/functions_active.png new file mode 100644 index 0000000000000000000000000000000000000000..6f6bb96befddcfdcca577829c892898ea1016928 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!3HF4glkxU6lZ})WHAE+w=f7ZGR&GI0Tg5} z@$_|Nf50TfD`E1{yy+!S=%A;IV~B;|-YKVf4=V_`cuvu>*eUMy#7A9Wsfgc|i5o6O zoEBL8wJ~DTcjFhfzaO<1zx%uQf7#w$noFNJaYQd&Dl)ye?0nu%W$QlYxSrKI;`|ma zJ1opybRJe()ELfaZDg2eu?MqQgZXYzBIvrfFMb6$JKnrv^;etF2y~VxcZNr3>g822WQ%mvv4FO#tTbYXblP literal 0 HcmV?d00001 diff --git a/data/themes/default/functions_inactive.png b/data/themes/default/functions_inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..e107b3db46b975ff59f3810bd92a8afb3652e467 GIT binary patch literal 418 zcmV;T0bTxyP)|EK8`W3P?~00gmG=5=xSU{*+Rx^>G|e)?)8G&nXATIljKV z!)C!?X_}5U4#RMiLqaNm+na0HAUOZjAY?;9B!-SDhHK}8^=QZs)p1N`fnI4*6pTkb z3h)}uBs1>&zDf0dw-ZXy^vG@i#ineI=URPfF6&h1X;Gep3%efqho{GGxQFQ*ss$H@ zCt%N=7_;a2n5PN9tJ4_Y#y!u2EXxQFHAmjGMhX*xyxI~b!7lkH(*TG2J$!zAweOGD zjPW_!ob)H7cep>?&E>DcKl?BGSu{ef(r~KDc1PDm3kE?jmAfkU3zz4R?kjEFSpWb4 M07*qoM6N<$f`e+UvH$=8 literal 0 HcmV?d00001 diff --git a/data/themes/default/fx_active.png b/data/themes/default/fx_active.png new file mode 100644 index 0000000000000000000000000000000000000000..b9cbd64854fafdf5ffe69ebdebefa1c5c0128540 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!2~2X7rqV#Qk(@Ik;M!Q+`=Ht$S`Y;1W=H@ z#M9T6{Q;8@zp~8lErPB-!PC{xWt~$(69BEdP{jZM literal 0 HcmV?d00001 diff --git a/data/themes/default/fx_inactive.png b/data/themes/default/fx_inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..901f730ad3581fcd197faf4b3bab4271d0b8c081 GIT binary patch literal 378 zcmV-=0fqjFP)p(4#cnqmcbg)JurDXB?wSM6`R9fKY=_t2x7=}erVAM_4qh$E? z*C(&aLwaq3_ENCRVq~73pFTZ4W8{QCg|($?q~ot1be%yEti`n*E4sd+(^b07*qoM6N<$g1X(E=>Px# literal 0 HcmV?d00001 diff --git a/data/themes/default/midi_active.png b/data/themes/default/midi_active.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ea1e830fc9f4255684d4168644aa4c80b7b1bb GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!2~2X7rqV#Qk(@Ik;M!Q+`=Ht$S`Y;1W=H@ z#M9T6{Q;8@kBl{ont?Y^sLRvEF~mY}>*RyH2NZaiGp{<{sAoEsC=wLewTQ)FsV=`r zPq77m(62<WwsH0nIFuutg)CttXCfLCGL@7bsF dOJAK%W|qw~(knb+uombl22WQ%mvv4FO#qJiO+)|y literal 0 HcmV?d00001 diff --git a/data/themes/default/midi_inactive.png b/data/themes/default/midi_inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..bbf6a4976239c913ab5c5553e37d29cb7c212d1d GIT binary patch literal 378 zcmV-=0fqjFP)}id3{U47wLTO{y;3=s#uJ*0`YE3E0G)>c6hp+3u Y0YOE5l^=*XtN;K207*qoM6N<$f>hg{J^%m! literal 0 HcmV?d00001 diff --git a/data/themes/default/miscellaneous_active.png b/data/themes/default/miscellaneous_active.png new file mode 100644 index 0000000000000000000000000000000000000000..e0823df290436f56f4e4780d2246189694b6a7c7 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!2~2X7rqV#Qk(@Ik;M!Q+`=Ht$S`Y;1W=H@ z#M9T6{Q;8@uelMIhx|sM&_quc#}Es_qmxeaGAMGmly)0!ONzYJvNU5&*6|4f{9H2M z4mT=D%3ECADSoIq(u-5khDkno%Qd|XAxY;fk9Dl!Q@hf#DlogXZIf2p0hX-|VP~HQ zY!b@*B(_3u)y_-H)P?qJ7|mX~D>OMl8w m@d;V`#NEgLZPq?Daq}cqwTb#07XAe~j=|H_&t;ucLK6U87glco literal 0 HcmV?d00001 diff --git a/data/themes/default/miscellaneous_inactive.png b/data/themes/default/miscellaneous_inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..af5052159da2511756ba026c43eadb7291f113e6 GIT binary patch literal 378 zcmV-=0fqjFP)ZrE5Jh1jh=?Nb zC7?-Z2_GQ|9UV0_r{NxS90G2@8DbY8L9}Lf$&86s2=J0v_Es~0-hTZZgr+^<=-?U0 zvEw+FW$8M$Hy=uA+qPZTnP9;fvu#`96^5bj`$bV?S*F0iq^@fKFxvaaCs9Vs^L+FQ zfZ*B4CMpQ-U=65UW=81HN{0HA5pG=D*XIUTvvGLaBcQ;`8r*E=ieC`@#~(KZ literal 0 HcmV?d00001 diff --git a/data/themes/default/plugin_active.png b/data/themes/default/plugin_active.png new file mode 100644 index 0000000000000000000000000000000000000000..d170d89961343dc37c43b4344022434332e80603 GIT binary patch literal 300 zcmV+{0n`48P)d_rIeJ?U*N5^TI&U@ka)e{?3mZ% z=^Y!O2I>R#HS~ibU%1J%SA`+Y_7Z9h@XLnz0IH?bKo)$_Rf6z&nEjjTu+8VbJyZE9 zFhEJ45*j&)AF%++O>K{M_oj6;b@-u>;EPm-po0>twiMVqKLM00045NklnuO{2H8obs#<NEbAZ2 zMrM{}K@fPJXWJxyU2WUeb=@?Li-^AOecv~-ilWdY&+{qK2FwUqE|(Z6^y&Epr5*G6 zJWW#}kc-6v(tujBdE8pZM~4nXw`u!vfR+bPW+Yx+r;zBFg=>$7;B?Z}YK6{KmSr5r znBQLaXNLsjRbJX#cOLNz#7QZ1><7o4VPJw}5&NlW(E6NiK!HH*3~W6jfElT_6)S=o#en?BwD85uI1j#{;@X z`uYPd_49!PvxXqZ0z~IkHp7F`iIC2ku8~eUEm(1cDc8`5(`E`C`cWgE!!R`9lo$rc knMaddTab( m_ssView, tr( "ENV/LFO" ), "usr_wave", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "sin_wave", 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), "saw_wave", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "round_square_wave", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), "exp_wave", 5 ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions", 2 ); + m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi", 4 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), "miscellaneous", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "moog_saw_wave", 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "plugin", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From 5dcc1698f9e1a35e9720b169338d3a41c37ae463 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 21 Feb 2016 17:43:00 +0100 Subject: [PATCH 04/39] 1st PoC for autosizeable artwork tabs. --- data/themes/default/midi_inactive.png | Bin 378 -> 961 bytes src/gui/widgets/TabWidget.cpp | 52 ++++++++++++++------------ src/tracks/InstrumentTrack.cpp | 2 +- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/data/themes/default/midi_inactive.png b/data/themes/default/midi_inactive.png index bbf6a4976239c913ab5c5553e37d29cb7c212d1d..2bafb3217e976f62d6c9a696515efda79cc45aa4 100644 GIT binary patch literal 961 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsNt92GeZuCtB%qLFiEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI0FN-rl*Tzh=wSm9P`6Jj6h8&;Q#;s8bARi6hQ`te~gTbH_*fw z7=Vhw1_0?zK#U7)0%-(Fg4M!p1gSHA%gD4pLK9CJk0|Hub zjZjldA>vrcQY6=CF@kk7FkA%*k^r>P}id3{U47wLTO{y;3=s#uJ*0`YE3E0G)>c6hp+3u Y0YOE5l^=*XtN;K207*qoM6N<$f>hg{J^%m! diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index ba7bb244d0e..e5c1a8c7292 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -72,13 +72,8 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char * pixma } } - // Compute tab's width - int w; - if ( pixmapName == NULL ) { - w = fontMetrics().width( _name ) + 10; - } else { - w = 28; // artwork's width - } + // Tab's width when it is a text tab + int w = fontMetrics().width( _name ) + 10; // Register new tab widgetDesc d = { _w, pixmapName, _name, w } ; @@ -207,48 +202,57 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) p.setPen( cap_col ); // Draw all tabs - for( widgetStack::iterator it = m_widgets.begin(); - it != m_widgets.end(); ++it ) + widgetStack::iterator first = m_widgets.begin(); + widgetStack::iterator last = m_widgets.end(); + int size = std::distance(first,last); + for( widgetStack::iterator it = first ; it != last ; ++it ) { // Draw a text tab when no artwork has been defined for the tab. if ( (*it ).pixmapName == NULL ) - { - // Highlight text tabs when they are active - if ( it.key() == m_activeTab ) { + { + + // Highlight tab when active + if( it.key() == m_activeTab ) + { p.setPen( QColor( 32, 48, 64 ) ); p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, 10, cap_col ); } - // Draw tab + // Draw text p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); + + // Reset text color p.setPen( cap_col ); + + } else { - // Get active or inactive artwork - std::string tab = std::string( ( *it ).pixmapName ); - if( it.key() == m_activeTab ) + // Get artwork + QPixmap *artwork = new QPixmap( embed::getIconPixmap( ( *it ).pixmapName ) ); + + if( it.key() == m_activeTab ) { - tab += "_active"; - } else - { - tab += "_inactive"; + p.fillRect( tab_x_offset, 1, width() / size, 12, cap_col ); } - QPixmap *artwork = new QPixmap( embed::getIconPixmap( tab.c_str() ) ); - // Draw tab - p.drawPixmap(tab_x_offset, 0, *artwork ); + // Draw artwork + p.drawPixmap(tab_x_offset + ( width() / ( size * 2 ) ) - 7, 0, *artwork ); + + // Recompute tab's width, because original size is only correct for text tabs + ( *it).nwidth = width() / size; + } // Next tab's horizontal position tab_x_offset += ( *it ).nwidth; - } } +// Switch between tabs with mouse wheel void TabWidget::wheelEvent( QWheelEvent * _we ) { if (_we->y() > m_tabheight) diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 838ab0f56f7..a2449e52e2d 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1442,7 +1442,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo", 1 ); m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions", 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi", 4 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_inactive", 4 ); m_tabWidget->addTab( m_miscView, tr( "MISC" ), "miscellaneous", 5 ); // setup piano-widget From 46f1ef780cfe62bd988f32dc37a1db859865c858 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 21 Feb 2016 22:06:44 +0100 Subject: [PATCH 05/39] TabWidget is 20 pixels tall when it's going to display artwork tabs. --- data/themes/default/fx_active.png | Bin 230 -> 1783 bytes data/themes/default/fx_inactive.png | Bin 378 -> 1783 bytes data/themes/default/midi_active.png | Bin 235 -> 642 bytes data/themes/default/midi_inactive.png | Bin 961 -> 672 bytes data/themes/default/miscellaneous_active.png | Bin 242 -> 1783 bytes .../themes/default/miscellaneous_inactive.png | Bin 378 -> 1783 bytes include/TabWidget.h | 21 ++-- src/gui/widgets/TabWidget.cpp | 90 ++++++++++++------ src/tracks/InstrumentTrack.cpp | 16 ++-- 9 files changed, 78 insertions(+), 49 deletions(-) diff --git a/data/themes/default/fx_active.png b/data/themes/default/fx_active.png index b9cbd64854fafdf5ffe69ebdebefa1c5c0128540..80680b092f17836a58525d1488d1cd44ede1109b 100644 GIT binary patch literal 1783 zcmdT^ODlw76n+QIeF)=D&B9uivSVf%UouUMu#ihesA2Gxm1N3dia#L#K=}j8hCg7d z$Oa|X2vcs)`DWhf%sXSSbDneQeDCE;gn|K=z1}W_aA{q>UT8PLYR0;eXmUZB z$GZbQXh_n#y8>m4bqy^F;ix2-#O78lNQJhk8cye>{i))6wB#u&L^%;G;R))5PdxaIJ&!oOo^l}lY;r5;G+z{Y2EN?G{&cLBaWbZq39-zQ zj+E#vd^tUBON`}y*-!?g<~?uV(4CXg4nyWiZN$_)lm)7`gLq}+F|)JGpEjg@<$G(* z>cX5t4e51Ap{v1vO?08xWe~cL*%^~axgT-Z{C?4aoMkdoh7IZ&xKj8m_aU9cn^D3w ykniV^!>fhoD5Ov02LRWYf`2k`Bs5(<-U$B9#d#7M4p%oH&~%zV=-cTWjei0>vvlJC literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!2~2X7rqV#Qk(@Ik;M!Q+`=Ht$S`Y;1W=H@ z#M9T6{Q;8@zp~8lErPB-!PC{xWt~$(69BEdP{jZM diff --git a/data/themes/default/fx_inactive.png b/data/themes/default/fx_inactive.png index 901f730ad3581fcd197faf4b3bab4271d0b8c081..3f8754196add49e8c9afba520d608123e36e5c80 100644 GIT binary patch literal 1783 zcmdT^OG^S#6rQQ@nTlmk5QNr6%LrPOiVmSj8a*~W$f&@w8fXy_2`z;B1JOSS`UCxg zcF`^f+SDR?QdmM|-%;;y@5O=I)q!u$Ip6ut;m)0VC!dH%T#inMq9`sc8XAH35o{Jb z_w#-ioMm=65`u>ngD2Z?_H1-wT~VCP1XVdWYzJx8wOH7CRoCL{@kEr#FHjwNcw7&z zWHRYxT?wwGXY}-3U}I5V2t>44Vr<9VhUrsUXfW01Ra2IuB6|Lll}e>Eg1qM6@C{OP z0C|DuFsuoA7x2OJ)i?kz=<6g=2|0a?vQ>xeB5?v9Vvx;Q(cphgbOH8Q5kASq zl@J4x+`i-x8|Mpg0l4OyklTSb;Ev~o7{!;W$QVWfaQDEIAU5HJMrdw;BCZ_&0cZ}b gf`4V=$jtak^-n%G&)uip{(&?tP7B9F$3xS(Z+Ig!PXGV_ literal 378 zcmV-=0fqjFP)p(4#cnqmcbg)JurDXB?wSM6`R9fKY=_t2x7=}erVAM_4qh$E? z*C(&aLwaq3_ENCRVq~73pFTZ4W8{QCg|($?q~ot1be%yEti`n*E4sd+(^b07*qoM6N<$g1X(E=>Px# diff --git a/data/themes/default/midi_active.png b/data/themes/default/midi_active.png index f7ea1e830fc9f4255684d4168644aa4c80b7b1bb..a1333d08052c81b1d61a2a7525c3eda4d8cb9d76 100644 GIT binary patch delta 623 zcmV-#0+9Xd0fGfHiBL{Q4GJ0x0000DNk~Le0000K0000K2nGNE0F8+q4FCWD24YJ` zL;(K){{a7>y{D6rAs~Mh6c7xb%n&&M000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2H zM@dakSAh-}0005%NklM`(M3`egp0^U(JuT7u7ox% z{S57dK0`rnTGc`jTC@`^NfK*SU0P<@rX(a^$a`8ePabc#7o>lI;XHTF{Qq}m&dj8o zvy_sYGe{{xg`qeh$C={nU>%(jmvjEqfa)_h(2hK;Ga5CjDez^ zn*JMzyZ-Q<4Q#7vl^kdD7<;%_L{}ArRaffESPg8A+@yc{C2F-AjXdD*GKnh@z%ZUQ z5hm=1)3AS+{$hdzN2+?Ha#X3x8P5NKFr!n&)@bAN5s7nP+gR@l!w!zeB$Tp)*I2@< zsMBE4x6Mksj|X`7r{%DZ=a??Q(_!2H-E!!)zV2W^rl+z2v1j!!rN?002ov JPDHLkV1nmi9ijjL literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!2~2X7rqV#Qk(@Ik;M!Q+`=Ht$S`Y;1W=H@ z#M9T6{Q;8@kBl{ont?Y^sLRvEF~mY}>*RyH2NZaiGp{<{sAoEsC=wLewTQ)FsV=`r zPq77m(62<WwsH0nIFuutg)CttXCfLCGL@7bsF dOJAK%W|qw~(knb+uombl22WQ%mvv4FO#qJiO+)|y diff --git a/data/themes/default/midi_inactive.png b/data/themes/default/midi_inactive.png index 2bafb3217e976f62d6c9a696515efda79cc45aa4..94b89d7fbd31801f56926b58deb675e543e43d84 100644 GIT binary patch delta 599 zcmV-d0;v7L2cQKZiBL{Q4GJ0x0000DNk~Le0000K0000K2nGNE0F8+q4Ur);2NVx6 z3jR{Iky|H!0tiV&K~y-)rIbBuQ*ji=f9LYYNC!DDy7g-m z`~XfF>=zIUfi5eJeuN>x%r(vBu&Rnloct5fcGBsI)I=G>dW zvZLAs)`2xgHxJzOGjH3PeRhpmmeh<0k_*rR?l_e#;0e$NE(43eecvqt?|?@@!$rGh z>|05H8_Cr?56l?!0eA(x06qZ=z%72tYv8#nf5WyJbJUZ+l6=tv=75K8jSEc5MW9=1 zsUFZYM^+dsz(-&Oc;+^_3e-$YssC!etJ-(P*a~Kq&!QMZ;7TdFtVEcNrM?bq8k+zW zsebjp+H{}Q_`9@#>keQRcv(akz{pOs{JT_tOA~}SBAb%RaV0BWd1?6nM+D>J?)*B?9ox#eq%QE-|Nd!2^nY2>r3l9& lqn(pfnW%tN@m-pN;|CIDdsZ9pL9qY;002ovPDHLkV1l4f51{}6 literal 961 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsNt92GeZuCtB%qLFiEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI0FN-rl*Tzh=wSm9P`6Jj6h8&;Q#;s8bARi6hQ`te~gTbH_*fw z7=Vhw1_0?zK#U7)0%-(Fg4M!p1gSHA%gD4pLK9CJk0|Hub zjZjldA>vrcQY6=CF@kk7FkA%*k^r>P57RnDN3C;-wOTi3k@FfS_Ga&uTh7%tLdeZ$kI0PpUOE|hUDe!l zqVxHq>}gp?{p4joeq&-HbKQ6G$;_yqxfZ)U?vKS%Ub_F%-Ghf!eb`I%40bhy2Ez|G z)Msy1y^V4;YSS*xiFNT=>{=8X5%0uzu_TU*U8_w!pNc;PC^{qpRTX$Ae}na9y-Xn` zzwDx1{9nNj>hwx5Lc}UooWldTX89lH>yV)H&%EUr(KFE{SU~)WBea4POBbLZqxdcG zJA}PSMEQBagH2zQtcj0i5YLDgf+CFIM-g~D1jsi9uMW12?kR5;|HJ|NCamL5;~Vv5 zP|jX?Rr#{$#*}zEMVYsHVeRmkM#l8v@6I0@(Krh9dV56JL z&Y|7h8c)es5zHNs;|0oAFR;N*Z|skP%$=z?H?Jhxb|^86F8I1|p6w`-;{}R+R!M9j wPECtot2_{V&hW}ARMssu`MYW@Snm}%QGxoD9bTNfKk$SGUa~Lo_`=BaU#w7uqJ7|mX~D>OMl8w m@d;V`#NEgLZPq?Daq}cqwTb#07XAe~j=|H_&t;ucLK6U87glco diff --git a/data/themes/default/miscellaneous_inactive.png b/data/themes/default/miscellaneous_inactive.png index af5052159da2511756ba026c43eadb7291f113e6..e02105331cfb0e3c47722b396772069e4db5d83f 100644 GIT binary patch literal 1783 zcmds&O=wd=5XaxEHK{34q%GQlHbq3FHw7tpC^ZS`Qxb{<{J2=fKs{7NpLi5|>%mJA z1o0wX1i_=1f+ugKlpa0!fdv&xp@P^(ZR77Bb|BTfJOob;{4%pMJF~m9Z^`snsgO?f zr996|2cx;u=x))G;P>A2zBDRv=~N+yMylD_JE$GkN6+2#yv{D+dk-J&#hDC)Vm|r4 zt*86I;mniAC0xB>{%n}NHaS_j8hY6qm5X8Ja_07xa3WI(ieqQ)?%YH53qfwAJha;{ zC!STw`M2W7m8;ci9n2Yoepv8*|6N>8WL(8y9F|}WW?>*QAud4jA(#gf6+Pc7udP*( znC@5iWug{s*r1t?EBJ{d^{nQSb&IRcZmQbN%Td()U7+Nj&aWN4h9TGn^0(Y!y`U>r zWU^2}?P3$O$PuuUB(aB?uZ2y%U@UU`%jWQya1`FaCTzfu2IMo5{T-@~b@VDcfF2dJ zmHV-KK}VENJ2&Jrk-Z)C425>A-JXQ~P*0LxfLCx_14PZ&(bcz3sJF)X)JMf6((CX7 zK0tj((mM74>KLflSCC}j790f0TeuHP8aVm0hZgx=v&bOKfqExo>lsFh^)Pb6-v<7V zg8INs8g27!(e^oPaW)Lru=SqpDaw{FQsN4JCi5xSQZrE5Jh1jh=?Nb zC7?-Z2_GQ|9UV0_r{NxS90G2@8DbY8L9}Lf$&86s2=J0v_Es~0-hTZZgr+^<=-?U0 zvEw+FW$8M$Hy=uA+qPZTnP9;fvu#`96^5bj`$bV?S*F0iq^@fKFxvaaCs9Vs^L+FQ zfZ*B4CMpQ-U=65UW=81HN{0HA5pG=D*XIUTvvGLaBcQ;`8r*E=ieC`@#~(KZ diff --git a/include/TabWidget.h b/include/TabWidget.h index 97808baee02..51be8a173f8 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -29,16 +29,14 @@ #include #include -#include - class TabWidget : public QWidget { Q_OBJECT public: - TabWidget( const QString & _caption, QWidget * _parent ); + TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false ); virtual ~TabWidget(); - void addTab( QWidget * _w, const QString & _name, const char * pixmapName, int _idx = -1 ); + void addTab( QWidget *_w, const QString &_name, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 ); void setActiveTab( int _idx ); @@ -58,17 +56,20 @@ class TabWidget : public QWidget private: struct widgetDesc { - QWidget * w; // ptr to widget - const char *pixmapName; // artwork for the widget - QString name; // name for widget - int nwidth; // width of name when painting + QWidget * w; // ptr to widget + const char *activePixmap; // artwork for the widget + const char *inactivePixmap; // artwork for the widget + QString name; // name for widget + int nwidth; // width of name when painting (only valid for text tab) } ; typedef QMap widgetStack; widgetStack m_widgets; - int m_activeTab; + + int m_activeTab; QString m_caption; - quint8 m_tabheight; + quint8 m_tabheight; + bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index e5c1a8c7292..48c2042b7d0 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -31,14 +31,27 @@ #include "gui_templates.h" #include "embed.h" +const int GRAPHICAL_TAB_HEIGHT = 20; +const int TEXT_TAB_HEIGHT = 14; - -TabWidget::TabWidget( const QString & _caption, QWidget * _parent ) : +TabWidget::TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap ) : QWidget( _parent ), m_activeTab( 0 ), m_caption( _caption ), m_tabheight( _caption.isEmpty() ? 11: 10 ) { + + // TabWidget with artwork tabs have a height of 20 pixels + if ( usePixmap ) + { + m_usePixmap = true; + m_tabheight = GRAPHICAL_TAB_HEIGHT; + } else + { + m_usePixmap = false; + m_tabheight = _caption.isEmpty() ? TEXT_TAB_HEIGHT - 3 : TEXT_TAB_HEIGHT - 4; + } + setFont( pointSize<8>( font() ) ); setAutoFillBackground( true ); @@ -60,7 +73,7 @@ TabWidget::~TabWidget() -void TabWidget::addTab( QWidget * _w, const QString & _name, const char * pixmapName, int _idx ) +void TabWidget::addTab( QWidget * _w, const QString & _name, const char *activePixmap, const char *inactivePixmap, int _idx ) { setFont( pointSize<8>( font() ) ); @@ -76,14 +89,21 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char * pixma int w = fontMetrics().width( _name ) + 10; // Register new tab - widgetDesc d = { _w, pixmapName, _name, w } ; + widgetDesc d = { _w, activePixmap, inactivePixmap, _name, w } ; m_widgets[_idx] = d; - // Initialize tab's window - _w->setFixedSize( width() - 4, height() - 14 ); - _w->move( 2, 13 ); + // Position tab's window + if (m_usePixmap) { + _w->setFixedSize( width() - 4, height() - GRAPHICAL_TAB_HEIGHT ); + _w->move( 2, GRAPHICAL_TAB_HEIGHT -1 ); + } else + { + _w->setFixedSize( width() - 4, height() - TEXT_TAB_HEIGHT ); + _w->move( 2, TEXT_TAB_HEIGHT - 1 ); + } _w->hide(); + // Show tab's window if it's active if( m_widgets.contains( m_activeTab ) ) { // make sure new tab doesn't overlap current widget @@ -117,7 +137,9 @@ void TabWidget::setActiveTab( int _idx ) void TabWidget::mousePressEvent( QMouseEvent * _me ) { - if( _me->y() > 1 && _me->y() < 13 ) + int height = ( m_usePixmap ? GRAPHICAL_TAB_HEIGHT -1 : TEXT_TAB_HEIGHT -1 ); + + if( _me->y() > 1 && _me->y() < height ) { int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); @@ -144,7 +166,12 @@ void TabWidget::resizeEvent( QResizeEvent * ) for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - ( *it ).w->setFixedSize( width() - 4, height() - 14 ); + if ( m_usePixmap ) { + ( *it ).w->setFixedSize( width() - 4, height() - GRAPHICAL_TAB_HEIGHT ); + } else + { + ( *it ).w->setFixedSize( width() - 4, height() - TEXT_TAB_HEIGHT ); + } } } @@ -204,19 +231,38 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) // Draw all tabs widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); - int size = std::distance(first,last); for( widgetStack::iterator it = first ; it != last ; ++it ) { - // Draw a text tab when no artwork has been defined for the tab. - if ( (*it ).pixmapName == NULL ) + // Draw a text tab or a artwork tab. + if ( m_usePixmap ) { + // Recompute tab's width, because original size is only correct for text tabs + int size = std::distance(first,last); + ( *it ).nwidth = width() / size; + + // Get active or inactive artwork + QPixmap *artwork; + if( it.key() == m_activeTab ) + { + artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); + p.fillRect( tab_x_offset, 1, width() / size, GRAPHICAL_TAB_HEIGHT, cap_col ); + } else + { + artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + } + + // Draw artwork + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 1, *artwork ); + + } else + { // Highlight tab when active if( it.key() == m_activeTab ) { p.setPen( QColor( 32, 48, 64 ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, 10, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, TEXT_TAB_HEIGHT - 4, cap_col ); } // Draw text @@ -224,24 +270,6 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) // Reset text color p.setPen( cap_col ); - - - } else - { - // Get artwork - QPixmap *artwork = new QPixmap( embed::getIconPixmap( ( *it ).pixmapName ) ); - - if( it.key() == m_activeTab ) - { - p.fillRect( tab_x_offset, 1, width() / size, 12, cap_col ); - } - - // Draw artwork - p.drawPixmap(tab_x_offset + ( width() / ( size * 2 ) ) - 7, 0, *artwork ); - - // Recompute tab's width, because original size is only correct for text tabs - ( *it).nwidth = width() / size; - } // Next tab's horizontal position diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index a2449e52e2d..17855f64963 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1411,8 +1411,8 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : generalSettingsLayout->addLayout( basicControlsLayout ); - m_tabWidget = new TabWidget( "", this ); - m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); + m_tabWidget = new TabWidget( "", this, true ); + m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 16 ); // create tab-widgets @@ -1439,11 +1439,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); - m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions", 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_inactive", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), "miscellaneous", 5 ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions_active", "functions_inactive", 2 ); + m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx_active", "fx_inactive", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_active", "midi_inactive", 4 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), "miscellaneous_active", "miscellaneous_inactive", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "plugin", 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From f91c3a7b0bcffe5ebbedd3ca6289dbc16c923fcb Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 22 Feb 2016 10:23:01 +0100 Subject: [PATCH 06/39] Added tooltip support for the TabWidget class. Atm, tooltips are simply tabs' name. --- include/TabWidget.h | 3 ++ src/gui/widgets/TabWidget.cpp | 71 ++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 51be8a173f8..8a18ee8d7f2 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -40,6 +40,8 @@ class TabWidget : public QWidget void setActiveTab( int _idx ); + int findTabAtPos( const QPoint *pos ); + inline int activeTab() const { return( m_activeTab ); @@ -47,6 +49,7 @@ class TabWidget : public QWidget protected: + virtual bool event( QEvent * event ); virtual void mousePressEvent( QMouseEvent * _me ); virtual void paintEvent( QPaintEvent * _pe ); virtual void resizeEvent( QResizeEvent * _re ); diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 48c2042b7d0..ed2b68b5b87 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -27,6 +27,9 @@ #include #include +#include +#include +#include #include "gui_templates.h" #include "embed.h" @@ -132,30 +135,72 @@ void TabWidget::setActiveTab( int _idx ) } - - -void TabWidget::mousePressEvent( QMouseEvent * _me ) +// Return the index of the tab at position "pos" +int TabWidget::findTabAtPos( const QPoint *pos ) { int height = ( m_usePixmap ? GRAPHICAL_TAB_HEIGHT -1 : TEXT_TAB_HEIGHT -1 ); - if( _me->y() > 1 && _me->y() < height ) + if( pos->y() > 1 && pos->y() < height ) { - int cx = ( ( m_caption == "" ) ? 4 : 14 ) + - fontMetrics().width( m_caption ); - for( widgetStack::iterator it = m_widgets.begin(); - it != m_widgets.end(); ++it ) + int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); + + for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - if( _me->x() >= cx && - _me->x() <= cx + ( *it ).nwidth ) + if( pos->x() >= cx && pos->x() <= cx + ( *it ).nwidth ) { - setActiveTab( it.key() ); - update(); - return; + return( it.key() ); } cx += ( *it ).nwidth; } } + + // Haven't found any tab at position "pos" + return( -1 ); +} + + +// Overload the QWidget::event handler to display tooltips (from https://doc.qt.io/qt-4.8/qt-widgets-tooltips-example.html) +bool TabWidget::event(QEvent *event) +{ + + if ( event->type() == QEvent::ToolTip ) + { + QHelpEvent *helpEvent = static_cast(event); + + int idx = findTabAtPos( & helpEvent->pos() ); + + if ( idx != -1 ) + { + // Display tab's tooltip + QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].name ); + } else + { + // The tooltip event doesn't relate to any tab, let's ignore it + QToolTip::hideText(); + event->ignore(); + } + + return true; + } + + // not a Tooltip event, let's propagate it to the other event handlers + return QWidget::event(event); +} + + +// Activate tab when clicked +void TabWidget::mousePressEvent( QMouseEvent * _me ) +{ + + int idx = findTabAtPos( & _me->pos() ); + + if ( idx != -1 ) + { + setActiveTab( idx ); + update(); + return; + } } From 87900210f9e15a3104e675e87b896b46e05cece5 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 22 Feb 2016 10:46:14 +0100 Subject: [PATCH 07/39] Imported artworks from RebeccaDeField --- data/themes/default/env_lfo_active.png | Bin 411 -> 965 bytes data/themes/default/env_lfo_inactive.png | Bin 634 -> 965 bytes data/themes/default/functions_active.png | Bin 290 -> 965 bytes data/themes/default/functions_inactive.png | Bin 418 -> 965 bytes data/themes/default/fx_active.png | Bin 1783 -> 1021 bytes data/themes/default/fx_inactive.png | Bin 1783 -> 1021 bytes data/themes/default/midi_active.png | Bin 642 -> 965 bytes data/themes/default/midi_inactive.png | Bin 672 -> 965 bytes data/themes/default/misc_active.png | Bin 0 -> 965 bytes data/themes/default/misc_inactive.png | Bin 0 -> 965 bytes data/themes/default/miscellaneous_active.png | Bin 1783 -> 0 bytes .../themes/default/miscellaneous_inactive.png | Bin 1783 -> 0 bytes data/themes/default/plugin_active.png | Bin 300 -> 965 bytes data/themes/default/plugin_inactive.png | Bin 442 -> 965 bytes src/tracks/InstrumentTrack.cpp | 2 +- 15 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 data/themes/default/misc_active.png create mode 100644 data/themes/default/misc_inactive.png delete mode 100644 data/themes/default/miscellaneous_active.png delete mode 100644 data/themes/default/miscellaneous_inactive.png diff --git a/data/themes/default/env_lfo_active.png b/data/themes/default/env_lfo_active.png index 3336e9038e59f20dec6ea4aca38eacdf6d4339f6..9fbbf54bece9b14a7bc1c8973b137844e93cabbf 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8euupPQSSR|4cRFgO>bCYGe8 zD3oWGWGJ|M`Ua%vrLr?HFl&0cIEHA5GRiSO`~y}vV1y^o<|9D-5=y%h;}SohqW@U1 z4*_dL;0tHG+yu%C=0R?6ipxi3`8*h2bhP4fH@Oc2{tjfJPVY?2p7T6 z02u}Xj7$(3EBOm5itK!l5Xf5$_%vPsDFA|eAO`ul0K@@;^AHL*=>?R6`4gEYDt|IvM~21LcqjE*nHZMti#YxvXo=da< literal 411 zcmV;M0c8G(P)l&j5Qcl5y2d9W zcoc&oNM;Z`0~&+p0eA(d0*64hb%;Cx3SnxNY0IuJ3{VO%$9n zrDa*r9Ya+Pt=TjU&XaO$R|-9!FX)6v2EZGDbRl;#bo+a7da-y!Fbo3#ZvfJaSYKAWt3xn_y??TV2JjErQHd-1gOvt zh_L}5yqbYJ&O&vS0%<`YE{F0@6Vmt-st^=S3_vzJl>dW}MzA_$MNp0Zk;RbNEFcae z5FiWUVuK8Wsb|8a2q^vwBnMOrcRp0@PY{hy;{~X~e4u7v!eJ=aP37Z76u rM8z*CQJe(g??8M4hzV=L?hY!5wtQN7xr6J ziQ0kC!NGF5lzvEn81MR*+Y;0I+pX4p20VFvu%0pcaCQChI+;x3V$+#Nr%z9Lo*#{_ zz`-Uz)%67kT$H U)D~z9X#fBK07*qoM6N<$f;LMS-~a#s diff --git a/data/themes/default/functions_active.png b/data/themes/default/functions_active.png index 6f6bb96befddcfdcca577829c892898ea1016928..04d069db5c825678da9c4a3ec3738c24cdc56682 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8aSYKAWt3xn_y??z+QfgLfgp?(Fd>P`0NGoBSPV%F z#uNuKwgRynOaPhQ2;_ilxD3RLp==Nz#0H6h*gJq21At70DF7)#$G3rEAXk9_vQu9I zML_Wb0w5(bIe8!(U7i8iMkKWi|ByJyY$Rb+=5inx zWcp?xmI7jFAO?jdNNgDpV+Di)2NZA;*mM#T9k75x(T|=0U;zSBgf{`8m;&S=YebhL YpKt18ClWdNML5U=Pgg&ebxsLQ0JSn^(*OVf literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!3HF4glkxU6lZ})WHAE+w=f7ZGR&GI0Tg5} z@$_|Nf50TfD`E1{yy+!S=%A;IV~B;|-YKVf4=V_`cuvu>*eUMy#7A9Wsfgc|i5o6O zoEBL8wJ~DTcjFhfzaO<1zx%uQf7#w$noFNJaYQd&Dl)ye?0nu%W$QlYxSrKI;`|ma zJ1opybRJe()ELfaZDg2eu?MqQgZXYzBIvrfFMb6$JKnrv^;etF2y~VxcZNr3>g822WQ%mvv4FO#tTbYXblP diff --git a/data/themes/default/functions_inactive.png b/data/themes/default/functions_inactive.png index e107b3db46b975ff59f3810bd92a8afb3652e467..80ec4e5a8cfb77ede85b9137710889f8d0f4e7bd 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8ub#+N`rQ2c|EK8`W3P?~00gmG=5=xSU{*+Rx^>G|e)?)8G&nXATIljKV z!)C!?X_}5U4#RMiLqaNm+na0HAUOZjAY?;9B!-SDhHK}8^=QZs)p1N`fnI4*6pTkb z3h)}uBs1>&zDf0dw-ZXy^vG@i#ineI=URPfF6&h1X;Gep3%efqho{GGxQFQ*ss$H@ zCt%N=7_;a2n5PN9tJ4_Y#y!u2EXxQFHAmjGMhX*xyxI~b!7lkH(*TG2J$!zAweOGD zjPW_!ob)H7cep>?&E>DcKl?BGSu{ef(r~KDc1PDm3kE?jmAfkU3zz4R?kjEFSpWb4 M07*qoM6N<$f`e+UvH$=8 diff --git a/data/themes/default/fx_active.png b/data/themes/default/fx_active.png index 80680b092f17836a58525d1488d1cd44ede1109b..51dd5bfc920b520502d5edf40beb3ed35e7f0b08 100644 GIT binary patch literal 1021 zcmeAS@N?(olHy`uVBq!ia0vp^{6Ngd!3HEhbh*6;Qfx`y?k)`fL2$v|<&%LToCO|{ z#Xud`L734=V|E2lkiEpy*OmPNlNhHq&r;KbGe9BP%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6_|fq^;E)5S4FLzFR$dF3ClLTV8Iu^56^j0uYdqJ?0ZVK%^M zTn518!8A-WF2#7oX{H&)iP)S#6`L8MCc|iK7JI0bDneQeDCE;gn|K=z1}W_aA{q>UT8PLYR0;eXmUZB z$GZbQXh_n#y8>m4bqy^F;ix2-#O78lNQJhk8cye>{i))6wB#u&L^%;G;R))5PdxaIJ&!oOo^l}lY;r5;G+z{Y2EN?G{&cLBaWbZq39-zQ zj+E#vd^tUBON`}y*-!?g<~?uV(4CXg4nyWiZN$_)lm)7`gLq}+F|)JGpEjg@<$G(* z>cX5t4e51Ap{v1vO?08xWe~cL*%^~axgT-Z{C?4aoMkdoh7IZ&xKj8m_aU9cn^D3w ykniV^!>fhoD5Ov02LRWYf`2k`Bs5(<-U$B9#d#7M4p%oH&~%zV=-cTWjei0>vvlJC diff --git a/data/themes/default/fx_inactive.png b/data/themes/default/fx_inactive.png index 3f8754196add49e8c9afba520d608123e36e5c80..b5d27aade6be0807b1fc66f3b7e61b15148edf07 100644 GIT binary patch literal 1021 zcmeAS@N?(olHy`uVBq!ia0vp^{6Ngd!3HEhbh*6;Qfx`y?k)`fL2$v|<&%LToCO|{ z#Xud`L734=V|E2lkiEpy*OmPNlNhHq!ngD2Z?_H1-wT~VCP1XVdWYzJx8wOH7CRoCL{@kEr#FHjwNcw7&z zWHRYxT?wwGXY}-3U}I5V2t>44Vr<9VhUrsUXfW01Ra2IuB6|Lll}e>Eg1qM6@C{OP z0C|DuFsuoA7x2OJ)i?kz=<6g=2|0a?vQ>xeB5?v9Vvx;Q(cphgbOH8Q5kASq zl@J4x+`i-x8|Mpg0l4OyklTSb;Ev~o7{!;W$QVWfaQDEIAU5HJMrdw;BCZ_&0cZ}b gf`4V=$jtak^-n%G&)uip{(&?tP7B9F$3xS(Z+Ig!PXGV_ diff --git a/data/themes/default/midi_active.png b/data/themes/default/midi_active.png index a1333d08052c81b1d61a2a7525c3eda4d8cb9d76..db20f118ac57dc015afdaf129e2b32df7ed33a23 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8Unfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfmzej#W6%flu?fP;UBOzA7Gh+CNMREL zDqv&+t0IFK)rcq1Pyz=Q1uz<<55|VkFtboJ!UTz-hmb~Myn|KEqgCuGGqoNTfFwO# L{an^LB{Ts5pNTQE delta 627 zcmV-(0*w8|2Z9A5iBL{Q4GJ0x0000DNk~Le0000K0000K2nGNE0F8+q4Ur)ne+v@; z01FcV0GgZ_00007bV*G`2jBt~6c7xb%n&&M000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_C zX>@2HM@dakSAh-}0005%NklM`(M3`egp0^U(JuT7 zu7ox%{S57dK0`rnTGc`jTC@`^e@PN+Rb5(U*`_2UU&wn}G*2FHw-=;=;XHTF{Qq}m z&dj8ovy_sYGe{{xg`qeh$C={nU>%(jmvjEqfa)_h( z2hK;Ga5C zjDez^n*JMzyZ-Q<4Q#7vf0Z0(^B8-$SVUJ9gjHAS%UBI;johUAC2F-AjXdD*GKnh@ zz%ZUQ5hm=1)3AS+{$hdzN2+?Ha#X3x8P5NKFr!n&)@bAN5s7nP+gR@l!w!zeB$Tp) z*I2@^rl+z2v1j!!rN? N002ovPDHLkV1mgy8hQW# diff --git a/data/themes/default/midi_inactive.png b/data/themes/default/midi_inactive.png index 94b89d7fbd31801f56926b58deb675e543e43d84..d4dde1fba7b869c5977a42d423f4cca1d544afd1 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8E{F*d1JgLf z7@5GbWDuho@dO%5;J~5)MuYUh*f1Jq7K%ogATjh1(nySVu&TK{S&ZlFW!qICNl#Zl Jmvv4FO#nDpK;HlW delta 657 zcmV;C0&e}q2cQKZiBL{Q4GJ0x0000DNk~Le0000K0000K2nGNE0F8+q4Ur)ne+v@; z01FcV0GgZ_00007bV*G`2jBt~6b~^9{!+F8000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_C zX>@2HM@dakSAh-}0006ANklYZUwdP8sYM5DJ1rwhUSfe=V4ygT+CVh?7<++J@#n4t;LDCh>)O;NJh?{Lk~; zbMAQwNkjya017<=>OjV!$Y=P>fk8y%W4J>HNm)eX)|)^JIA`z)plbaaFtol6bRwcx z=17h(mz01@zyshmaLT|T@ZS0ve*oYMa8}YjuoV#pk~m6LQbW>?CS_I9e`!CfQ|@;p zHOxWg+?&9%quK@5fi*`r58U)KZ`+!Ec8yt<)Qkv{3(x}YIF&8n3D5^F1B<|Y-z@^~ zfJZ>XMZ0F~TS*(q)jSW(81w;n1-t-00Smw_e#&d$xhsFewi$EOlfROD(F5jyhi;7v zOv*)|TWYBu&@@L@7%RX>e_#c8<~F$s)J#mN|7yOg+IPj+3TBnhq8LNqN-4UmM3{}G zz7A{}n*bH5e)YfFbf4AuyR?Ao4qz5|SwtAX$WF8TyHraPggGLclFD%ePk6FA5t09CXE}@{ZAe-=3PoD7 zZS=e4P$o5anu6m85@mZ<8}LD~00000NkvXXu0mjfFSZ@$ diff --git a/data/themes/default/misc_active.png b/data/themes/default/misc_active.png new file mode 100644 index 0000000000000000000000000000000000000000..56af84757b170a9f533bc6d4c3e061144b4dfbb9 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8aSYKAWt3xn_y??z+QfgLfgp?(FkuxXLU0IaWQ2ML rXCUD4E+g4~#9<&Unfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfmzej#W6%flu?fP;UBO^jU$mO!g3)}l?SBD)78&qol`;+0Dl`i`2YX_ literal 0 HcmV?d00001 diff --git a/data/themes/default/miscellaneous_active.png b/data/themes/default/miscellaneous_active.png deleted file mode 100644 index e9c5fb576fb64a2aca1240c50b857c272d112a9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1783 zcmds&OGs2<7>57RnDN3C;-wOTi3k@FfS_Ga&uTh7%tLdeZ$kI0PpUOE|hUDe!l zqVxHq>}gp?{p4joeq&-HbKQ6G$;_yqxfZ)U?vKS%Ub_F%-Ghf!eb`I%40bhy2Ez|G z)Msy1y^V4;YSS*xiFNT=>{=8X5%0uzu_TU*U8_w!pNc;PC^{qpRTX$Ae}na9y-Xn` zzwDx1{9nNj>hwx5Lc}UooWldTX89lH>yV)H&%EUr(KFE{SU~)WBea4POBbLZqxdcG zJA}PSMEQBagH2zQtcj0i5YLDgf+CFIM-g~D1jsi9uMW12?kR5;|HJ|NCamL5;~Vv5 zP|jX?Rr#{$#*}zEMVYsHVeRmkM#l8v@6I0@(Krh9dV56JL z&Y|7h8c)es5zHNs;|0oAFR;N*Z|skP%$=z?H?Jhxb|^86F8I1|p6w`-;{}R+R!M9j wPECtot2_{V&hW}ARMssu`MYW@Snm}%QGxoD9bTNfKk$SGUa~Lo_`=BaU#w7u%mJA z1o0wX1i_=1f+ugKlpa0!fdv&xp@P^(ZR77Bb|BTfJOob;{4%pMJF~m9Z^`snsgO?f zr996|2cx;u=x))G;P>A2zBDRv=~N+yMylD_JE$GkN6+2#yv{D+dk-J&#hDC)Vm|r4 zt*86I;mniAC0xB>{%n}NHaS_j8hY6qm5X8Ja_07xa3WI(ieqQ)?%YH53qfwAJha;{ zC!STw`M2W7m8;ci9n2Yoepv8*|6N>8WL(8y9F|}WW?>*QAud4jA(#gf6+Pc7udP*( znC@5iWug{s*r1t?EBJ{d^{nQSb&IRcZmQbN%Td()U7+Nj&aWN4h9TGn^0(Y!y`U>r zWU^2}?P3$O$PuuUB(aB?uZ2y%U@UU`%jWQya1`FaCTzfu2IMo5{T-@~b@VDcfF2dJ zmHV-KK}VENJ2&Jrk-Z)C425>A-JXQ~P*0LxfLCx_14PZ&(bcz3sJF)X)JMf6((CX7 zK0tj((mM74>KLflSCC}j790f0TeuHP8aVm0hZgx=v&bOKfqExo>lsFh^)Pb6-v<7V zg8INs8g27!(e^oPaW)Lru=SqpDaw{FQsN4JCi5xSQ$GmocSM#50k?t#=wN6kR&Dx z9@WS;VJO4q91KNR1Q^M7D$GWhp?IAKR0LO#&qk0UxI&o8FdCmmn3|zZ@2qDP+&1&m Q43IxOUHx3vIVCg!01M$Sod5s; literal 300 zcmV+{0n`48P)d_rIeJ?U*N5^TI&U@ka)e{?3mZ% z=^Y!O2I>R#HS~ibU%1J%SA`+Y_7Z9h@XLnz0IH?bKo)$_Rf6z&nEjjTu+8VbJyZE9 zFhEJ45*j&)AF%++O>K{M_oj6;b@-u>;EPm-po0>twiMYGO%h zib8p2Nrr;Er*A-tUMf2S1GA>5i(`m}D5D(n!#`k!LxW&McIJN|fbkiD0K~>71`=li z5##_CT$+$=!lnkpIoK4Ti-EjBwo`Ei4!SKMJ}kgMY@9ZN6oCLp5jKERBR0iDRBXMs Vh{)a}`As0_d%F6$taD0e0sywWKNtW2 literal 442 zcmV;r0Y(0aP)VqKLM00045NklnuO{2H8obs#<NEbAZ2 zMrM{}K@fPJXWJxyU2WUeb=@?Li-^AOecv~-ilWdY&+{qK2FwUqE|(Z6^y&Epr5*G6 zJWW#}kc-6v(tujBdE8pZM~4nXw`u!vfR+bPW+Yx+r;zBFg=>$7;B?Z}YK6{KmSr5r znBQLaXNLsjRbJX#cOLNz#7QZ1><7o4VPJw}5&NlW(E6NiK!HH*3~W6jfElT_6)S=o#en?BwD85uI1j#{;@X z`uYPd_49!PvxXqZ0z~IkHp7F`iIC2ku8~eUEm(1cDc8`5(`E`C`cWgE!!R`9lo$rc knMaddTab( instrumentFunctions, tr( "FUNC" ), "functions_active", "functions_inactive", 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx_active", "fx_inactive", 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_active", "midi_inactive", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), "miscellaneous_active", "miscellaneous_inactive", 5 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), "misc_active", "misc_inactive", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); From ccc1c55aba29de792b24dc39343265e364678b89 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 22 Feb 2016 12:26:15 +0100 Subject: [PATCH 08/39] Reverted to 12px tall TabWidget --- include/TabWidget.h | 2 ++ src/gui/widgets/TabWidget.cpp | 44 ++++++++-------------------------- src/tracks/InstrumentTrack.cpp | 2 +- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 8a18ee8d7f2..4435c9e627a 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -29,6 +29,8 @@ #include #include +const int TAB_HEIGHT = 14; + class TabWidget : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index ed2b68b5b87..6cbf3a7c3f1 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -34,26 +34,15 @@ #include "gui_templates.h" #include "embed.h" -const int GRAPHICAL_TAB_HEIGHT = 20; -const int TEXT_TAB_HEIGHT = 14; - TabWidget::TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap ) : QWidget( _parent ), m_activeTab( 0 ), m_caption( _caption ), - m_tabheight( _caption.isEmpty() ? 11: 10 ) + m_tabheight( _caption.isEmpty() ? 11: 10 ), + m_usePixmap( usePixmap ) { - // TabWidget with artwork tabs have a height of 20 pixels - if ( usePixmap ) - { - m_usePixmap = true; - m_tabheight = GRAPHICAL_TAB_HEIGHT; - } else - { - m_usePixmap = false; - m_tabheight = _caption.isEmpty() ? TEXT_TAB_HEIGHT - 3 : TEXT_TAB_HEIGHT - 4; - } + m_tabheight = _caption.isEmpty() ? TAB_HEIGHT - 3 : TAB_HEIGHT - 4; setFont( pointSize<8>( font() ) ); @@ -88,7 +77,7 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char *active } } - // Tab's width when it is a text tab + // Tab's width when it is a text tab. This isn't correct for artwork tabs, but it's fixed later during the PaintEvent int w = fontMetrics().width( _name ) + 10; // Register new tab @@ -96,14 +85,8 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char *active m_widgets[_idx] = d; // Position tab's window - if (m_usePixmap) { - _w->setFixedSize( width() - 4, height() - GRAPHICAL_TAB_HEIGHT ); - _w->move( 2, GRAPHICAL_TAB_HEIGHT -1 ); - } else - { - _w->setFixedSize( width() - 4, height() - TEXT_TAB_HEIGHT ); - _w->move( 2, TEXT_TAB_HEIGHT - 1 ); - } + _w->setFixedSize( width() - 4, height() - TAB_HEIGHT ); + _w->move( 2, TAB_HEIGHT - 1 ); _w->hide(); // Show tab's window if it's active @@ -139,9 +122,7 @@ void TabWidget::setActiveTab( int _idx ) int TabWidget::findTabAtPos( const QPoint *pos ) { - int height = ( m_usePixmap ? GRAPHICAL_TAB_HEIGHT -1 : TEXT_TAB_HEIGHT -1 ); - - if( pos->y() > 1 && pos->y() < height ) + if( pos->y() > 1 && pos->y() < TAB_HEIGHT - 1 ) { int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); @@ -211,12 +192,7 @@ void TabWidget::resizeEvent( QResizeEvent * ) for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - if ( m_usePixmap ) { - ( *it ).w->setFixedSize( width() - 4, height() - GRAPHICAL_TAB_HEIGHT ); - } else - { - ( *it ).w->setFixedSize( width() - 4, height() - TEXT_TAB_HEIGHT ); - } + ( *it ).w->setFixedSize( width() - 4, height() - TAB_HEIGHT ); } } @@ -291,7 +267,7 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 1, width() / size, GRAPHICAL_TAB_HEIGHT, cap_col ); + p.fillRect( tab_x_offset, 1, width() / size, TAB_HEIGHT, cap_col ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); @@ -307,7 +283,7 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) if( it.key() == m_activeTab ) { p.setPen( QColor( 32, 48, 64 ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, TEXT_TAB_HEIGHT - 4, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, TAB_HEIGHT - 4, cap_col ); } // Draw text diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index b655c67b916..ca10d2c3e4b 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1412,7 +1412,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget = new TabWidget( "", this, true ); - m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 16 ); + m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + TAB_HEIGHT - 4 ); // create tab-widgets From a280816650b00fb319cdfb6387a0733ee4fb3bde Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 22 Feb 2016 14:47:24 +0100 Subject: [PATCH 09/39] Fine tuning for the positioning of artwork tabs: Take into account the caption 'space. --- src/gui/widgets/TabWidget.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 6cbf3a7c3f1..71ca2ea46f0 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -252,29 +252,30 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) // Draw all tabs widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); + int tab_width = ( width() - tab_x_offset ) / std::distance( first, last ); // Correct tab's width for artwork tabs for( widgetStack::iterator it = first ; it != last ; ++it ) { // Draw a text tab or a artwork tab. if ( m_usePixmap ) { - // Recompute tab's width, because original size is only correct for text tabs - int size = std::distance(first,last); - ( *it ).nwidth = width() / size; + + // Fixes tab's width, because original size is only correct for text tabs + ( *it ).nwidth = tab_width; // Get active or inactive artwork QPixmap *artwork; if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 1, width() / size, TAB_HEIGHT, cap_col ); + p.fillRect( tab_x_offset, 1, ( *it ).nwidth, TAB_HEIGHT - 1, cap_col ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 1, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 0, *artwork ); } else { From 21a1dfd58175621feba04793b390b09ae5ba0003 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 25 Feb 2016 15:34:05 +0100 Subject: [PATCH 10/39] New artwork for the ENV/LFO tab (has now an ADSR-based look) --- data/themes/default/env_lfo_active.png | Bin 965 -> 965 bytes data/themes/default/env_lfo_inactive.png | Bin 965 -> 965 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/themes/default/env_lfo_active.png b/data/themes/default/env_lfo_active.png index 9fbbf54bece9b14a7bc1c8973b137844e93cabbf..ecdf058229823a1bb71fb88d8c4eaaa7d5c1b2e7 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsNs^aIDe1gd5>QAsGbEzKIX^cyHLnE7WngeFN=+>w!R!jf@ delta 295 zcmX@gew2NJtsL)l1_s{ij7}P}D;O9U*h@TpUD+QniE*m)*0sxrO^mLbxIty&21!9r zpzIMKehH=BCoWWB^qXA3B+lqFaiN0bS)llTAT9-BK_D)N@=t>#e?mEIKpF(tff%It z$K;EQ8k7B*c_!C0asX*jP8N_f5HL=j$fylg&d4-zp|spDh%f`P2_PYm$qXPBk{3WM zAjk(|kog554iKCNI)Kp&>`;)K!5%pY6#ovyCx93zXbkqFvWS6!a>xXi4I)5M22WQ% Jmvv4FO#o_`J@fzo diff --git a/data/themes/default/env_lfo_inactive.png b/data/themes/default/env_lfo_inactive.png index bff9dee9fec67769d9f2774a2349e19f08d1bdef..c761087f4832c9615ea6b1975e235938f1c6af32 100644 GIT binary patch literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsNs^aI$VIH`98gF$GbEzKIX^cyHLnE7WngeFN=+aSYKAWt3xn_y??TV2JjErQHd-1gOvt zh_L}5yqbYJ&O&vS0%<`YE{F0@6Vmt-st^=S3_vzJl>dW}MzA_$MNp0Zk;RbNEFcae z5FiWUVuK8Wsb|8a2q^vwBnMOrcRp0@PY{hy;{~X~e4u7v!eJ=aP37Z76u rM8z*CQJe(g??8M4hzV=L?hY!5wtQN7xr6 Date: Thu, 25 Feb 2016 16:45:28 +0100 Subject: [PATCH 11/39] 1) Tabs in TabWidget class have now a "tooltip" attribute. So that they can now show more meaningfull information then simply the tab's name. 2) Fixed the compilation problem with QT5 --- include/TabWidget.h | 3 ++- src/gui/widgets/TabWidget.cpp | 11 +++++++---- src/tracks/InstrumentTrack.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 4435c9e627a..ed342bfce97 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -38,7 +38,7 @@ class TabWidget : public QWidget TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false ); virtual ~TabWidget(); - void addTab( QWidget *_w, const QString &_name, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 ); + void addTab( QWidget *_w, const QString &_name, const QString &_tooltip = NULL, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 ); void setActiveTab( int _idx ); @@ -65,6 +65,7 @@ class TabWidget : public QWidget const char *activePixmap; // artwork for the widget const char *inactivePixmap; // artwork for the widget QString name; // name for widget + QString tooltip; // name for widget int nwidth; // width of name when painting (only valid for text tab) } ; typedef QMap widgetStack; diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 71ca2ea46f0..8d48efa103c 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -65,7 +65,7 @@ TabWidget::~TabWidget() -void TabWidget::addTab( QWidget * _w, const QString & _name, const char *activePixmap, const char *inactivePixmap, int _idx ) +void TabWidget::addTab( QWidget * _w, const QString & _name, const QString & _tooltip, const char *activePixmap, const char *inactivePixmap, int _idx ) { setFont( pointSize<8>( font() ) ); @@ -81,7 +81,7 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char *active int w = fontMetrics().width( _name ) + 10; // Register new tab - widgetDesc d = { _w, activePixmap, inactivePixmap, _name, w } ; + widgetDesc d = { _w, activePixmap, inactivePixmap, _name, _tooltip, w } ; m_widgets[_idx] = d; // Position tab's window @@ -154,7 +154,7 @@ bool TabWidget::event(QEvent *event) if ( idx != -1 ) { // Display tab's tooltip - QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].name ); + QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].tooltip ); } else { // The tooltip event doesn't relate to any tab, let's ignore it @@ -174,8 +174,11 @@ bool TabWidget::event(QEvent *event) void TabWidget::mousePressEvent( QMouseEvent * _me ) { - int idx = findTabAtPos( & _me->pos() ); + // Find index of tab that has been clicked + QPoint pos = _me->pos(); + int idx = findTabAtPos( &pos ); + // When found, activate tab that has been clicked if ( idx != -1 ) { setActiveTab( idx ); diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index ca10d2c3e4b..ac75b7bc7fe 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1439,11 +1439,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); - m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions_active", "functions_inactive", 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx_active", "fx_inactive", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_active", "midi_inactive", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), "misc_active", "misc_inactive", 5 ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), tr( "FUNC" ), "functions_active", "functions_inactive", 2 ); + m_tabWidget->addTab( m_effectView, tr( "FX" ), tr( "FX" ), "fx_active", "fx_inactive", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), tr( "MIDI" ), "midi_active", "midi_inactive", 4 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), tr( "MISC" ), "misc_active", "misc_inactive", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From 9e1de4de793e1caa791524e44953afe09f253095 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 25 Feb 2016 21:34:32 +0100 Subject: [PATCH 12/39] Fine tuning the positioning of highlighted artwork tabs. --- src/gui/widgets/TabWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 8d48efa103c..1f038ec31b7 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -271,7 +271,7 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 1, ( *it ).nwidth, TAB_HEIGHT - 1, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth, TAB_HEIGHT - 3, cap_col ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); From 71761f290ea081dd07ab4baf6f98c6d235c2d2b4 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 25 Feb 2016 22:30:27 +0100 Subject: [PATCH 13/39] Fixed an issue in TabWidget's artwork tabs autosize function that makes gdb crash with SIGFPE. --- src/gui/widgets/TabWidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 1f038ec31b7..a6dfb297c77 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -252,10 +252,16 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) } p.setPen( cap_col ); - // Draw all tabs + // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); - int tab_width = ( width() - tab_x_offset ) / std::distance( first, last ); // Correct tab's width for artwork tabs + int tab_width = width(); + if ( first != last ) + { + tab_width = ( width() - tab_x_offset ) / std::distance( first, last ); + } + + // Draw all tabs for( widgetStack::iterator it = first ; it != last ; ++it ) { From e309f22552ced92a47966321b5a2bf8846ac4bc3 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 26 Feb 2016 11:08:04 +0100 Subject: [PATCH 14/39] TabWidget is 17 pixels tall when it's going to display artwork tabs. --- include/TabWidget.h | 6 ++++-- src/gui/widgets/TabWidget.cpp | 19 ++++++++++--------- src/tracks/InstrumentTrack.cpp | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index ed342bfce97..88f68dadcb3 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -29,7 +29,8 @@ #include #include -const int TAB_HEIGHT = 14; +const int TEXT_TAB_HEIGHT = 14; +const int GRAPHIC_TAB_HEIGHT = 17; class TabWidget : public QWidget { @@ -74,7 +75,8 @@ class TabWidget : public QWidget int m_activeTab; QString m_caption; - quint8 m_tabheight; + quint8 m_tabbarHeight; // The height of the tab bar + quint8 m_tabheight; // The height of the tabs bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. } ; diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index a6dfb297c77..ecb94373a7f 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -38,11 +38,12 @@ TabWidget::TabWidget( const QString & _caption, QWidget * _parent, bool usePixma QWidget( _parent ), m_activeTab( 0 ), m_caption( _caption ), - m_tabheight( _caption.isEmpty() ? 11: 10 ), m_usePixmap( usePixmap ) { - m_tabheight = _caption.isEmpty() ? TAB_HEIGHT - 3 : TAB_HEIGHT - 4; + // Create taller tabbar when it's to display artwork tabs + m_tabbarHeight = usePixmap ? GRAPHIC_TAB_HEIGHT : TEXT_TAB_HEIGHT; + m_tabheight = _caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; setFont( pointSize<8>( font() ) ); @@ -85,8 +86,8 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const QString & _to m_widgets[_idx] = d; // Position tab's window - _w->setFixedSize( width() - 4, height() - TAB_HEIGHT ); - _w->move( 2, TAB_HEIGHT - 1 ); + _w->setFixedSize( width() - 4, height() - m_tabbarHeight ); + _w->move( 2, m_tabbarHeight - 1 ); _w->hide(); // Show tab's window if it's active @@ -122,7 +123,7 @@ void TabWidget::setActiveTab( int _idx ) int TabWidget::findTabAtPos( const QPoint *pos ) { - if( pos->y() > 1 && pos->y() < TAB_HEIGHT - 1 ) + if( pos->y() > 1 && pos->y() < m_tabbarHeight - 1 ) { int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); @@ -195,7 +196,7 @@ void TabWidget::resizeEvent( QResizeEvent * ) for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - ( *it ).w->setFixedSize( width() - 4, height() - TAB_HEIGHT ); + ( *it ).w->setFixedSize( width() - 4, height() - m_tabbarHeight ); } } @@ -277,14 +278,14 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth, TAB_HEIGHT - 3, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth, m_tabbarHeight - 3, cap_col ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 0, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 2, *artwork ); } else { @@ -293,7 +294,7 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) if( it.key() == m_activeTab ) { p.setPen( QColor( 32, 48, 64 ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, TAB_HEIGHT - 4, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, cap_col ); } // Draw text diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index ac75b7bc7fe..eb4ca1eb927 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1412,7 +1412,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget = new TabWidget( "", this, true ); - m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + TAB_HEIGHT - 4 ); + m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 4 ); // create tab-widgets From a9de81d49253f74e766dfbf221f20d604861298f Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Wed, 27 Apr 2016 15:34:14 +0200 Subject: [PATCH 15/39] Removed underscore prefix for function parameters as coding convention has changed. (Request at https://github.com/LMMS/lmms/pull/2599/files/dccf9f411996c8c866ff1086b65f15020ef08cd9#r61165005) Cyrille --- src/gui/widgets/TabWidget.cpp | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index ecb94373a7f..4b64fb3b105 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -34,16 +34,16 @@ #include "gui_templates.h" #include "embed.h" -TabWidget::TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap ) : - QWidget( _parent ), +TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap ) : + QWidget( parent ), m_activeTab( 0 ), - m_caption( _caption ), + m_caption( caption ), m_usePixmap( usePixmap ) { // Create taller tabbar when it's to display artwork tabs m_tabbarHeight = usePixmap ? GRAPHIC_TAB_HEIGHT : TEXT_TAB_HEIGHT; - m_tabheight = _caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; + m_tabheight = caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; setFont( pointSize<8>( font() ) ); @@ -66,29 +66,29 @@ TabWidget::~TabWidget() -void TabWidget::addTab( QWidget * _w, const QString & _name, const QString & _tooltip, const char *activePixmap, const char *inactivePixmap, int _idx ) +void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *activePixmap, const char *inactivePixmap, int idx ) { setFont( pointSize<8>( font() ) ); // Append tab when position is not given - if( _idx < 0/* || m_widgets.contains( _idx ) == true*/ ) + if( idx < 0/* || m_widgets.contains( idx ) == true*/ ) { - while( m_widgets.contains( ++_idx ) == true ) + while( m_widgets.contains( ++idx ) == true ) { } } // Tab's width when it is a text tab. This isn't correct for artwork tabs, but it's fixed later during the PaintEvent - int w = fontMetrics().width( _name ) + 10; + int tab_width = fontMetrics().width( name ) + 10; // Register new tab - widgetDesc d = { _w, activePixmap, inactivePixmap, _name, _tooltip, w } ; - m_widgets[_idx] = d; + widgetDesc d = { w, activePixmap, inactivePixmap, name, tooltip, tab_width } ; + m_widgets[idx] = d; // Position tab's window - _w->setFixedSize( width() - 4, height() - m_tabbarHeight ); - _w->move( 2, m_tabbarHeight - 1 ); - _w->hide(); + w->setFixedSize( width() - 4, height() - m_tabbarHeight ); + w->move( 2, m_tabbarHeight - 1 ); + w->hide(); // Show tab's window if it's active if( m_widgets.contains( m_activeTab ) ) @@ -102,15 +102,15 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const QString & _to -void TabWidget::setActiveTab( int _idx ) +void TabWidget::setActiveTab( int idx ) { - if( m_widgets.contains( _idx ) ) + if( m_widgets.contains( idx ) ) { int old_active = m_activeTab; - m_activeTab = _idx; + m_activeTab = idx; m_widgets[m_activeTab].w->raise(); m_widgets[m_activeTab].w->show(); - if( old_active != _idx && m_widgets.contains( old_active ) ) + if( old_active != idx && m_widgets.contains( old_active ) ) { m_widgets[old_active].w->hide(); } @@ -172,11 +172,11 @@ bool TabWidget::event(QEvent *event) // Activate tab when clicked -void TabWidget::mousePressEvent( QMouseEvent * _me ) +void TabWidget::mousePressEvent( QMouseEvent * me ) { // Find index of tab that has been clicked - QPoint pos = _me->pos(); + QPoint pos = me->pos(); int idx = findTabAtPos( &pos ); // When found, activate tab that has been clicked @@ -204,7 +204,7 @@ void TabWidget::resizeEvent( QResizeEvent * ) -void TabWidget::paintEvent( QPaintEvent * _pe ) +void TabWidget::paintEvent( QPaintEvent * pe ) { setFont( pointSize<8>( font() ) ); QPainter p( this ); @@ -313,13 +313,13 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) // Switch between tabs with mouse wheel -void TabWidget::wheelEvent( QWheelEvent * _we ) +void TabWidget::wheelEvent( QWheelEvent * we ) { - if (_we->y() > m_tabheight) + if (we->y() > m_tabheight) return; - _we->accept(); - int dir = ( _we->delta() < 0 ) ? 1 : -1; + we->accept(); + int dir = ( we->delta() < 0 ) ? 1 : -1; int tab = m_activeTab; while( tab > -1 && static_cast( tab ) < m_widgets.count() ) { From 81a3fe03a242d1979d2ff074c3e670b5d80cde6b Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Wed, 27 Apr 2016 16:31:24 +0200 Subject: [PATCH 16/39] Removed background gradient for TabWidget as LMMS is going to a more flat design. Cyrille --- src/gui/widgets/TabWidget.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 4b64fb3b105..6014c5bfd8d 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -209,12 +209,8 @@ void TabWidget::paintEvent( QPaintEvent * pe ) setFont( pointSize<8>( font() ) ); QPainter p( this ); - QColor bg_color = QApplication::palette().color( QPalette::Active, - QPalette::Background ); - QLinearGradient g( 0, 0, 0, m_tabheight ); - g.setColorAt( 0, bg_color.darker( 250 ) ); - g.setColorAt( 0.1, bg_color.lighter( 120 ) ); - g.setColorAt( 1, bg_color.darker( 250 ) ); + QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ); + p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); bool big_tab_captions = ( m_caption == "" ); @@ -229,7 +225,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) p.setPen( QColor( 0, 0, 0 ) ); p.drawRect( 1, 1, width() - 3, height() - 3 ); - p.fillRect( 2, 2, width() - 4, m_tabheight, g ); p.drawLine( 2, m_tabheight + 2, width() - 3, m_tabheight + 2); if( ! m_caption.isEmpty() ) From 483f03fad4835c64eb8537db6182cf1860810216 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 29 Apr 2016 13:47:13 +0200 Subject: [PATCH 17/39] Increased the graphical TabWidget's height by 2 pixels for eye-candy. The InstrumentTrackWindow's height has been increased by the same amount. Cyrille --- include/TabWidget.h | 2 +- src/gui/widgets/TabWidget.cpp | 4 ++-- src/tracks/InstrumentTrack.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 88f68dadcb3..0c2439c5af3 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -30,7 +30,7 @@ #include const int TEXT_TAB_HEIGHT = 14; -const int GRAPHIC_TAB_HEIGHT = 17; +const int GRAPHIC_TAB_HEIGHT = 19; class TabWidget : public QWidget { diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 6014c5bfd8d..00dcfbba516 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -273,14 +273,14 @@ void TabWidget::paintEvent( QPaintEvent * pe ) if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth, m_tabbarHeight - 3, cap_col ); + p.fillRect( tab_x_offset, 3, ( *it ).nwidth, m_tabbarHeight - 5, cap_col ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 2, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 3, *artwork ); } else { diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index eb4ca1eb927..9a4deda5e9c 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -80,7 +80,7 @@ const char * volume_help = QT_TRANSLATE_NOOP( "InstrumentTrack", "the volume of the opened " "channel."); -const int INSTRUMENT_WIDTH = 254; +const int INSTRUMENT_WIDTH = 256; const int INSTRUMENT_HEIGHT = INSTRUMENT_WIDTH; const int PIANO_HEIGHT = 80; const int INSTRUMENT_WINDOW_CACHE_SIZE = 8; @@ -1412,7 +1412,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget = new TabWidget( "", this, true ); - m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 4 ); + m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 6 ); // create tab-widgets From b4e2a4b13209728358db790b43bf5fdb08afed8a Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 29 Apr 2016 14:34:24 +0200 Subject: [PATCH 18/39] Removed gradient in GrouBox widgets as LMMS is going for a more flattened design. Cyrille --- src/gui/widgets/GroupBox.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index fbcf88ed784..654049ad30c 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -97,7 +97,7 @@ void GroupBox::updatePixmap() QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ); QPixmap pm( size() ); - pm.fill( bg_color/*.dark( 132 )*/ ); + pm.fill( bg_color ); QPainter p( &pm ); @@ -110,13 +110,6 @@ void GroupBox::updatePixmap() p.drawLine( width() - 1, 0, width() - 1, height() - 1 ); p.drawLine( 0, height() - 1, width() - 1, height() - 1 ); - // draw groupbox-titlebar - QLinearGradient g( 0, 0, 0, m_titleBarHeight ); - g.setColorAt( 0, bg_color.darker( 250 ) ); - g.setColorAt( 0.1, bg_color.lighter( 120 ) ); - g.setColorAt( 1, bg_color.darker( 250 ) ); - p.fillRect( 2, 2, width() - 4, m_titleBarHeight, g ); - // draw line below titlebar p.setPen( bg_color.dark( 400 ) ); p.drawLine( 1, m_titleBarHeight + 1, width() - 3, m_titleBarHeight + 1 ); @@ -124,8 +117,6 @@ void GroupBox::updatePixmap() // black inner rect p.drawRect( 1, 1, width() - 3, height() - 3 ); - - //p.setPen( QColor( 255, 255, 255 ) ); p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); p.setFont( pointSize<8>( font() ) ); p.drawText( 22, m_titleBarHeight, m_caption ); From c52033c9aaa5ef4e47cbe29e8ba5040a614e1cf3 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 12 May 2016 15:56:50 +0200 Subject: [PATCH 19/39] Made the background of TabWidget themeable Cyrille --- data/themes/default/style.css | 4 ++++ src/gui/widgets/TabWidget.cpp | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 035ed7a5f56..be4022e8451 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -136,6 +136,10 @@ PianoRoll { qproperty-textShadow: #fff; } +TabWidget { + background-color: #5b6571; +} + /* main toolbar oscilloscope - can have transparent bg now */ VisualizationWidget { diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 00dcfbba516..0190d239097 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -48,15 +48,14 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap setFont( pointSize<8>( font() ) ); setAutoFillBackground( true ); - QColor bg_color = QApplication::palette().color( QPalette::Active, - QPalette::Background ). - darker( 132 ); - QPalette pal = palette(); - pal.setColor( QPalette::Background, bg_color ); - setPalette( pal ); -} - + QColor bg_color = QApplication::palette().color( QPalette::Active, + QPalette::Background ). + darker( 132 ); + QPalette pal = palette(); + pal.setColor( QPalette::Background, bg_color ); + setPalette( pal ); +} TabWidget::~TabWidget() @@ -64,8 +63,6 @@ TabWidget::~TabWidget() } - - void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *activePixmap, const char *inactivePixmap, int idx ) { setFont( pointSize<8>( font() ) ); @@ -209,16 +206,17 @@ void TabWidget::paintEvent( QPaintEvent * pe ) setFont( pointSize<8>( font() ) ); QPainter p( this ); - QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ); +// QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ); + QBrush bg_color = p.background(); p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); bool big_tab_captions = ( m_caption == "" ); - p.setPen( bg_color.darker( 150 ) ); + p.setPen( bg_color.color().darker( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); - p.setPen( bg_color.light( 150 ) ); + p.setPen( bg_color.color().light( 150 ) ); p.drawLine( width() - 1, 0, width() - 1, height() - 1 ); p.drawLine( 0, height() - 1, width() - 1, height() - 1 ); From 2651622049652dd1fcd1b962b54176308a7d2d43 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 12 May 2016 16:33:18 +0200 Subject: [PATCH 20/39] The highlighting color for a TabWidget'selected tab is now themeable. --- data/themes/default/style.css | 1 + include/TabWidget.h | 7 +++++++ src/gui/widgets/TabWidget.cpp | 29 ++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index be4022e8451..b2b3a075d7b 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -138,6 +138,7 @@ PianoRoll { TabWidget { background-color: #5b6571; + qproperty-tabSelected: rgb(160, 160, 160); } /* main toolbar oscilloscope - can have transparent bg now */ diff --git a/include/TabWidget.h b/include/TabWidget.h index 0c2439c5af3..c96b83144bb 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -50,6 +50,11 @@ class TabWidget : public QWidget return( m_activeTab ); } + // Themeability + Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected) + + QColor tabSelected() const; + void setTabSelected( const QColor & c ); protected: virtual bool event( QEvent * event ); @@ -78,6 +83,8 @@ class TabWidget : public QWidget quint8 m_tabbarHeight; // The height of the tab bar quint8 m_tabheight; // The height of the tabs bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. + + QColor m_tabSelected; // The highlighting color for the selected tab. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 0190d239097..288066bce04 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -38,11 +38,13 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap QWidget( parent ), m_activeTab( 0 ), m_caption( caption ), - m_usePixmap( usePixmap ) + m_usePixmap( usePixmap ), + m_tabSelected( 0, 0, 0 ) { // Create taller tabbar when it's to display artwork tabs m_tabbarHeight = usePixmap ? GRAPHIC_TAB_HEIGHT : TEXT_TAB_HEIGHT; + m_tabheight = caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; setFont( pointSize<8>( font() ) ); @@ -231,20 +233,18 @@ void TabWidget::paintEvent( QPaintEvent * pe ) p.drawText( 5, 11, m_caption ); } - // Calculate the tabs' x (tabs are painted next to the caption) - int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); + // Calculate the tabs' x (tabs are painted next to the caption) + int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); - QColor cap_col( 160, 160, 160 ); if( big_tab_captions ) { p.setFont( pointSize<8>( p.font() ) ); - cap_col = QColor( 224, 224, 224 ); } else { p.setFont( pointSize<7>( p.font() ) ); } - p.setPen( cap_col ); + p.setPen( tabSelected() ); // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); @@ -271,7 +271,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) if( it.key() == m_activeTab ) { artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 3, ( *it ).nwidth, m_tabbarHeight - 5, cap_col ); + p.fillRect( tab_x_offset, 3, ( *it ).nwidth, m_tabbarHeight - 5, tabSelected() ); } else { artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); @@ -287,14 +287,14 @@ void TabWidget::paintEvent( QPaintEvent * pe ) if( it.key() == m_activeTab ) { p.setPen( QColor( 32, 48, 64 ) ); - p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, cap_col ); + p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, tabSelected() ); } // Draw text p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); // Reset text color - p.setPen( cap_col ); + p.setPen( tabSelected() ); } // Next tab's horizontal position @@ -324,3 +324,14 @@ void TabWidget::wheelEvent( QWheelEvent * we ) } setActiveTab( tab ); } + +QColor TabWidget::tabSelected() const +{ + return m_tabSelected; +} + +void TabWidget::setTabSelected( const QColor & c ) +{ + m_tabSelected = c; +} + From fd9e38b058f492fe9da120dabaf0d56a00501b3a Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 13 May 2016 12:41:53 +0200 Subject: [PATCH 21/39] Made TabWidget's Title text and tab text themeable. --- data/themes/default/style.css | 2 ++ include/TabWidget.h | 8 +++++++ src/gui/widgets/TabWidget.cpp | 42 +++++++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index b2b3a075d7b..b51efed24e4 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -138,6 +138,8 @@ PianoRoll { TabWidget { background-color: #5b6571; + qproperty-tabText: rgb(32, 48, 64); + qproperty-tabTitleText: rgb(255, 255, 255); qproperty-tabSelected: rgb(160, 160, 160); } diff --git a/include/TabWidget.h b/include/TabWidget.h index c96b83144bb..27933e8d077 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -51,8 +51,14 @@ class TabWidget : public QWidget } // Themeability + Q_PROPERTY( QColor tabText READ tabText WRITE setTabText) + Q_PROPERTY( QColor tabTitleText READ tabTitleText WRITE setTabTitleText) Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected) + QColor tabText() const; + void setTabText( const QColor & c ); + QColor tabTitleText() const; + void setTabTitleText( const QColor & c ); QColor tabSelected() const; void setTabSelected( const QColor & c ); @@ -84,6 +90,8 @@ class TabWidget : public QWidget quint8 m_tabheight; // The height of the tabs bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. + QColor m_tabText; // The color of the tabs' text. + QColor m_tabTitleText; // The color of the TabWidget's title text. QColor m_tabSelected; // The highlighting color for the selected tab. } ; diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 288066bce04..0f6d364ff3a 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -39,6 +39,8 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap m_activeTab( 0 ), m_caption( caption ), m_usePixmap( usePixmap ), + m_tabText( 0, 0, 0 ), + m_tabTitleText( 0, 0, 0 ), m_tabSelected( 0, 0, 0 ) { @@ -59,12 +61,10 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap } - TabWidget::~TabWidget() { } - void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *activePixmap, const char *inactivePixmap, int idx ) { setFont( pointSize<8>( font() ) ); @@ -208,7 +208,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) setFont( pointSize<8>( font() ) ); QPainter p( this ); -// QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ); QBrush bg_color = p.background(); p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); @@ -229,7 +228,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) if( ! m_caption.isEmpty() ) { - p.setPen( QColor( 255, 255, 255 ) ); + p.setPen( tabTitleText() ); p.drawText( 5, 11, m_caption ); } @@ -244,7 +243,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) { p.setFont( pointSize<7>( p.font() ) ); } - p.setPen( tabSelected() ); // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); @@ -256,13 +254,13 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw all tabs + p.setPen( tabText() ); for( widgetStack::iterator it = first ; it != last ; ++it ) { // Draw a text tab or a artwork tab. if ( m_usePixmap ) { - // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; @@ -279,22 +277,16 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Draw artwork p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 3, *artwork ); - } else { - // Highlight tab when active if( it.key() == m_activeTab ) { - p.setPen( QColor( 32, 48, 64 ) ); p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, tabSelected() ); } // Draw text p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); - - // Reset text color - p.setPen( tabSelected() ); } // Next tab's horizontal position @@ -325,11 +317,37 @@ void TabWidget::wheelEvent( QWheelEvent * we ) setActiveTab( tab ); } +// Return the color to be used to draw a TabWidget's title text (if any) +QColor TabWidget::tabTitleText() const +{ + return m_tabTitleText; +} + +// Set the color to be used to draw a TabWidget's title text (if any) +void TabWidget::setTabTitleText( const QColor & c ) +{ + m_tabTitleText = c; +} + +// Return the color to be used to draw a TabWidget's text (if any) +QColor TabWidget::tabText() const +{ + return m_tabText; +} + +// Set the color to be used to draw a TabWidget's text (if any) +void TabWidget::setTabText( const QColor & c ) +{ + m_tabText = c; +} + +// Return the color to be used to highlight a TabWidget'selected tab (if any) QColor TabWidget::tabSelected() const { return m_tabSelected; } +// Set the color to be used to highlight a TabWidget'selected tab (if any) void TabWidget::setTabSelected( const QColor & c ) { m_tabSelected = c; From eb97167b60b5a0fafaf3db47d84dc9ff7c3ade9f Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 13 May 2016 14:04:50 +0200 Subject: [PATCH 22/39] Added a darker background to the TabWidget's tab bar. --- src/gui/widgets/TabWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 0f6d364ff3a..d6f3e2a14fd 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -224,7 +224,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) p.setPen( QColor( 0, 0, 0 ) ); p.drawRect( 1, 1, width() - 3, height() - 3 ); - p.drawLine( 2, m_tabheight + 2, width() - 3, m_tabheight + 2); + p.fillRect( 2, 0, width() - 3, m_tabheight + 2, bg_color.color().darker( 150 ) ); if( ! m_caption.isEmpty() ) { From ad795d0636205980c7c553a1d912ab9d270861a8 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 13 May 2016 14:28:12 +0200 Subject: [PATCH 23/39] Further flatened the design of TabWidget --- src/gui/widgets/TabWidget.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index d6f3e2a14fd..bdceaf19398 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -208,24 +208,20 @@ void TabWidget::paintEvent( QPaintEvent * pe ) setFont( pointSize<8>( font() ) ); QPainter p( this ); + // Draw background QBrush bg_color = p.background(); - p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); bool big_tab_captions = ( m_caption == "" ); + // Draw external borders p.setPen( bg_color.color().darker( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); - p.setPen( bg_color.color().light( 150 ) ); - p.drawLine( width() - 1, 0, width() - 1, height() - 1 ); - p.drawLine( 0, height() - 1, width() - 1, height() - 1 ); - - p.setPen( QColor( 0, 0, 0 ) ); - p.drawRect( 1, 1, width() - 3, height() - 3 ); - - p.fillRect( 2, 0, width() - 3, m_tabheight + 2, bg_color.color().darker( 150 ) ); + // Draw tabs' bar background + p.fillRect( 1, 1, width() - 2, m_tabheight + 2, bg_color.color().darker( 150 ) ); + // Draw title, if any if( ! m_caption.isEmpty() ) { p.setPen( tabTitleText() ); From 757d4c00a1f84f4f79c59bcb617774b740722ef9 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 13 May 2016 16:23:51 +0200 Subject: [PATCH 24/39] Flatened the design of the GroupBox widget --- src/gui/widgets/EffectRackView.cpp | 2 +- src/gui/widgets/GroupBox.cpp | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/EffectRackView.cpp b/src/gui/widgets/EffectRackView.cpp index 2fa25d5750d..b3f468d0eb3 100644 --- a/src/gui/widgets/EffectRackView.cpp +++ b/src/gui/widgets/EffectRackView.cpp @@ -39,7 +39,7 @@ EffectRackView::EffectRackView( EffectChain* model, QWidget* parent ) : ModelView( NULL, this ) { QVBoxLayout* mainLayout = new QVBoxLayout( this ); - mainLayout->setMargin( 0 ); + mainLayout->setMargin( 5 ); m_effectsGroupBox = new GroupBox( tr( "EFFECTS CHAIN" ) ); mainLayout->addWidget( m_effectsGroupBox ); diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 654049ad30c..19149f9fc8d 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -105,18 +105,10 @@ void GroupBox::updatePixmap() p.setPen( bg_color.dark( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); - // brighter line at bottom/right - p.setPen( bg_color.light( 150 ) ); - p.drawLine( width() - 1, 0, width() - 1, height() - 1 ); - p.drawLine( 0, height() - 1, width() - 1, height() - 1 ); - // draw line below titlebar - p.setPen( bg_color.dark( 400 ) ); - p.drawLine( 1, m_titleBarHeight + 1, width() - 3, m_titleBarHeight + 1 ); - - // black inner rect - p.drawRect( 1, 1, width() - 3, height() - 3 ); + p.fillRect( 1, 1, width() - 2, m_titleBarHeight + 1, bg_color.darker( 150 ) ); + // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); p.setFont( pointSize<8>( font() ) ); p.drawText( 22, m_titleBarHeight, m_caption ); From ef392b2615ece02a64f239e14cb1a530729935ea Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 19 May 2016 09:28:09 +0200 Subject: [PATCH 25/39] Fine tuning the placement of TabWidgets' highlighting background + some code cleaning in TabWidgets --- include/TabWidget.h | 2 +- src/gui/widgets/TabWidget.cpp | 28 +++++++++------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 27933e8d077..2ad2c50dcb5 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -30,7 +30,7 @@ #include const int TEXT_TAB_HEIGHT = 14; -const int GRAPHIC_TAB_HEIGHT = 19; +const int GRAPHIC_TAB_HEIGHT = 17; class TabWidget : public QWidget { diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index bdceaf19398..77e5104e4bb 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -205,15 +206,13 @@ void TabWidget::resizeEvent( QResizeEvent * ) void TabWidget::paintEvent( QPaintEvent * pe ) { - setFont( pointSize<8>( font() ) ); QPainter p( this ); + p.setFont( pointSize<7>( font() ) ); // Draw background QBrush bg_color = p.background(); p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); - bool big_tab_captions = ( m_caption == "" ); - // Draw external borders p.setPen( bg_color.color().darker( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); @@ -224,6 +223,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Draw title, if any if( ! m_caption.isEmpty() ) { + p.setFont( pointSize<8>( p.font() ) ); p.setPen( tabTitleText() ); p.drawText( 5, 11, m_caption ); } @@ -231,15 +231,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Calculate the tabs' x (tabs are painted next to the caption) int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); - if( big_tab_captions ) - { - p.setFont( pointSize<8>( p.font() ) ); - } - else - { - p.setFont( pointSize<7>( p.font() ) ); - } - // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); @@ -264,15 +255,14 @@ void TabWidget::paintEvent( QPaintEvent * pe ) QPixmap *artwork; if( it.key() == m_activeTab ) { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 3, ( *it ).nwidth, m_tabbarHeight - 5, tabSelected() ); - } else - { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); + p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); + } else { + artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 3, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 1, *artwork ); } else { // Highlight tab when active @@ -282,7 +272,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw text - p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); + p.drawText( tab_x_offset + 3, m_tabheight + 1, ( *it ).name ); } // Next tab's horizontal position From 70c8eda5d990ebded1f54dd48a64d9feffc37c65 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 19 May 2016 11:20:22 +0200 Subject: [PATCH 26/39] Made the TabWidget's title background and borders themeable --- data/themes/default/style.css | 2 ++ include/TabWidget.h | 8 ++++++++ src/gui/widgets/TabWidget.cpp | 32 +++++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index b51efed24e4..c959f3e0247 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -141,6 +141,8 @@ TabWidget { qproperty-tabText: rgb(32, 48, 64); qproperty-tabTitleText: rgb(255, 255, 255); qproperty-tabSelected: rgb(160, 160, 160); + qproperty-tabBackground: rgb(60, 67, 75); + qproperty-tabBorder: rgb(60, 67, 75); } /* main toolbar oscilloscope - can have transparent bg now */ diff --git a/include/TabWidget.h b/include/TabWidget.h index 2ad2c50dcb5..9908887b863 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -54,6 +54,8 @@ class TabWidget : public QWidget Q_PROPERTY( QColor tabText READ tabText WRITE setTabText) Q_PROPERTY( QColor tabTitleText READ tabTitleText WRITE setTabTitleText) Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected) + Q_PROPERTY( QColor tabBackground READ tabBackground WRITE setTabBackground) + Q_PROPERTY( QColor tabBorder READ tabBorder WRITE setTabBorder) QColor tabText() const; void setTabText( const QColor & c ); @@ -61,6 +63,10 @@ class TabWidget : public QWidget void setTabTitleText( const QColor & c ); QColor tabSelected() const; void setTabSelected( const QColor & c ); + QColor tabBackground() const; + void setTabBackground( const QColor & c ); + QColor tabBorder() const; + void setTabBorder( const QColor & c ); protected: virtual bool event( QEvent * event ); @@ -93,6 +99,8 @@ class TabWidget : public QWidget QColor m_tabText; // The color of the tabs' text. QColor m_tabTitleText; // The color of the TabWidget's title text. QColor m_tabSelected; // The highlighting color for the selected tab. + QColor m_tabBackground; // The TabWidget's background color. + QColor m_tabBorder; // The TabWidget's borders color. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 77e5104e4bb..f40b323c8ab 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -42,7 +42,9 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap m_usePixmap( usePixmap ), m_tabText( 0, 0, 0 ), m_tabTitleText( 0, 0, 0 ), - m_tabSelected( 0, 0, 0 ) + m_tabSelected( 0, 0, 0 ), + m_tabBackground( 0, 0, 0 ), + m_tabBorder( 0, 0, 0 ) { // Create taller tabbar when it's to display artwork tabs @@ -214,11 +216,11 @@ void TabWidget::paintEvent( QPaintEvent * pe ) p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); // Draw external borders - p.setPen( bg_color.color().darker( 150 ) ); + p.setPen( tabBorder() ); p.drawRect( 0, 0, width() - 1, height() - 1 ); // Draw tabs' bar background - p.fillRect( 1, 1, width() - 2, m_tabheight + 2, bg_color.color().darker( 150 ) ); + p.fillRect( 1, 1, width() - 2, m_tabheight + 2, tabBackground() ); // Draw title, if any if( ! m_caption.isEmpty() ) @@ -339,3 +341,27 @@ void TabWidget::setTabSelected( const QColor & c ) m_tabSelected = c; } +// Return the color to be used for the TabWidget's background +QColor TabWidget::tabBackground() const +{ + return m_tabBackground; +} + +// Set the color to be used for the TabWidget's background +void TabWidget::setTabBackground( const QColor & c ) +{ + m_tabBackground = c; +} + +// Return the color to be used for the TabWidget's borders +QColor TabWidget::tabBorder() const +{ + return m_tabBorder; +} + +// Set the color to be used for the TabWidget's borders +void TabWidget::setTabBorder( const QColor & c ) +{ + m_tabBorder = c; +} + From ab66556b67cbaa6ab56bf075a45d91bfad6d7e1e Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 19 May 2016 15:51:46 +0200 Subject: [PATCH 27/39] TabWidget - Artwork tabs: Do not change the icon color when it is highlighted --- src/gui/widgets/TabWidget.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index f40b323c8ab..aafc673cb30 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -253,18 +252,17 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; - // Get active or inactive artwork - QPixmap *artwork; + // Get artwork + QPixmap artwork( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + + // Highlight active tab if( it.key() == m_activeTab ) { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); - } else { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 1, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork ); } else { // Highlight tab when active From 9f4df3f045e5649d40bc40583a696f55d0e0779e Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 20 May 2016 16:00:04 +0200 Subject: [PATCH 28/39] TabWidget: Made the artworks' color themeable --- data/themes/default/style.css | 2 ++ include/TabWidget.h | 18 ++++++++++---- src/gui/widgets/TabWidget.cpp | 46 +++++++++++++++++++++++++++++------ 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index c959f3e0247..34eac23ed94 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -143,6 +143,8 @@ TabWidget { qproperty-tabSelected: rgb(160, 160, 160); qproperty-tabBackground: rgb(60, 67, 75); qproperty-tabBorder: rgb(60, 67, 75); + qproperty-tabArtworkActive: rgb(255, 255, 255); + qproperty-tabArtworkInactive: rgb(160, 160, 160); } /* main toolbar oscilloscope - can have transparent bg now */ diff --git a/include/TabWidget.h b/include/TabWidget.h index 9908887b863..bcac0f50144 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -56,6 +56,8 @@ class TabWidget : public QWidget Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected) Q_PROPERTY( QColor tabBackground READ tabBackground WRITE setTabBackground) Q_PROPERTY( QColor tabBorder READ tabBorder WRITE setTabBorder) + Q_PROPERTY( QColor tabArtworkActive READ tabArtworkActive WRITE setTabArtworkActive) + Q_PROPERTY( QColor tabArtworkInactive READ tabArtworkInactive WRITE setTabArtworkInactive) QColor tabText() const; void setTabText( const QColor & c ); @@ -67,6 +69,10 @@ class TabWidget : public QWidget void setTabBackground( const QColor & c ); QColor tabBorder() const; void setTabBorder( const QColor & c ); + QColor tabArtworkActive() const; + void setTabArtworkActive( const QColor & c ); + QColor tabArtworkInactive() const; + void setTabArtworkInactive( const QColor & c ); protected: virtual bool event( QEvent * event ); @@ -96,11 +102,13 @@ class TabWidget : public QWidget quint8 m_tabheight; // The height of the tabs bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. - QColor m_tabText; // The color of the tabs' text. - QColor m_tabTitleText; // The color of the TabWidget's title text. - QColor m_tabSelected; // The highlighting color for the selected tab. - QColor m_tabBackground; // The TabWidget's background color. - QColor m_tabBorder; // The TabWidget's borders color. + QColor m_tabText; // The color of the tabs' text. + QColor m_tabTitleText; // The color of the TabWidget's title text. + QColor m_tabSelected; // The highlighting color for the selected tab. + QColor m_tabBackground; // The TabWidget's background color. + QColor m_tabBorder; // The TabWidget's borders color. + QColor m_tabArtworkActive; // The color for active artwork tabs. + QColor m_tabArtworkInactive; // The color for inactive artwork tabs. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index aafc673cb30..6064cb15d0a 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -43,7 +44,9 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap m_tabTitleText( 0, 0, 0 ), m_tabSelected( 0, 0, 0 ), m_tabBackground( 0, 0, 0 ), - m_tabBorder( 0, 0, 0 ) + m_tabBorder( 0, 0, 0 ), + m_tabArtworkActive( 0, 0, 0 ), + m_tabArtworkInactive( 0, 0, 0 ) { // Create taller tabbar when it's to display artwork tabs @@ -242,7 +245,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw all tabs - p.setPen( tabText() ); for( widgetStack::iterator it = first ; it != last ; ++it ) { @@ -252,17 +254,21 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; - // Get artwork - QPixmap artwork( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + // Create a mask out of the tab's artwork (for changing it's color later on) + QBitmap mask = QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ).createMaskFromColor( Qt::black, Qt::MaskOutColor ); - // Highlight active tab + // Select artwork's color and highlight active tab if( it.key() == m_activeTab ) { p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); + p.setPen( tabArtworkActive() ); + } else + { + p.setPen( tabArtworkInactive() ); } - - // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork ); + + // Draw colorized artwork + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - mask.width() ) / 2, 1, mask ); } else { // Highlight tab when active @@ -272,6 +278,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw text + p.setPen( tabText() ); p.drawText( tab_x_offset + 3, m_tabheight + 1, ( *it ).name ); } @@ -363,3 +370,26 @@ void TabWidget::setTabBorder( const QColor & c ) m_tabBorder = c; } +// Return the color to be used for drawing active artwork tabs +QColor TabWidget::tabArtworkActive() const +{ + return m_tabArtworkActive; +} + +// Set the color to be used for drawing active artwork tabs +void TabWidget::setTabArtworkActive( const QColor & c ) +{ + m_tabArtworkActive = c; +} + +// Return the color to be used for drawing inactive artwork tabs +QColor TabWidget::tabArtworkInactive() const +{ + return m_tabArtworkInactive; +} + +// Set the color to be used for drawing inactive artwork tabs +void TabWidget::setTabArtworkInactive( const QColor & c ) +{ + m_tabArtworkInactive = c; +} From b16a0870962fef66024e70ad88367d62dc3b827c Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 15 Jul 2016 11:57:08 +0200 Subject: [PATCH 29/39] Adapted format to follow LMMS coding conventions --- src/gui/widgets/TabWidget.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 6064cb15d0a..0379b4e1280 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -57,7 +57,7 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap setFont( pointSize<8>( font() ) ); setAutoFillBackground( true ); - QColor bg_color = QApplication::palette().color( QPalette::Active, + QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ). darker( 132 ); QPalette pal = palette(); @@ -160,7 +160,8 @@ bool TabWidget::event(QEvent *event) { // Display tab's tooltip QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].tooltip ); - } else + } + else { // The tooltip event doesn't relate to any tab, let's ignore it QToolTip::hideText(); @@ -245,8 +246,8 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw all tabs - for( widgetStack::iterator it = first ; it != last ; ++it ) - { + for( widgetStack::iterator it = first ; it != last ; ++it ) + { // Draw a text tab or a artwork tab. if ( m_usePixmap ) @@ -259,17 +260,19 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Select artwork's color and highlight active tab if( it.key() == m_activeTab ) - { + { p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); p.setPen( tabArtworkActive() ); - } else + } + else { p.setPen( tabArtworkInactive() ); } // Draw colorized artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - mask.width() ) / 2, 1, mask ); - } else + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - mask.width() ) / 2, 1, mask ); + } + else { // Highlight tab when active if( it.key() == m_activeTab ) From b75c89d27c01727e59643183a70955f021c543f9 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Wed, 27 Jul 2016 10:36:06 +0200 Subject: [PATCH 30/39] Some more blank spaces to tabs translation to comply with LMMS coding standards. --- src/gui/widgets/TabWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 0379b4e1280..7d8f92a8d42 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -186,10 +186,10 @@ void TabWidget::mousePressEvent( QMouseEvent * me ) // When found, activate tab that has been clicked if ( idx != -1 ) - { + { setActiveTab( idx ); - update(); - return; + update(); + return; } } @@ -287,7 +287,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Next tab's horizontal position tab_x_offset += ( *it ).nwidth; - } + } } From 1d57917e02f2db599d065e29a89fa17b75647942 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Tue, 2 Aug 2016 09:54:54 +0200 Subject: [PATCH 31/39] Some more blank spaces to tabs translation to comply with LMMS coding standards. --- src/gui/widgets/TabWidget.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 7d8f92a8d42..29a912a699c 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -57,12 +57,10 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap setFont( pointSize<8>( font() ) ); setAutoFillBackground( true ); - QColor bg_color = QApplication::palette().color( QPalette::Active, - QPalette::Background ). - darker( 132 ); - QPalette pal = palette(); - pal.setColor( QPalette::Background, bg_color ); - setPalette( pal ); + QColor bg_color = QApplication::palette().color( QPalette::Active, QPalette::Background ). darker( 132 ); + QPalette pal = palette(); + pal.setColor( QPalette::Background, bg_color ); + setPalette( pal ); } @@ -74,7 +72,7 @@ void TabWidget::addTab( QWidget * w, const QString & name, const QString & toolt { setFont( pointSize<8>( font() ) ); - // Append tab when position is not given + // Append tab when position is not given if( idx < 0/* || m_widgets.contains( idx ) == true*/ ) { while( m_widgets.contains( ++idx ) == true ) @@ -85,11 +83,11 @@ void TabWidget::addTab( QWidget * w, const QString & name, const QString & toolt // Tab's width when it is a text tab. This isn't correct for artwork tabs, but it's fixed later during the PaintEvent int tab_width = fontMetrics().width( name ) + 10; - // Register new tab + // Register new tab widgetDesc d = { w, activePixmap, inactivePixmap, name, tooltip, tab_width } ; m_widgets[idx] = d; - // Position tab's window + // Position tab's window w->setFixedSize( width() - 4, height() - m_tabbarHeight ); w->move( 2, m_tabbarHeight - 1 ); w->hide(); @@ -129,7 +127,7 @@ int TabWidget::findTabAtPos( const QPoint *pos ) if( pos->y() > 1 && pos->y() < m_tabbarHeight - 1 ) { - int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); + int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { @@ -233,12 +231,12 @@ void TabWidget::paintEvent( QPaintEvent * pe ) p.drawText( 5, 11, m_caption ); } - // Calculate the tabs' x (tabs are painted next to the caption) - int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); + // Calculate the tabs' x (tabs are painted next to the caption) + int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) - widgetStack::iterator first = m_widgets.begin(); - widgetStack::iterator last = m_widgets.end(); + widgetStack::iterator first = m_widgets.begin(); + widgetStack::iterator last = m_widgets.end(); int tab_width = width(); if ( first != last ) { @@ -275,7 +273,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) else { // Highlight tab when active - if( it.key() == m_activeTab ) + if( it.key() == m_activeTab ) { p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, tabSelected() ); } From d280afa0ecf0c2817e7cbd0077f341e9b557014e Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 5 Sep 2016 15:06:34 +0200 Subject: [PATCH 32/39] Revert "TabWidget: Made the artworks' color themeable" This reverts commit 5b162c07e2ee26796b6e9408364eba19142acd71. Conflicts: src/gui/widgets/TabWidget.cpp Reason: Artwork's color themeability had the side-effect that it removed the artworks' alpha channel, thus making them ugly. --- data/themes/default/style.css | 2 -- include/TabWidget.h | 18 ++++-------- src/gui/widgets/TabWidget.cpp | 54 +++++++---------------------------- 3 files changed, 16 insertions(+), 58 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 34eac23ed94..c959f3e0247 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -143,8 +143,6 @@ TabWidget { qproperty-tabSelected: rgb(160, 160, 160); qproperty-tabBackground: rgb(60, 67, 75); qproperty-tabBorder: rgb(60, 67, 75); - qproperty-tabArtworkActive: rgb(255, 255, 255); - qproperty-tabArtworkInactive: rgb(160, 160, 160); } /* main toolbar oscilloscope - can have transparent bg now */ diff --git a/include/TabWidget.h b/include/TabWidget.h index bcac0f50144..9908887b863 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -56,8 +56,6 @@ class TabWidget : public QWidget Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected) Q_PROPERTY( QColor tabBackground READ tabBackground WRITE setTabBackground) Q_PROPERTY( QColor tabBorder READ tabBorder WRITE setTabBorder) - Q_PROPERTY( QColor tabArtworkActive READ tabArtworkActive WRITE setTabArtworkActive) - Q_PROPERTY( QColor tabArtworkInactive READ tabArtworkInactive WRITE setTabArtworkInactive) QColor tabText() const; void setTabText( const QColor & c ); @@ -69,10 +67,6 @@ class TabWidget : public QWidget void setTabBackground( const QColor & c ); QColor tabBorder() const; void setTabBorder( const QColor & c ); - QColor tabArtworkActive() const; - void setTabArtworkActive( const QColor & c ); - QColor tabArtworkInactive() const; - void setTabArtworkInactive( const QColor & c ); protected: virtual bool event( QEvent * event ); @@ -102,13 +96,11 @@ class TabWidget : public QWidget quint8 m_tabheight; // The height of the tabs bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. - QColor m_tabText; // The color of the tabs' text. - QColor m_tabTitleText; // The color of the TabWidget's title text. - QColor m_tabSelected; // The highlighting color for the selected tab. - QColor m_tabBackground; // The TabWidget's background color. - QColor m_tabBorder; // The TabWidget's borders color. - QColor m_tabArtworkActive; // The color for active artwork tabs. - QColor m_tabArtworkInactive; // The color for inactive artwork tabs. + QColor m_tabText; // The color of the tabs' text. + QColor m_tabTitleText; // The color of the TabWidget's title text. + QColor m_tabSelected; // The highlighting color for the selected tab. + QColor m_tabBackground; // The TabWidget's background color. + QColor m_tabBorder; // The TabWidget's borders color. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 29a912a699c..fcbfe3ad630 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -44,9 +43,7 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap m_tabTitleText( 0, 0, 0 ), m_tabSelected( 0, 0, 0 ), m_tabBackground( 0, 0, 0 ), - m_tabBorder( 0, 0, 0 ), - m_tabArtworkActive( 0, 0, 0 ), - m_tabArtworkInactive( 0, 0, 0 ) + m_tabBorder( 0, 0, 0 ) { // Create taller tabbar when it's to display artwork tabs @@ -244,8 +241,9 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw all tabs - for( widgetStack::iterator it = first ; it != last ; ++it ) - { + p.setPen( tabText() ); + for( widgetStack::iterator it = first ; it != last ; ++it ) + { // Draw a text tab or a artwork tab. if ( m_usePixmap ) @@ -253,24 +251,18 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; - // Create a mask out of the tab's artwork (for changing it's color later on) - QBitmap mask = QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ).createMaskFromColor( Qt::black, Qt::MaskOutColor ); + // Get artwork + QPixmap artwork( embed::getIconPixmap( ( *it ).inactivePixmap ) ); - // Select artwork's color and highlight active tab + // Highlight active tab if( it.key() == m_activeTab ) { p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); - p.setPen( tabArtworkActive() ); - } - else - { - p.setPen( tabArtworkInactive() ); } - - // Draw colorized artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - mask.width() ) / 2, 1, mask ); - } - else + + // Draw artwork + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork ); + } else { // Highlight tab when active if( it.key() == m_activeTab ) @@ -279,7 +271,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw text - p.setPen( tabText() ); p.drawText( tab_x_offset + 3, m_tabheight + 1, ( *it ).name ); } @@ -371,26 +362,3 @@ void TabWidget::setTabBorder( const QColor & c ) m_tabBorder = c; } -// Return the color to be used for drawing active artwork tabs -QColor TabWidget::tabArtworkActive() const -{ - return m_tabArtworkActive; -} - -// Set the color to be used for drawing active artwork tabs -void TabWidget::setTabArtworkActive( const QColor & c ) -{ - m_tabArtworkActive = c; -} - -// Return the color to be used for drawing inactive artwork tabs -QColor TabWidget::tabArtworkInactive() const -{ - return m_tabArtworkInactive; -} - -// Set the color to be used for drawing inactive artwork tabs -void TabWidget::setTabArtworkInactive( const QColor & c ) -{ - m_tabArtworkInactive = c; -} From 9b34722b89940edb9a95250805db5774b4630e7c Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 5 Sep 2016 15:58:06 +0200 Subject: [PATCH 33/39] Made GroupBox's background color themeable --- data/themes/default/style.css | 4 ++++ include/GroupBox.h | 2 +- src/gui/widgets/GroupBox.cpp | 37 ++++++++--------------------------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index c959f3e0247..0e459ef854e 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -145,6 +145,10 @@ TabWidget { qproperty-tabBorder: rgb(60, 67, 75); } +GroupBox { + background-color: #5b6571; +} + /* main toolbar oscilloscope - can have transparent bg now */ VisualizationWidget { diff --git a/include/GroupBox.h b/include/GroupBox.h index 6b4a1e98b19..17c742a2064 100644 --- a/include/GroupBox.h +++ b/include/GroupBox.h @@ -57,7 +57,7 @@ class GroupBox : public QWidget, public BoolModelView protected: virtual void mousePressEvent( QMouseEvent * _me ); - virtual void resizeEvent( QResizeEvent * _re ); + virtual void paintEvent( QPaintEvent * _pe ); private: diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 19149f9fc8d..5acbb98fe95 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -41,7 +41,7 @@ GroupBox::GroupBox( const QString & _caption, QWidget * _parent ) : m_caption( _caption ), m_titleBarHeight( 11 ) { - updatePixmap(); + update(); m_led = new PixmapButton( this, _caption ); m_led->setCheckable( true ); @@ -84,43 +84,22 @@ void GroupBox::mousePressEvent( QMouseEvent * _me ) -void GroupBox::resizeEvent( QResizeEvent * _ev ) +void GroupBox::paintEvent( QPaintEvent * pe ) { - updatePixmap(); - QWidget::resizeEvent( _ev ); -} - - - -void GroupBox::updatePixmap() -{ - QColor bg_color = QApplication::palette().color( QPalette::Active, - QPalette::Background ); - QPixmap pm( size() ); - pm.fill( bg_color ); - - QPainter p( &pm ); + QPainter p( this ); + // Draw background + p.fillRect( 0, 0, width() - 1, height() - 1, p.background() ); + // outer rect - p.setPen( bg_color.dark( 150 ) ); + p.setPen( p.background().color().dark( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); // draw line below titlebar - p.fillRect( 1, 1, width() - 2, m_titleBarHeight + 1, bg_color.darker( 150 ) ); + p.fillRect( 1, 1, width() - 2, m_titleBarHeight + 1, p.background().color().darker( 150 ) ); // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); p.setFont( pointSize<8>( font() ) ); p.drawText( 22, m_titleBarHeight, m_caption ); - - QPalette pal = palette(); - pal.setBrush( backgroundRole(), QBrush( pm ) ); - setPalette( pal ); } - - - - - - - From f9f60d4c2365bc90daa42473d98b084e39ba1e47 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Sun, 21 May 2017 17:05:57 +0200 Subject: [PATCH 34/39] Update background color, only use one set of images --- data/themes/default/env_lfo_active.png | Bin 965 -> 0 bytes .../{env_lfo_inactive.png => env_lfo_tab.png} | Bin data/themes/default/functions_active.png | Bin 965 -> 0 bytes ...{functions_inactive.png => functions_tab.png} | Bin data/themes/default/fx_active.png | Bin 1021 -> 0 bytes .../default/{fx_inactive.png => fx_tab.png} | Bin data/themes/default/midi_active.png | Bin 965 -> 0 bytes data/themes/default/midi_inactive.png | Bin 965 -> 0 bytes data/themes/default/midi_tab.png | Bin 0 -> 151 bytes data/themes/default/misc_active.png | Bin 965 -> 0 bytes .../default/{misc_inactive.png => misc_tab.png} | Bin data/themes/default/plugin_active.png | Bin 965 -> 0 bytes .../{plugin_inactive.png => plugin_tab.png} | Bin data/themes/default/style.css | 4 ++-- include/TabWidget.h | 5 ++--- src/gui/widgets/TabWidget.cpp | 15 ++++++++------- src/tracks/InstrumentTrack.cpp | 12 ++++++------ 17 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 data/themes/default/env_lfo_active.png rename data/themes/default/{env_lfo_inactive.png => env_lfo_tab.png} (100%) delete mode 100644 data/themes/default/functions_active.png rename data/themes/default/{functions_inactive.png => functions_tab.png} (100%) delete mode 100644 data/themes/default/fx_active.png rename data/themes/default/{fx_inactive.png => fx_tab.png} (100%) delete mode 100644 data/themes/default/midi_active.png delete mode 100644 data/themes/default/midi_inactive.png create mode 100644 data/themes/default/midi_tab.png delete mode 100644 data/themes/default/misc_active.png rename data/themes/default/{misc_inactive.png => misc_tab.png} (100%) delete mode 100644 data/themes/default/plugin_active.png rename data/themes/default/{plugin_inactive.png => plugin_tab.png} (100%) diff --git a/data/themes/default/env_lfo_active.png b/data/themes/default/env_lfo_active.png deleted file mode 100644 index ecdf058229823a1bb71fb88d8c4eaaa7d5c1b2e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsNs^aIDe1gd5>QAsGbEzKIX^cyHLnE7WngeFN=+>w!R!jf@ diff --git a/data/themes/default/env_lfo_inactive.png b/data/themes/default/env_lfo_tab.png similarity index 100% rename from data/themes/default/env_lfo_inactive.png rename to data/themes/default/env_lfo_tab.png diff --git a/data/themes/default/functions_active.png b/data/themes/default/functions_active.png deleted file mode 100644 index 04d069db5c825678da9c4a3ec3738c24cdc56682..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8aSYKAWt3xn_y??z+QfgLfgp?(Fd>P`0NGoBSPV%F z#uNuKwgRynOaPhQ2;_ilxD3RLp==Nz#0H6h*gJq21At70DF7)#$G3rEAXk9_vQu9I zML_Wb0w5(bIe8!(U7i8iMkKWi|ByJyY$Rb+=5inx zWcp?xmI7jFAO?jdNNgDpV+Di)2NZA;*mM#T9k75x(T|=0U;zSBgf{`8m;&S=YebhL YpKt18ClWdNML5U=Pgg&ebxsLQ0JSn^(*OVf diff --git a/data/themes/default/functions_inactive.png b/data/themes/default/functions_tab.png similarity index 100% rename from data/themes/default/functions_inactive.png rename to data/themes/default/functions_tab.png diff --git a/data/themes/default/fx_active.png b/data/themes/default/fx_active.png deleted file mode 100644 index 51dd5bfc920b520502d5edf40beb3ed35e7f0b08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1021 zcmeAS@N?(olHy`uVBq!ia0vp^{6Ngd!3HEhbh*6;Qfx`y?k)`fL2$v|<&%LToCO|{ z#Xud`L734=V|E2lkiEpy*OmPNlNhHq&r;KbGe9BP%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6_|fq^;E)5S4FLzFR$dF3ClLTV8Iu^56^j0uYdqJ?0ZVK%^M zTn518!8A-WF2#7oX{H&)iP)S#6`L8MCc|iK7JI0Unfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfmzej#W6%flu?fP;UBOzA7Gh+CNMREL zDqv&+t0IFK)rcq1Pyz=Q1uz<<55|VkFtboJ!UTz-hmb~Myn|KEqgCuGGqoNTfFwO# L{an^LB{Ts5pNTQE diff --git a/data/themes/default/midi_inactive.png b/data/themes/default/midi_inactive.png deleted file mode 100644 index d4dde1fba7b869c5977a42d423f4cca1d544afd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8E{F*d1JgLf z7@5GbWDuho@dO%5;J~5)MuYUh*f1Jq7K%ogATjh1(nySVu&TK{S&ZlFW!qICNl#Zl Jmvv4FO#nDpK;HlW diff --git a/data/themes/default/midi_tab.png b/data/themes/default/midi_tab.png new file mode 100644 index 0000000000000000000000000000000000000000..63c0f9385e55e3165cc42cee2f261bae8d5d490c GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy852&8O)78&qol`;+0FZtv9RL6T literal 0 HcmV?d00001 diff --git a/data/themes/default/misc_active.png b/data/themes/default/misc_active.png deleted file mode 100644 index 56af84757b170a9f533bc6d4c3e061144b4dfbb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8aSYKAWt3xn_y??z+QfgLfgp?(FkuxXLU0IaWQ2ML rXCUD4E+g4~#9<&$GmocSM#50k?t#=wN6kR&Dx z9@WS;VJO4q91KNR1Q^M7D$GWhp?IAKR0LO#&qk0UxI&o8FdCmmn3|zZ@2qDP+&1&m Q43IxOUHx3vIVCg!01M$Sod5s; diff --git a/data/themes/default/plugin_inactive.png b/data/themes/default/plugin_tab.png similarity index 100% rename from data/themes/default/plugin_inactive.png rename to data/themes/default/plugin_tab.png diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 0e459ef854e..b6caba43e6f 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -137,7 +137,7 @@ PianoRoll { } TabWidget { - background-color: #5b6571; + background-color: #262b30; qproperty-tabText: rgb(32, 48, 64); qproperty-tabTitleText: rgb(255, 255, 255); qproperty-tabSelected: rgb(160, 160, 160); @@ -146,7 +146,7 @@ TabWidget { } GroupBox { - background-color: #5b6571; + background-color: #262b30; } /* main toolbar oscilloscope - can have transparent bg now */ diff --git a/include/TabWidget.h b/include/TabWidget.h index 9908887b863..4ec262ded18 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -39,7 +39,7 @@ class TabWidget : public QWidget TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false ); virtual ~TabWidget(); - void addTab( QWidget *_w, const QString &_name, const QString &_tooltip = NULL, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 ); + void addTab( QWidget *_w, const QString &_name, const QString &_tooltip = NULL, const char *Pixmap = NULL, int _idx = -1 ); void setActiveTab( int _idx ); @@ -80,8 +80,7 @@ class TabWidget : public QWidget struct widgetDesc { QWidget * w; // ptr to widget - const char *activePixmap; // artwork for the widget - const char *inactivePixmap; // artwork for the widget + const char *Pixmap; // artwork for the widget QString name; // name for widget QString tooltip; // name for widget int nwidth; // width of name when painting (only valid for text tab) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index fcbfe3ad630..393ad5d5501 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -61,11 +61,13 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap } + TabWidget::~TabWidget() { } -void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *activePixmap, const char *inactivePixmap, int idx ) + +void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *Pixmap, int idx ) { setFont( pointSize<8>( font() ) ); @@ -81,7 +83,7 @@ void TabWidget::addTab( QWidget * w, const QString & name, const QString & toolt int tab_width = fontMetrics().width( name ) + 10; // Register new tab - widgetDesc d = { w, activePixmap, inactivePixmap, name, tooltip, tab_width } ; + widgetDesc d = { w, Pixmap, name, tooltip, tab_width }; m_widgets[idx] = d; // Position tab's window @@ -167,7 +169,7 @@ bool TabWidget::event(QEvent *event) } // not a Tooltip event, let's propagate it to the other event handlers - return QWidget::event(event); + return QWidget::event(event); } @@ -179,7 +181,7 @@ void TabWidget::mousePressEvent( QMouseEvent * me ) QPoint pos = me->pos(); int idx = findTabAtPos( &pos ); - // When found, activate tab that has been clicked + // When found, activate tab that has been clicked if ( idx != -1 ) { setActiveTab( idx ); @@ -247,12 +249,12 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Draw a text tab or a artwork tab. if ( m_usePixmap ) - { + { // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; // Get artwork - QPixmap artwork( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + QPixmap artwork( embed::getIconPixmap( ( *it ).Pixmap ) ); // Highlight active tab if( it.key() == m_activeTab ) @@ -361,4 +363,3 @@ void TabWidget::setTabBorder( const QColor & c ) { m_tabBorder = c; } - diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 9a4deda5e9c..ab8ee4d7c81 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1439,11 +1439,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); - m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), tr( "FUNC" ), "functions_active", "functions_inactive", 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), tr( "FX" ), "fx_active", "fx_inactive", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), tr( "MIDI" ), "midi_active", "midi_inactive", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), tr( "MISC" ), "misc_active", "misc_inactive", 5 ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), tr( "ENV/LFO" ), "env_lfo_tab", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), tr( "FUNC" ), "functions_tab", 2 ); + m_tabWidget->addTab( m_effectView, tr( "FX" ), tr( "FX" ), "fx_tab", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI" ), tr( "MIDI" ), "midi_tab", 4 ); + m_tabWidget->addTab( m_miscView, tr( "MISC" ), tr( "MISC" ), "misc_tab", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), tr( "PLUGIN" ), "plugin_tab", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From 217a39bf75324cb128ca0d73c987c5e1bd51ec85 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Sun, 21 May 2017 17:39:27 +0200 Subject: [PATCH 35/39] Use name as tooltip, more descriptive names --- include/TabWidget.h | 7 +++---- src/gui/widgets/TabWidget.cpp | 8 ++++---- src/tracks/InstrumentTrack.cpp | 14 +++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 4ec262ded18..20aa03ddf33 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -39,9 +39,9 @@ class TabWidget : public QWidget TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false ); virtual ~TabWidget(); - void addTab( QWidget *_w, const QString &_name, const QString &_tooltip = NULL, const char *Pixmap = NULL, int _idx = -1 ); + void addTab( QWidget * w, const QString & name, const char *pixmap = NULL, int idx = -1 ); - void setActiveTab( int _idx ); + void setActiveTab( int idx ); int findTabAtPos( const QPoint *pos ); @@ -80,9 +80,8 @@ class TabWidget : public QWidget struct widgetDesc { QWidget * w; // ptr to widget - const char *Pixmap; // artwork for the widget + const char *pixmap; // artwork for the widget QString name; // name for widget - QString tooltip; // name for widget int nwidth; // width of name when painting (only valid for text tab) } ; typedef QMap widgetStack; diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 393ad5d5501..6226d5ad8e2 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -67,7 +67,7 @@ TabWidget::~TabWidget() } -void TabWidget::addTab( QWidget * w, const QString & name, const QString & tooltip, const char *Pixmap, int idx ) +void TabWidget::addTab( QWidget * w, const QString & name, const char *pixmap, int idx ) { setFont( pointSize<8>( font() ) ); @@ -83,7 +83,7 @@ void TabWidget::addTab( QWidget * w, const QString & name, const QString & toolt int tab_width = fontMetrics().width( name ) + 10; // Register new tab - widgetDesc d = { w, Pixmap, name, tooltip, tab_width }; + widgetDesc d = { w, pixmap, name, tab_width }; m_widgets[idx] = d; // Position tab's window @@ -156,7 +156,7 @@ bool TabWidget::event(QEvent *event) if ( idx != -1 ) { // Display tab's tooltip - QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].tooltip ); + QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].name ); } else { @@ -254,7 +254,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) ( *it ).nwidth = tab_width; // Get artwork - QPixmap artwork( embed::getIconPixmap( ( *it ).Pixmap ) ); + QPixmap artwork( embed::getIconPixmap( ( *it ).pixmap ) ); // Highlight active tab if( it.key() == m_activeTab ) diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index ab8ee4d7c81..6387d485b8e 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1411,7 +1411,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : generalSettingsLayout->addLayout( basicControlsLayout ); - m_tabWidget = new TabWidget( "", this, true ); + m_tabWidget = new TabWidget( "", this, true ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 6 ); @@ -1439,11 +1439,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); - m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), tr( "ENV/LFO" ), "env_lfo_tab", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), tr( "FUNC" ), "functions_tab", 2 ); - m_tabWidget->addTab( m_effectView, tr( "FX" ), tr( "FX" ), "fx_tab", 3 ); - m_tabWidget->addTab( m_midiView, tr( "MIDI" ), tr( "MIDI" ), "midi_tab", 4 ); - m_tabWidget->addTab( m_miscView, tr( "MISC" ), tr( "MISC" ), "misc_tab", 5 ); + m_tabWidget->addTab( m_ssView, tr( "Envelope, filter & LFO" ), "env_lfo_tab", 1 ); + m_tabWidget->addTab( instrumentFunctions, tr( "Chord stacking & arpeggio" ), "functions_tab", 2 ); + m_tabWidget->addTab( m_effectView, tr( "Effects" ), "fx_tab", 3 ); + m_tabWidget->addTab( m_midiView, tr( "MIDI settings" ), "midi_tab", 4 ); + m_tabWidget->addTab( m_miscView, tr( "Miscellaneous" ), "misc_tab", 5 ); // setup piano-widget m_pianoView = new PianoView( this ); @@ -1617,7 +1617,7 @@ void InstrumentTrackWindow::updateInstrumentView() if( m_track->m_instrument != NULL ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), tr( "PLUGIN" ), "plugin_tab", 0 ); + m_tabWidget->addTab( m_instrumentView, tr( "Plugin" ), "plugin_tab", 0 ); m_tabWidget->setActiveTab( 0 ); m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) ); From cbf14df241066562de21d82421c7fdc1ff4cd5e5 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Sun, 21 May 2017 23:33:53 +0200 Subject: [PATCH 36/39] Update icons and colors --- data/themes/default/env_lfo_tab.png | Bin 965 -> 255 bytes data/themes/default/func_tab.png | Bin 0 -> 178 bytes data/themes/default/functions_tab.png | Bin 965 -> 0 bytes data/themes/default/fx_tab.png | Bin 1021 -> 292 bytes data/themes/default/midi_tab.png | Bin 151 -> 306 bytes data/themes/default/misc_tab.png | Bin 965 -> 188 bytes data/themes/default/plugin_tab.png | Bin 965 -> 231 bytes data/themes/default/style.css | 10 +++++----- include/GroupBox.h | 2 +- src/tracks/InstrumentTrack.cpp | 4 ++-- 10 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 data/themes/default/func_tab.png delete mode 100644 data/themes/default/functions_tab.png diff --git a/data/themes/default/env_lfo_tab.png b/data/themes/default/env_lfo_tab.png index c761087f4832c9615ea6b1975e235938f1c6af32..8916ea44a1af88f64c10fa6052ac9ae3dfa43e6e 100644 GIT binary patch delta 227 zcmX@g{-1GzN<>&pIsNs^aI$VIH`98gF$GbEzKIX^cyHLnE7WngeFN=+~}U&Kt=kVE{-7@ z6O$7bm?s=j|M~y_|Md~3hDJrk7mwL)VUVah@?1aVU%+SOjsKk3oKN&KOyuF=+NYaa Q1=Pym>FVdQ&MBb@02<3RHUIzs literal 0 HcmV?d00001 diff --git a/data/themes/default/functions_tab.png b/data/themes/default/functions_tab.png deleted file mode 100644 index 80ec4e5a8cfb77ede85b9137710889f8d0f4e7bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8ub#+N`rQ2c~}U&Kt&5ZT^vI+ zCLW!1miLeWPwW163o$W=r#%m5#0m(dTM64MZ}8ggpu@o2;w)RRIP4*de^<)>Bj>88 zJ=E`DHrThdL^kC$HP(j&)CT3XaS zz4)$avGXH!*8asWL{A;O*xSwje!FLu))}3Unl|MGPxCqMp0DI)Fo#=-4$FsjQz7oWC+Q^f*%5znScCwpGf}@Fas_?3w*+9 zfHN>HnO4A?vU*^dBSq5=I2ePiUyr=XV>`XCkJGbNA~2&k<2uOS}z`Qe7>vvefjYp>=>yhl}{T1!D`$vl##n)R}$_ dxQu1IzUy@lp%AemnrQ$4002ovPDHLkV1gd)a1j6i delta 102 zcmdnQG@WsR3O`$tx4R3&e-K=-clqRrh7vyPC7!;n>gTe~ HDWM4fBbPJr literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8Unfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfmzej#W6%flu?fP;UBO^jU$mO!g3)}l?SBD)78&qol`;+0Dl`i`2YX_ diff --git a/data/themes/default/plugin_tab.png b/data/themes/default/plugin_tab.png index 8e772e08dc625686a496950e22fb891c5d42818f..edea76b1928b3a3f6904c4d87a735c73cf7657d5 100644 GIT binary patch delta 203 zcmX@g{+w}wNTj88`i_a#3&G#9#44AF`y00*6H@b)wc3hH8OFP>7d~M?;BNfk$*HiUl zPoMb|sJhacyWe=9)%*7mm);lbWD?%6^vHQjhKX@amR`B+>wy+Bc)I$ztaD0e0sy%l BOeX*U literal 965 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8YGO%h zib8p2Nrr;Er*A-tUMf2S1GA>5i(`m}D5D(n!#`k!LxW&McIJN|fbkiD0K~>71`=li z5##_CT$+$=!lnkpIoK4Ti-EjBwo`Ei4!SKMJ}kgMY@9ZN6oCLp5jKERBR0iDRBXMs Vh{)a}`As0_d%F6$taD0e0sywWKNtW2 diff --git a/data/themes/default/style.css b/data/themes/default/style.css index b6caba43e6f..a4fd6abd92a 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -138,11 +138,11 @@ PianoRoll { TabWidget { background-color: #262b30; - qproperty-tabText: rgb(32, 48, 64); - qproperty-tabTitleText: rgb(255, 255, 255); - qproperty-tabSelected: rgb(160, 160, 160); - qproperty-tabBackground: rgb(60, 67, 75); - qproperty-tabBorder: rgb(60, 67, 75); + qproperty-tabText: rgba(255, 255, 255, 180); + qproperty-tabTitleText: #fff; + qproperty-tabSelected: #323940; + qproperty-tabBackground: #181b1f; + qproperty-tabBorder: #181b1f; } GroupBox { diff --git a/include/GroupBox.h b/include/GroupBox.h index 17c742a2064..39d9a522a6f 100644 --- a/include/GroupBox.h +++ b/include/GroupBox.h @@ -57,7 +57,7 @@ class GroupBox : public QWidget, public BoolModelView protected: virtual void mousePressEvent( QMouseEvent * _me ); - virtual void paintEvent( QPaintEvent * _pe ); + virtual void paintEvent( QPaintEvent * _pe ); private: diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 6387d485b8e..adb19122123 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -80,7 +80,7 @@ const char * volume_help = QT_TRANSLATE_NOOP( "InstrumentTrack", "the volume of the opened " "channel."); -const int INSTRUMENT_WIDTH = 256; +const int INSTRUMENT_WIDTH = 254; const int INSTRUMENT_HEIGHT = INSTRUMENT_WIDTH; const int PIANO_HEIGHT = 80; const int INSTRUMENT_WINDOW_CACHE_SIZE = 8; @@ -1440,7 +1440,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget->addTab( m_ssView, tr( "Envelope, filter & LFO" ), "env_lfo_tab", 1 ); - m_tabWidget->addTab( instrumentFunctions, tr( "Chord stacking & arpeggio" ), "functions_tab", 2 ); + m_tabWidget->addTab( instrumentFunctions, tr( "Chord stacking & arpeggio" ), "func_tab", 2 ); m_tabWidget->addTab( m_effectView, tr( "Effects" ), "fx_tab", 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI settings" ), "midi_tab", 4 ); m_tabWidget->addTab( m_miscView, tr( "Miscellaneous" ), "misc_tab", 5 ); From b3b25860ac921ed3f5dec180160b846f3ae72f7f Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Wed, 24 May 2017 14:29:41 +0200 Subject: [PATCH 37/39] more things --- data/themes/default/func_tab.png | Bin 178 -> 179 bytes data/themes/default/midi_tab.png | Bin 306 -> 170 bytes data/themes/default/plugin_tab.png | Bin 231 -> 210 bytes src/gui/widgets/TabWidget.cpp | 2 +- src/tracks/InstrumentTrack.cpp | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/themes/default/func_tab.png b/data/themes/default/func_tab.png index 3dfab2fb506497f8c50d8114fa0cc9e86abe4141..8776571cd21de849fb239deaf33ed4cfacc65505 100644 GIT binary patch delta 76 zcmdnQxS4T6o~wbUi(`n!#N>np<_SksKmPy!fBg>=qrm&RTbMNJRG#R&xw+*@RBQa4 gC{nN3toX#8VeT~UKgl01u4e!OPgg&ebxsLQ0O0x`ivR!s delta 75 zcmdnYxQTH>o{PSxi(`n!#N>np<_SmCfBygfe|?0hp;3|X#bdTx7$oYBJl9Y87w}nm f<3A@h=M()56M1;J_UYzUF#v(5tDnm{r-UW|&CMR0 diff --git a/data/themes/default/midi_tab.png b/data/themes/default/midi_tab.png index 4ddbd9bdfb7be38babf532f7ff9f0e7da575d1dd..6a006f6b1f3f64fe33e2aa811db64355529e9cf8 100644 GIT binary patch delta 67 zcmdnQw2E;;o{hSvi(`n!#N>npEPvXWf{x5Mu{9?|d81UKW3LSFjUy}4A3wO}VaC8< X!KeOy(l+Lm3_#%N>gTe~DWM4fg=-nT delta 204 zcmV;-05kup0kQ&+Zhx;yL_t(2k*$z13IZ_@MZd|SwU&AV8^KaN%r;`9*U_7J0gK%g zTs(~Zvq@wK$-;sk0-2fod7nuC5HJHSKnr}rX@D~@Etyupo3eUfnIlEh4mcQttzVJs zg7+k86YfsZ#O$^8R?^WDyMc(Q8cC{xcP(ijwm%Ag7w2~y)kS9_riyd->j2LYQCmyA z4Uke@EwQrH^rfM7fKP{u_`3yT3(T__01woeehs*cWxT%Ybq}GjBARIc0000b44iGz)G!S}3}ovyxpsTG=H&p#Wr0xIWy#p?3fP N002ovPDHLkV1f`GCi(yX delta 128 zcmV-`0Du3|0p|gbZh2%$L_t(2k;Re034lNh1haC!uT$+tThdmvi18DB1i_0S&MSmW zvJkW10V*&9J5Gz#11o_Rafs3#W@g2O=dFR#G9*c{*JUqV%gpjoC8;|Lk2AhH@9$XB i?{K*S6R@Sk&p7~*UV=GFZ3nLa0000setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 6 ); + m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 4 ); // create tab-widgets From 6aa15a41d46c26424cec1ef967974f9dae3916e2 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Tue, 30 May 2017 18:41:25 +0200 Subject: [PATCH 38/39] formatting fixes --- include/TabWidget.h | 28 ++++++++++++++-------------- src/gui/widgets/TabWidget.cpp | 30 ++++++++++++++++-------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/include/TabWidget.h b/include/TabWidget.h index 20aa03ddf33..402d7c9cc2f 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -79,26 +79,26 @@ class TabWidget : public QWidget private: struct widgetDesc { - QWidget * w; // ptr to widget - const char *pixmap; // artwork for the widget - QString name; // name for widget - int nwidth; // width of name when painting (only valid for text tab) + QWidget * w; // ptr to widget + const char * pixmap; // artwork for the widget + QString name; // name for widget + int nwidth; // width of name when painting (only valid for text tab) } ; typedef QMap widgetStack; widgetStack m_widgets; int m_activeTab; - QString m_caption; - quint8 m_tabbarHeight; // The height of the tab bar - quint8 m_tabheight; // The height of the tabs - bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. - - QColor m_tabText; // The color of the tabs' text. - QColor m_tabTitleText; // The color of the TabWidget's title text. - QColor m_tabSelected; // The highlighting color for the selected tab. - QColor m_tabBackground; // The TabWidget's background color. - QColor m_tabBorder; // The TabWidget's borders color. + QString m_caption; // Tab caption, used as the tooltip text on icon tabs + quint8 m_tabbarHeight; // The height of the tab bar + quint8 m_tabheight; // The height of the tabs + bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs. + + QColor m_tabText; // The color of the tabs' text. + QColor m_tabTitleText; // The color of the TabWidget's title text. + QColor m_tabSelected; // The highlighting color for the selected tab. + QColor m_tabBackground; // The TabWidget's background color. + QColor m_tabBorder; // The TabWidget's borders color. } ; #endif diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 0b2a77cdb10..6fde217c1d3 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -2,7 +2,7 @@ * TabWidget.cpp - tabwidget for LMMS * * Copyright (c) 2005-2014 Tobias Doerffel - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -244,11 +244,10 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Draw all tabs p.setPen( tabText() ); - for( widgetStack::iterator it = first ; it != last ; ++it ) - { - + for( widgetStack::iterator it = first ; it != last ; ++it ) + { // Draw a text tab or a artwork tab. - if ( m_usePixmap ) + if( m_usePixmap ) { // Fixes tab's width, because original size is only correct for text tabs ( *it ).nwidth = tab_width; @@ -263,12 +262,13 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork ); - } else + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork ); + } + else { // Highlight tab when active if( it.key() == m_activeTab ) - { + { p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, tabSelected() ); } @@ -287,8 +287,10 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Switch between tabs with mouse wheel void TabWidget::wheelEvent( QWheelEvent * we ) { - if (we->y() > m_tabheight) + if( we->y() > m_tabheight ) + { return; + } we->accept(); int dir = ( we->delta() < 0 ) ? 1 : -1; @@ -311,7 +313,7 @@ QColor TabWidget::tabTitleText() const } // Set the color to be used to draw a TabWidget's title text (if any) -void TabWidget::setTabTitleText( const QColor & c ) +void TabWidget::setTabTitleText( const QColor & c ) { m_tabTitleText = c; } @@ -323,7 +325,7 @@ QColor TabWidget::tabText() const } // Set the color to be used to draw a TabWidget's text (if any) -void TabWidget::setTabText( const QColor & c ) +void TabWidget::setTabText( const QColor & c ) { m_tabText = c; } @@ -335,7 +337,7 @@ QColor TabWidget::tabSelected() const } // Set the color to be used to highlight a TabWidget'selected tab (if any) -void TabWidget::setTabSelected( const QColor & c ) +void TabWidget::setTabSelected( const QColor & c ) { m_tabSelected = c; } @@ -347,7 +349,7 @@ QColor TabWidget::tabBackground() const } // Set the color to be used for the TabWidget's background -void TabWidget::setTabBackground( const QColor & c ) +void TabWidget::setTabBackground( const QColor & c ) { m_tabBackground = c; } @@ -359,7 +361,7 @@ QColor TabWidget::tabBorder() const } // Set the color to be used for the TabWidget's borders -void TabWidget::setTabBorder( const QColor & c ) +void TabWidget::setTabBorder( const QColor & c ) { m_tabBorder = c; } From 8706d5271a2863b69edc4be298f5f04c0233ab39 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Wed, 31 May 2017 13:34:42 +0200 Subject: [PATCH 39/39] Remove update() from constructor --- src/gui/widgets/GroupBox.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 5acbb98fe95..158390bb5b5 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -41,8 +41,6 @@ GroupBox::GroupBox( const QString & _caption, QWidget * _parent ) : m_caption( _caption ), m_titleBarHeight( 11 ) { - update(); - m_led = new PixmapButton( this, _caption ); m_led->setCheckable( true ); m_led->move( 3, 0 ); @@ -88,9 +86,9 @@ void GroupBox::paintEvent( QPaintEvent * pe ) { QPainter p( this ); - // Draw background - p.fillRect( 0, 0, width() - 1, height() - 1, p.background() ); - + // Draw background + p.fillRect( 0, 0, width() - 1, height() - 1, p.background() ); + // outer rect p.setPen( p.background().color().dark( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 );