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
This commit is contained in:
Tobias Doerffel
2008-12-08 01:28:04 +00:00
parent 976d858b66
commit f1950b3007
13 changed files with 1056 additions and 30 deletions

View File

@@ -1,27 +1,45 @@
2008-12-08 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* 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 <superjoe30/at/gmail/dot/com>
* 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 <superjoe30/at/gmail/dot/com>
* 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 <superjoe30/at/gmail/dot/com>
* 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 <drfaygo/at/gmail/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* configure.in:
fixed check for STK headers and library
@@ -12730,6 +12750,7 @@
Qt4-compat fixes
2006-08-30 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* src/widgets/ladspa_control.cpp:
doubled the number of steps in the knobs
@@ -13006,6 +13029,7 @@
removed
2006-08-14 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/users/dot/sourceforge/dot/net>
* 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 <khjklujn/at/yahoo/dot/com>
* 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 <tobydox/at/users/dot/sourceforge/dot/net>
* 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

View File

@@ -0,0 +1,127 @@
/*
* collapsible_widget.h - header file for FLUIQ::CollapsibleWidget
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QBoxLayout>
#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

64
include/fluiq/splitter.h Normal file
View File

@@ -0,0 +1,64 @@
/*
* splitter.h - header file for FLUIQ::Splitter
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QSplitter>
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

49
include/fluiq/widget.h Normal file
View File

@@ -0,0 +1,49 @@
/*
* widget.h - header file for FLUIQ::Widget
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QWidget>
namespace FLUIQ
{
class Widget : public QWidget
{
Q_OBJECT
public:
Widget( QWidget * _parent = NULL );
virtual ~Widget();
private:
} ;
}
#endif

View File

@@ -0,0 +1,62 @@
/*
* widget_container.h - header file for FLUIQ::WidgetContainer
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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

58
include/fluiq/workspace.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* workspace.h - header file for FLUIQ::Workspace
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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

View File

@@ -0,0 +1,343 @@
/*
* collapsible_widget.cpp - implementation of FLUIQ::CollapsibleWidget
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QApplication>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#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<QWidget *>() )
{
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<QWidget *>() )
{
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"

View File

@@ -0,0 +1,98 @@
/*
* splitter.cpp - implementation of FLUIQ::Splitter
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QPainter>
#include <QtGui/QPaintEvent>
#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"

48
src/gui/fluiq/widget.cpp Normal file
View File

@@ -0,0 +1,48 @@
/*
* widget.cpp - implementation of FLUIQ::Widget
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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"

View File

@@ -0,0 +1,73 @@
/*
* widget_container.cpp - implementation of FLUIQ::WidgetContainer
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QVBoxLayout>
#include <QtGui/QScrollArea>
#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"

View File

@@ -0,0 +1,73 @@
/*
* workspace.cpp - implementation of FLUIQ::Workspace
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtGui/QBoxLayout>
#include <QtGui/QWidget>
#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"