From f1950b30077cd74f87918f4c9c487aee250fa555 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 8 Dec 2008 01:28:04 +0000 Subject: [PATCH] added initial draft of FLUIQ (Flexible User-Interface with Qt) framework (integration patches will follow later) git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1878 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 91 ++++-- data/themes/default/fluiq/arrow-down.png | Bin 0 -> 282 bytes data/themes/default/fluiq/arrow-right.png | Bin 0 -> 295 bytes include/fluiq/collapsible_widget.h | 127 ++++++++ include/fluiq/splitter.h | 64 ++++ include/fluiq/widget.h | 49 ++++ include/fluiq/widget_container.h | 62 ++++ include/fluiq/workspace.h | 58 ++++ src/gui/fluiq/collapsible_widget.cpp | 343 ++++++++++++++++++++++ src/gui/fluiq/splitter.cpp | 98 +++++++ src/gui/fluiq/widget.cpp | 48 +++ src/gui/fluiq/widget_container.cpp | 73 +++++ src/gui/fluiq/workspace.cpp | 73 +++++ 13 files changed, 1056 insertions(+), 30 deletions(-) create mode 100644 data/themes/default/fluiq/arrow-down.png create mode 100644 data/themes/default/fluiq/arrow-right.png create mode 100644 include/fluiq/collapsible_widget.h create mode 100644 include/fluiq/splitter.h create mode 100644 include/fluiq/widget.h create mode 100644 include/fluiq/widget_container.h create mode 100644 include/fluiq/workspace.h create mode 100644 src/gui/fluiq/collapsible_widget.cpp create mode 100644 src/gui/fluiq/splitter.cpp create mode 100644 src/gui/fluiq/widget.cpp create mode 100644 src/gui/fluiq/widget_container.cpp create mode 100644 src/gui/fluiq/workspace.cpp diff --git a/ChangeLog b/ChangeLog index 261550cf2..1277017a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,45 @@ +2008-12-08 Tobias Doerffel + + * include/fluiq/collapsible_widget.h: + * include/fluiq/splitter.h: + * include/fluiq/widget.h: + * include/fluiq/widget_container.h: + * include/fluiq/workspace.h: + * src/gui/fluiq/collapsible_widget.cpp: + * src/gui/fluiq/splitter.cpp: + * src/gui/fluiq/widget.cpp: + * src/gui/fluiq/widget_container.cpp: + * src/gui/fluiq/workspace.cpp: + * data/themes/default/fluiq/arrow-down.png: + * data/themes/default/fluiq/arrow-right.png: + * CMakeLists.txt: + added initial draft of FLUIQ (Flexible User-Interface with Qt) + framework (integration patches will follow later) + 2008-12-07 Andrew Kelley - + * src/gui/piano_roll.cpp: (hopefully) fixed bug where shift+drag wasn't copying notes - + * src/core/timeline.cpp: * include/song_editor.h: * src/gui/song_editor.cpp: - auto-scroll default to disabled - fixed glitch where it would auto-scroll even if it was off in song-editor + - auto-scroll default to disabled + - fixed glitch where it would auto-scroll even if it was off in + song-editor * src/gui/main_window.cpp: worked on global playback/record options in the toolbar. This code is still commented out though. - 2008-12-05 Andrew Kelley - + * include/piano_roll.h: * src/core/piano_roll.cpp: - don't play notes when you click on one if the song is already playing - now you can move and resize unquantized notes in quantized amounts - shift+drag to copy one or more notes (we need to figure out some other - way to implement note detuning) + way to implement note detuning) - removed stagnant note movement code - dragging a group of notes to boundary conditions is handled correctly - ability to scroll using arrow keys while dragging notes @@ -71,7 +89,7 @@ per default play sub-octaves of first oscillator in osc 2 and 3 2008-11-29 Andrew Kelley - + * include/piano_roll.h: * src/gui/piano_roll.cpp: - when you draw a note it clears the selection and selects the new note @@ -1283,7 +1301,7 @@ Add support for pitch bend * src/tracks/instrument_track.cpp: - * include/instrument_track.h: + * include/instrument_track.h: - Correctly update instrumentTrackView when changing the instrument plugin - Add bendable property to hide pitchBend knob for Vibed @@ -3167,7 +3185,7 @@ added rudimentary WinMM MIDI support * src/core/mmp.cpp: - * plugins/lb302/lb302.h + * plugins/lb302/lb302.h: * plugins/CMakeLists.txt: switched back to LB302 as Paul wants LB303 for 0.4.1 @@ -8439,6 +8457,7 @@ made MIDI- and FLP-import-filter work 2008-02-15 Paul Giblock + * plugins/plucked_string_synth/plucked_string_synth.cpp: * plugins/plucked_string_synth/plucked_string_synth.h: * plugins/organic/organic.cpp: @@ -9614,8 +9633,8 @@ * plugins/ladspa_effect/ladspa_effect.h: * plugins/bass_booster/bass_booster.h: - * plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp - * plugins/stereo_enhancer/stereoenhancer_control_dialog.h + * plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp: + * plugins/stereo_enhancer/stereoenhancer_control_dialog.h: * include/main_window.h: * include/instrument_track.h: * include/track_container.h: @@ -10346,7 +10365,7 @@ * data/samples/drums/rim01.ogg: * data/samples/drums/ride02.ogg: * data/samples/drums/nasty_rim01.ogg: - * data/samples/drums/hihat_opened03.ogg + * data/samples/drums/hihat_opened03.ogg: * data/samples/misc/applause01.ogg: added samples @@ -11113,7 +11132,7 @@ - display label text * include/audio_device.h: - * include/audio_dummy.h + * include/audio_dummy.h: * include/midi_client.h: * include/midi_dummy.h: hide empty settings box @@ -11407,7 +11426,7 @@ * plugins/audio_file_processor/audio_file_processor.cpp: * plugins/bass_booster/bass_booster.cpp: * plugins/bass_booster/bass_booster.h: - * plugins/bass_booster/bassbooster_control_dialog.cpp + * plugins/bass_booster/bassbooster_control_dialog.cpp: * plugins/bit_invader/bit_invader.cpp: * plugins/bit_invader/graph.cpp: * plugins/bit_invader/graph.h: @@ -11751,7 +11770,7 @@ * include/audio_oss.h: * include/audio_sdl.h: * include/midi_alsa_raw.h: - * include/midi_alsa_seq.h + * include/midi_alsa_seq.h: * include/midi_client.h: * include/midi_dummy.h: * include/midi_oss.h: @@ -12651,6 +12670,7 @@ fixed single source compilation 2006-09-08 Danny McRae + * configure.in: fixed check for STK headers and library @@ -12730,6 +12750,7 @@ Qt4-compat fixes 2006-08-30 Danny McRae + * src/widgets/ladspa_control.cpp: added a lock to prevent segfaults when changing the values while playing @@ -12908,6 +12929,7 @@ updated Dutch translation 2006-08-16 Danny McRae + * src/widgets/tempo_sync_knob.cpp: changed context menu to only display possible note length options based on the knob's max value @@ -12964,6 +12986,7 @@ connetions are not saved!) 2006-08-15 Danny McRae + * src/widgets/ladspa_control.cpp: doubled the number of steps in the knobs @@ -13006,6 +13029,7 @@ removed 2006-08-14 Danny McRae + * Makefile.am: * include/ladspa_effect.h: * src/core/ladspa_effect.cpp: @@ -13039,7 +13063,7 @@ - getAudioPort() is required - removed slots, moved playing to samplePlayHandle - * include/sample_play_handle.h. + * include/sample_play_handle.h: * src/core/sample_play_handle.cpp: - became a QObject - create handle from sampleTCO @@ -13075,6 +13099,7 @@ added minQ "constant" 2006-08-10 Danny McRae + * src/widgets/ladspa_control.cpp: unfixed my misunderstood fix of the setting of sample rate dependent ports @@ -13126,6 +13151,7 @@ added disabled track artwork 2006-08-10 Danny McRae + * include/effect.h: * include/effect_chain.h: * include/effect_label.h: @@ -13164,6 +13190,7 @@ do about it--just thought it should be noted somewhere. 2006-08-09 Danny McRae + * Makefile.am: * include/effect_label.h: * include/effect_tab_widget.h: @@ -13192,6 +13219,7 @@ something I forgot to #ifdef LADSPA_SUPPORT out. 2006-08-08 Danny McRae + * include/effect.h: * include/effect_chain.h: * include/effect_tab_widget.h: @@ -13217,6 +13245,7 @@ sound like with effects 2006-08-07 Danny McRae + * include/oscillator.h: * plugins/vibed/vibrating_string.h: * plugins/vibed/vibrating_string.cpp: @@ -14007,7 +14036,7 @@ fixed integer-overflow * include/oscillator.h: - * include/sample_buffer.h: + * include/sample_buffer.h: * plugins/organic/organic.cpp: * plugins/triple_oscillator/triple_oscillator.cpp: * src/core/envelope_and_lfo_widget.cpp: @@ -14091,13 +14120,14 @@ some small optimizations in vibed::playNote( ... ) 2006-04-16 Danny McRae + * Makefile.am: * src/lmms_single_source.cpp: * include/knob.h: * include/instrument_track.h: * src/tracks/instrument_track.cpp: - *+src/include/volume_knob.h: - *+src/widgets/volume_knob.cpp: + * src/include/volume_knob.h: + * src/widgets/volume_knob.cpp: * include/setup_dialog.h: * src/core/setup_dialog.cpp: * include/sample_track.h: @@ -14125,11 +14155,12 @@ the maximum number of channels that could be defined. 2006-04-15 Danny McRae + * include/mixer.h: * src/core/mixer.cpp: * src/core/song_editor.cpp: - *+data/themes/default/auto_limit.png: - *+data/themes/blue_scene/auto_limit.png: + * data/themes/default/auto_limit.png: + * data/themes/blue_scene/auto_limit.png: Added auto limiter option. Main window now has a button next to the high-quality button to toggle the auto limiter on and off The limiter scales the whole section between zero crossings where @@ -14918,7 +14949,7 @@ do not lock mutex in processOutEvent() as it causes a deadlock when having channel-activity-indicators enabled - * include/midi_mapper.h + * include/midi_mapper.h: * include/project_notes.h: * src/lib/sample_buffer.cpp: * src/midi/midi_file.cpp: @@ -16068,14 +16099,14 @@ * include/audio_dummy.h: * include/audio_file_device.h: * include/audio_file_ogg.h: - * include/audio_file_wave.h + * include/audio_file_wave.h: * include/audio_jack.h: * include/audio_oss.h: * include/audio_sdl.h: * include/export.h: * include/export_project_dialog.h: * include/mixer.h: - * include/pattern.h + * include/pattern.h: * include/song_editor.h: * src/audio/audio_alsa.cpp: * src/audio/audio_device.cpp: @@ -16122,7 +16153,7 @@ * plugins/vestige/communication.h: added new VST-framework (client-server-architecture) based on XFST - * include/qxembed.h + * include/qxembed.h: * src/widgets/qxembed.cpp: added QXEmbed-widget which is neccessary for embedding VST-plugin @@ -16451,8 +16482,8 @@ 2005-10-13 Danny McRae - * include/ladspa_manager.h - * include/ladspa_sine_1063.h + * include/ladspa_manager.h: + * include/ladspa_sine_1063.h: * src/lib/ladspa_manager.cpp: * src/soundgenerators/ladspa_sine_1063.cpp: added LADSPA-support and a simple soundgenerator for testing-purposes @@ -17719,7 +17750,7 @@ 2005-06-30 Tobias Doerffel * include/channel_track.h: - * include/midi_device.h + * include/midi_device.h: * include/mixer.h: * include/pattern.h: * src/core/piano_roll.cpp: @@ -17728,7 +17759,7 @@ added support for recording notes from MIDI-device (e.g. MIDI-keyboard or virtual channel-piano) in a pattern using the piano-roll - * include/pattern.h + * include/pattern.h: * src/core/song_editor.cpp: fixed bug which led to crash: when pattern was played in non-looping mode song-editor always called pattern::finishFreeze() even if there diff --git a/data/themes/default/fluiq/arrow-down.png b/data/themes/default/fluiq/arrow-down.png new file mode 100644 index 0000000000000000000000000000000000000000..2f3e0a3a21777e9f1cd1029e4314b486eafdc6bc GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j+1|*LJg5(ej@)Wnk16ovB4k_-iRPv3y>Mm}+%qEb&6#}JO|x#t%0wm66|T>Qz>87otj z-H^obbYj5qDi+=xPLTuWR_<2Fdt)s8d!Mzh@O!1EDDB$p-qc8jfO-oa<`tX&&khVc zf9;mEpJIR(Us+~1=Ep28HS0)Yzuz-<=kcyc)hFWzBz-u$F`Vd UT>W$Y03E>K>FVdQ&MBb@0O~ziGXMYp literal 0 HcmV?d00001 diff --git a/data/themes/default/fluiq/arrow-right.png b/data/themes/default/fluiq/arrow-right.png new file mode 100644 index 0000000000000000000000000000000000000000..016a863c3d236ca5c3802cf2ee86e2d8f58d4085 GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j+1|*LJg5(ej@)Wnk16ovB4k_-iRPv3y>Mm}+%q9#ul#}JO|v1c~&HXBH|Jp8_RO@roy zXz!4Py~`81!itVdOgnwVNZ8=SQV)kfyO*KrvYM(_qf}oicJ6z>{)FZ0 + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _FLUIQ_COLLAPSIBLE_WIDGET_H +#define _FLUIQ_COLLAPSIBLE_WIDGET_H + +#include + +#include "fluiq/widget.h" + + +namespace FLUIQ +{ + +class CollapsibleWidget; + +class CollapsibleWidgetHeader : public Widget +{ + Q_OBJECT +public: + CollapsibleWidgetHeader( CollapsibleWidget * _parent ); + virtual ~CollapsibleWidgetHeader(); + + + inline bool isCollapsed( void ) const + { + return m_collapsed; + } + + void setCollapsed( bool _c ); + + virtual QSize sizeHint( void ) const; + + +protected: + virtual void enterEvent( QEvent * _ev ); + virtual void leaveEvent( QEvent * _ev ); + virtual void mousePressEvent( QMouseEvent * _ev ); + virtual void mouseMoveEvent( QMouseEvent * _event ); + virtual void mouseReleaseEvent( QMouseEvent * _ev ); + virtual void paintEvent( QPaintEvent * _ev ); + + +private: + CollapsibleWidget * m_parent; + bool m_hovered; + bool m_pressed; + bool m_collapsed; + bool m_moved; + QPoint m_origMousePos; + + QPixmap m_arrowCollapsed; + QPixmap m_arrowExpanded; + + +signals: + void expanded( void ); + void collapsed( void ); + +} ; + + + +class CollapsibleWidget : public Widget +{ + Q_OBJECT +public: + CollapsibleWidget( Qt::Orientation _or, Widget * _parent = NULL ); + virtual ~CollapsibleWidget(); + + void addWidget( QWidget * _w ); + void insertWidget( int _idx, QWidget * _w ); + + inline QString labelText( void ) const + { + return m_header->windowTitle(); + } + + inline void setLabelText( const QString & _text ) + { + m_header->setWindowTitle( _text ); + } + + inline Qt::Orientation orientation( void ) const + { + return m_orientation; + } + + +public slots: + void expand( void ); + void collapse( void ); + + +private: + Qt::Orientation m_orientation; + + QBoxLayout * m_masterLayout; + CollapsibleWidgetHeader * m_header; + +} ; + + +} + +#endif diff --git a/include/fluiq/splitter.h b/include/fluiq/splitter.h new file mode 100644 index 000000000..541a76756 --- /dev/null +++ b/include/fluiq/splitter.h @@ -0,0 +1,64 @@ +/* + * splitter.h - header file for FLUIQ::Splitter + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _FLUIQ_SPLITTER_H +#define _FLUIQ_SPLITTER_H + +#include + + +namespace FLUIQ +{ + + +class Splitter : public QSplitter +{ + Q_OBJECT +public: + Splitter( Qt::Orientation _o, QWidget * _parent = NULL ); + virtual ~Splitter(); + + +protected: + QSplitterHandle * createHandle( void ); + +} ; + + +class SplitterHandle : public QSplitterHandle +{ +public: + SplitterHandle( Qt::Orientation _o, QSplitter * _parent ); + virtual ~SplitterHandle(); + + +protected: + void paintEvent( QPaintEvent * _event ); + +} ; + + +} + +#endif diff --git a/include/fluiq/widget.h b/include/fluiq/widget.h new file mode 100644 index 000000000..493ff2925 --- /dev/null +++ b/include/fluiq/widget.h @@ -0,0 +1,49 @@ +/* + * widget.h - header file for FLUIQ::Widget + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _FLUIQ_WIDGET_H +#define _FLUIQ_WIDGET_H + +#include + + +namespace FLUIQ +{ + + +class Widget : public QWidget +{ + Q_OBJECT +public: + Widget( QWidget * _parent = NULL ); + virtual ~Widget(); + +private: + +} ; + + +} + +#endif diff --git a/include/fluiq/widget_container.h b/include/fluiq/widget_container.h new file mode 100644 index 000000000..475f74cdd --- /dev/null +++ b/include/fluiq/widget_container.h @@ -0,0 +1,62 @@ +/* + * widget_container.h - header file for FLUIQ::WidgetContainer + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _FLUIQ_WIDGET_CONTAINER_H +#define _FLUIQ_WIDGET_CONTAINER_H + +#include "fluiq/widget.h" + + +class QScrollArea; +class QBoxLayout; + + + +namespace FLUIQ +{ + +class Splitter; + + +class WidgetContainer : public Widget +{ + Q_OBJECT +public: + WidgetContainer( Qt::Orientation _o, Widget * _parent = NULL ); + virtual ~WidgetContainer(); + + void addWidget( QWidget * _parent ); + + +private: + Qt::Orientation m_orientation; + QScrollArea * m_scrollArea; + Splitter * m_splitter; + +} ; + + +} + +#endif diff --git a/include/fluiq/workspace.h b/include/fluiq/workspace.h new file mode 100644 index 000000000..006459543 --- /dev/null +++ b/include/fluiq/workspace.h @@ -0,0 +1,58 @@ +/* + * workspace.h - header file for FLUIQ::Workspace + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _FLUIQ_WORKSPACE_H +#define _FLUIQ_WORKSPACE_H + +#include "fluiq/widget.h" +#include "fluiq/splitter.h" + +class QVBoxLayout; + + +namespace FLUIQ +{ + + +class Workspace : public Widget +{ + Q_OBJECT +public: + Workspace( QWidget * _parent = NULL ); + virtual ~Workspace(); + + void addWidget( QWidget * _w ); + void addWidgetToExistingRow( QWidget * _w ); + + +private: + Splitter * m_currentSplitter; + QVBoxLayout * m_masterLayout; + +} ; + + +} + +#endif diff --git a/src/gui/fluiq/collapsible_widget.cpp b/src/gui/fluiq/collapsible_widget.cpp new file mode 100644 index 000000000..31c252039 --- /dev/null +++ b/src/gui/fluiq/collapsible_widget.cpp @@ -0,0 +1,343 @@ +/* + * collapsible_widget.cpp - implementation of FLUIQ::CollapsibleWidget + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include +#include +#include + +#include "fluiq/collapsible_widget.h" + +#include "embed.h" + + +// implementation of FLUIQ::CollapsibleWidgetHeader + +const int HEADER_MIN_HEIGHT = 20; + +FLUIQ::CollapsibleWidgetHeader::CollapsibleWidgetHeader( + CollapsibleWidget * _parent ) : + Widget( _parent ), + m_parent( _parent ), + m_hovered( false ), + m_pressed( false ), + m_collapsed( false ), + m_moved( false ), + m_arrowCollapsed( embed::getIconPixmap( "fluiq/arrow-right" ) ), + m_arrowExpanded( embed::getIconPixmap( "fluiq/arrow-down" ) ) +{ + QFont f = font(); + f.setBold( true ); + setFont( f ); + + setAttribute( Qt::WA_OpaquePaintEvent, true ); + + if( m_parent->orientation() == Qt::Horizontal ) + { + setFixedWidth( HEADER_MIN_HEIGHT ); + } + else + { + setFixedHeight( HEADER_MIN_HEIGHT ); + } +} + + + + +FLUIQ::CollapsibleWidgetHeader::~CollapsibleWidgetHeader() +{ +} + + + + +void FLUIQ::CollapsibleWidgetHeader::setCollapsed( bool _c ) +{ + if( _c != m_collapsed ) + { + m_collapsed = _c; + update(); + } +} + + + + +QSize FLUIQ::CollapsibleWidgetHeader::sizeHint( void ) const +{ + if( m_parent->orientation() == Qt::Horizontal ) + { + return QSize( HEADER_MIN_HEIGHT, + HEADER_MIN_HEIGHT + + fontMetrics().width( windowTitle() ) ); + } + return QSize( HEADER_MIN_HEIGHT + fontMetrics().width( windowTitle() ), + HEADER_MIN_HEIGHT ); +} + + + + +void FLUIQ::CollapsibleWidgetHeader::enterEvent( QEvent * _ev ) +{ + m_hovered = true; + update(); + + Widget::enterEvent( _ev ); +} + + + + +void FLUIQ::CollapsibleWidgetHeader::leaveEvent( QEvent * _ev ) +{ + m_hovered = false; + update(); + + Widget::leaveEvent( _ev ); +} + + + + +void FLUIQ::CollapsibleWidgetHeader::mousePressEvent( QMouseEvent * _ev ) +{ + if( _ev->button() == Qt::LeftButton ) + { + QApplication::setOverrideCursor( + m_parent->orientation() == Qt::Vertical ? + Qt::SizeVerCursor : Qt::SizeHorCursor ); + m_pressed = true; + m_moved = false; + m_origMousePos = _ev->pos(); + update(); + _ev->accept(); + } + else + { + Widget::mousePressEvent( _ev ); + } +} + + + + +void FLUIQ::CollapsibleWidgetHeader::mouseMoveEvent( QMouseEvent * _event ) +{ + if( m_pressed ) + { + m_moved = true; + + QSize ms = m_parent->minimumSize(); + + if( m_parent->orientation() == Qt::Vertical ) + { + const int dy = _event->y() - m_origMousePos.y(); + ms.setHeight( qMax( 0, ms.height() + dy ) ); + } + else + { + const int dx = _event->x() - m_origMousePos.x(); + ms.setWidth( qMax( 0, ms.width() + dx ) ); + } + m_parent->setMinimumSize( ms ); + m_origMousePos = _event->pos(); + } +} + + + + +void FLUIQ::CollapsibleWidgetHeader::mouseReleaseEvent( QMouseEvent * _ev ) +{ + if( _ev->button() == Qt::LeftButton && m_pressed ) + { + QApplication::restoreOverrideCursor(); + m_pressed = false; + update(); + _ev->accept(); + + if( m_moved == false ) + { + if( m_collapsed ) + { + m_collapsed = false; + emit expanded(); + } + else + { + m_collapsed = true; + emit collapsed(); + } + } + } + else + { + Widget::mousePressEvent( _ev ); + } +} + + + + +void FLUIQ::CollapsibleWidgetHeader::paintEvent( QPaintEvent * _ev ) +{ + QPainter p( this ); + QRect r = rect(); + if( m_parent->orientation() == Qt::Horizontal ) + { + r = QRect( 0, 0, height(), width() ); + p.rotate( -90 ); + p.translate( -height(), 0 ); + } + + QLinearGradient grad( 0, 0, 0, r.height() ); + QColor c = palette().color( QPalette::Window ); + if( m_hovered ) + { + c = c.lighter( 200 ); + } + grad.setColorAt( 0, c.lighter( 280 ) ); + grad.setColorAt( 1, c ); + + p.fillRect( r, grad ); + + p.setPen( palette().color( QPalette::Text ) ); + p.drawPixmap( 8, 5, m_collapsed ? m_arrowCollapsed : m_arrowExpanded ); + p.drawText( 20, 10+r.height()-p.fontMetrics().height(), windowTitle() ); +} + + + + + + +// implementation of FLUIQ::CollapsibleWidget + + +FLUIQ::CollapsibleWidget::CollapsibleWidget( Qt::Orientation _or, + Widget * _parent ) : + Widget( _parent ), + m_orientation( _or ), + m_masterLayout( NULL ) +{ + if( m_orientation == Qt::Horizontal ) + { + m_masterLayout = new QHBoxLayout( this ); + } + else + { + m_masterLayout = new QVBoxLayout( this ); + } + m_masterLayout->setMargin( 0 ); + m_masterLayout->setSpacing( 0 ); + + m_header = new CollapsibleWidgetHeader( this ); + + m_masterLayout->addWidget( m_header ); + + connect( m_header, SIGNAL( expanded() ), + this, SLOT( expand() ) ); + connect( m_header, SIGNAL( collapsed() ), + this, SLOT( collapse() ) ); +} + + + + +FLUIQ::CollapsibleWidget::~CollapsibleWidget() +{ +} + + + + +void FLUIQ::CollapsibleWidget::addWidget( QWidget * _w ) +{ + m_masterLayout->addWidget( _w ); +} + + + + +void FLUIQ::CollapsibleWidget::insertWidget( int _idx, QWidget * _w ) +{ + m_masterLayout->insertWidget( _idx, _w ); +} + + + + +void FLUIQ::CollapsibleWidget::expand( void ) +{ + m_header->setCollapsed( false ); + + // set size properties + setMaximumSize( QSize( 1 << 16, 1 << 16 ) ); + + // show all children + foreach( QWidget * w, findChildren() ) + { + if( w != m_header && w->parentWidget() == this ) + { + w->show(); + } + } + setMinimumSize( sizeHint() ); +} + + + +void FLUIQ::CollapsibleWidget::collapse( void ) +{ + m_header->setCollapsed( true ); + + // hide all children + foreach( QWidget * w, findChildren() ) + { + if( w != m_header && w->parentWidget() == this ) + { + w->hide(); + } + } + + // set size properties + const QSize headerSize = m_header->sizeHint(); + if( m_orientation == Qt::Vertical ) + { + setMaximumSize( QSize( 1 << 16, headerSize.height() ) ); + } + else + { + setMaximumSize( QSize( headerSize.width(), 1 << 16 ) ); + } + setMinimumSize( headerSize ); +} + + + + +#include "fluiq/moc_collapsible_widget.cxx" + diff --git a/src/gui/fluiq/splitter.cpp b/src/gui/fluiq/splitter.cpp new file mode 100644 index 000000000..8978c718a --- /dev/null +++ b/src/gui/fluiq/splitter.cpp @@ -0,0 +1,98 @@ +/* + * splitter.cpp - implementation of FLUIQ::Splitter + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include +#include + +#include "fluiq/splitter.h" + + +FLUIQ::Splitter::Splitter( Qt::Orientation _o, QWidget * _parent ) : + QSplitter( _o, _parent ) +{ + setChildrenCollapsible( false ); + setSizePolicy( QSizePolicy::MinimumExpanding, + QSizePolicy::MinimumExpanding ); +} + + + + +FLUIQ::Splitter::~Splitter() +{ +} + + + + +QSplitterHandle * FLUIQ::Splitter::createHandle( void ) +{ + return new FLUIQ::SplitterHandle( orientation(), this ); +} + + + + + +FLUIQ::SplitterHandle::SplitterHandle( Qt::Orientation _o, + QSplitter * _parent ) : + QSplitterHandle( _o, _parent ) +{ +} + + + + +FLUIQ::SplitterHandle::~SplitterHandle() +{ +} + + + + +void FLUIQ::SplitterHandle::paintEvent( QPaintEvent * _event ) +{ + QPainter painter( this ); + + QLinearGradient gradient; + gradient.setColorAt( 0, QColor( 128, 128, 128 ) ); + gradient.setColorAt( 1, QColor( 32, 32, 32 ) ); + if( orientation() == Qt::Horizontal ) + { + gradient.setStart( rect().left(), rect().height()/2 ); + gradient.setFinalStop( rect().right(), rect().height()/2 ); + } + else + { + gradient.setStart( rect().width()/2, rect().top() ); + gradient.setFinalStop( rect().width()/2, rect().bottom() ); + } + painter.fillRect( _event->rect(), QBrush( gradient ) ); +} + + + +#include "fluiq/moc_splitter.cxx" + diff --git a/src/gui/fluiq/widget.cpp b/src/gui/fluiq/widget.cpp new file mode 100644 index 000000000..827a16167 --- /dev/null +++ b/src/gui/fluiq/widget.cpp @@ -0,0 +1,48 @@ +/* + * widget.cpp - implementation of FLUIQ::Widget + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "fluiq/widget.h" + + +FLUIQ::Widget::Widget( QWidget * _parent ) : + QWidget( _parent ) +{ + QPalette pal = palette(); + pal.setColor( QPalette::Window, QColor( 21, 21, 21 ) ); + pal.setColor( QPalette::Text, QColor( 255, 255, 255 ) ); + setPalette( pal ); +} + + + + +FLUIQ::Widget::~Widget() +{ +} + + + +#include "fluiq/moc_widget.cxx" + diff --git a/src/gui/fluiq/widget_container.cpp b/src/gui/fluiq/widget_container.cpp new file mode 100644 index 000000000..a73d449db --- /dev/null +++ b/src/gui/fluiq/widget_container.cpp @@ -0,0 +1,73 @@ +/* + * widget_container.cpp - implementation of FLUIQ::WidgetContainer + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include +#include + +#include "fluiq/widget_container.h" +#include "fluiq/splitter.h" + + + +FLUIQ::WidgetContainer::WidgetContainer( Qt::Orientation _o, + Widget * _parent ) : + Widget( _parent ), + m_orientation( _o ), + m_scrollArea( NULL ), + m_splitter( NULL ) +{ + QVBoxLayout * myLayout = new QVBoxLayout( this ); + myLayout->setSpacing( 0 ); + myLayout->setMargin( 0 ); + + m_scrollArea = new QScrollArea( this ); + m_scrollArea->setWidgetResizable( true ); + m_scrollArea->setFrameStyle( QFrame::NoFrame ); + + myLayout->addWidget( m_scrollArea ); + + m_splitter = new Splitter( m_orientation ); + m_scrollArea->setWidget( m_splitter ); +} + + + + +FLUIQ::WidgetContainer::~WidgetContainer() +{ +} + + + + +void FLUIQ::WidgetContainer::addWidget( QWidget * _widget ) +{ + m_splitter->addWidget( _widget ); +} + + + +#include "fluiq/moc_widget_container.cxx" + diff --git a/src/gui/fluiq/workspace.cpp b/src/gui/fluiq/workspace.cpp new file mode 100644 index 000000000..ee63d92b0 --- /dev/null +++ b/src/gui/fluiq/workspace.cpp @@ -0,0 +1,73 @@ +/* + * workspace.cpp - implementation of FLUIQ::Workspace + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include +#include + +#include "fluiq/workspace.h" + + +FLUIQ::Workspace::Workspace( QWidget * _parent ) : + Widget( _parent ), + m_masterLayout( new QVBoxLayout( this ) ) +{ + m_masterLayout->setMargin( 0 ); + m_masterLayout->setSpacing( 0 ); + + m_currentSplitter = new Splitter( Qt::Horizontal, this ); + m_masterLayout->addWidget( m_currentSplitter ); +} + + + + +FLUIQ::Workspace::~Workspace() +{ +} + + + + +void FLUIQ::Workspace::addWidget( QWidget * _w ) +{ + m_currentSplitter = new Splitter( Qt::Horizontal, this ); + m_masterLayout->addWidget( m_currentSplitter ); + + m_currentSplitter->addWidget( _w ); +} + + + + +void FLUIQ::Workspace::addWidgetToExistingRow( QWidget * _w ) +{ + m_currentSplitter->addWidget( _w ); +} + + + + +#include "fluiq/moc_workspace.cxx" +