Commit 76f17e6d authored by Martin Flöser's avatar Martin Flöser

Here comes the new TabBox. It is a complete rewrite using a MVC approach. Here some highlights:

 * Models and Delegates for Clients and Desktops
 * Horizontal, vertical and tabular layout
 * Layout of one item can be configured by an XML definition
 * A desktop item can include a client list
 * An optional second list view showing only the selected item
 * A new KCM "kwintabbox"
 * An alternative TabBox with independent settings and keybindings
 * Optional Highlight Windows effect integration
 * List scrolls instead of removing items
 * Scroll wheel support
 * Cursor key support
 * Middle click on item closes window
BUG: 195745
BUG: 197187
BUG: 201103
FEATURE: 118184
FEATURE: 156723
FEATURE: 177441
FEATURE: 182897
FEATURE: 193882
GUI:

svn path=/trunk/KDE/kdebase/workspace/; revision=1022861
parent 00b1ad8e
......@@ -39,6 +39,7 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/effects
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal
)
......@@ -63,7 +64,15 @@ set(kwin_KDEINIT_SRCS
utils.cpp
layers.cpp
main.cpp
tabbox.cpp
tabbox.cpp
tabbox/clientitemdelegate.cpp
tabbox/clientmodel.cpp
tabbox/desktopitemdelegate.cpp
tabbox/desktopmodel.cpp
tabbox/itemlayoutconfig.cpp
tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp
tabbox/tabboxview.cpp
desktopchangeosd.cpp
options.cpp
plugins.cpp
......@@ -99,7 +108,7 @@ qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWin::Works
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} kephal kdecorations kwineffects ${X11_LIBRARIES})
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTXML_LIBRARY} kephal kdecorations kwineffects ${X11_LIBRARIES})
if(OPENGL_FOUND)
target_link_libraries(kdeinit_kwin ${OPENGL_gl_LIBRARY})
......@@ -148,5 +157,6 @@ install(TARGETS kwinnvidiahack ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kwin )
install( FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
install( FILES tabbox/DefaultTabBoxLayouts.xml DESTINATION ${DATA_INSTALL_DIR}/kwin )
kde4_install_icons( ${ICON_INSTALL_DIR} )
......@@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "effects.h"
#include "deleted.h"
#include "paintredirector.h"
#include "tabbox.h"
#include <X11/extensions/shape.h>
#include <QX11Info>
......@@ -168,6 +169,10 @@ Client::Client( Workspace* ws )
cmap = None;
// TabBoxClient
m_tabBoxClient = new TabBox::TabBoxClientImpl();
m_tabBoxClient->setClient( this );
geom = QRect( 0, 0, 100, 100 ); // So that decorations don't start with size being (0,0)
client_size = QSize( 100, 100 );
#if defined(HAVE_XSYNC) || defined(HAVE_XDAMAGE)
......@@ -194,6 +199,7 @@ Client::~Client()
assert( block_geometry_updates == 0 );
assert( !check_active_modal );
delete bridge;
delete m_tabBoxClient;
}
// Use destroyClient() or releaseWindow(), Client instances cannot be deleted directly
......
......@@ -54,6 +54,11 @@ class KStartupInfoData;
namespace KWin
{
namespace TabBox {
class TabBoxClientImpl;
}
class Workspace;
class Client;
......@@ -332,6 +337,8 @@ class Client
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom, CoordinateMode mode) const;
virtual void addRepaintFull();
TabBox::TabBoxClientImpl* tabBoxClient() const { return m_tabBoxClient; }
private slots:
void autoRaise();
void shadeHover();
......@@ -586,6 +593,7 @@ class Client
QTimer* demandAttentionKNotifyTimer;
QPixmap decorationPixmapLeft, decorationPixmapRight, decorationPixmapTop, decorationPixmapBottom;
PaintRedirector* paintRedirector;
TabBox::TabBoxClientImpl* m_tabBoxClient;
bool electricMaximizing;
ElectricMaximizingMode electricMode;
......
......@@ -46,6 +46,8 @@ BoxSwitchEffect::BoxSwitchEffect()
, painting_desktop( 0 )
, animation( false )
, highlight_is_set( false )
, primaryTabBox( true )
, secondaryTabBox( false )
{
text_font.setBold( true );
text_font.setPointSize( 12 );
......@@ -75,13 +77,16 @@ void BoxSwitchEffect::reconfigure( ReconfigureFlags )
bg_opacity = conf.readEntry( "BackgroundOpacity", 25 ) / 100.0;
elevate_window = conf.readEntry( "ElevateSelected", true );
mAnimateSwitch = conf.readEntry( "AnimateSwitch", false );
primaryTabBox = conf.readEntry( "TabBox", true );
secondaryTabBox = conf.readEntry( "TabBoxAlternative", false );
}
void BoxSwitchEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{
if( activeTimeLine.value() != 0.0 )
{
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
if( windows.contains( w ))
{
......@@ -130,7 +135,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
effects->paintScreen( mask, region, data );
if( mActivated )
{
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
thumbnailFrame.render( region );
......@@ -209,7 +214,8 @@ void BoxSwitchEffect::postPaintScreen()
void BoxSwitchEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
if(( mActivated && mMode == TabBoxWindowsMode ) || ( !mActivated && activeTimeLine.value() != 0.0 ))
if(( mActivated && (mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode) )
|| ( !mActivated && activeTimeLine.value() != 0.0 ))
{
if( windows.contains( w ) && w != selected_window )
{
......@@ -232,7 +238,7 @@ void BoxSwitchEffect::windowInputMouseEvent( Window w, QEvent* e )
pos += frame_area.topLeft();
// determine which item was clicked
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
foreach( EffectWindow* w, windows.keys())
{
......@@ -268,7 +274,7 @@ void BoxSwitchEffect::windowDamaged( EffectWindow* w, const QRect& damage )
{
if( mActivated )
{
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
if( windows.contains( w ))
{
......@@ -294,7 +300,7 @@ void BoxSwitchEffect::windowGeometryShapeChanged( EffectWindow* w, const QRect&
{
if( mActivated )
{
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
if( windows.contains( w ) && w->size() != old.size())
{
......@@ -320,7 +326,8 @@ void BoxSwitchEffect::tabBoxAdded( int mode )
{
if( !mActivated )
{
if( mode == TabBoxWindowsMode )
if( ( mode == TabBoxWindowsMode && primaryTabBox ) ||
( mode == TabBoxWindowsAlternativeMode && secondaryTabBox) )
{
if( effects->currentTabBoxWindowList().count() > 0 )
{
......@@ -333,7 +340,7 @@ void BoxSwitchEffect::tabBoxAdded( int mode )
setActive();
}
}
else
else if( mode == TabBoxDesktopListMode || mode == TabBoxDesktopMode )
{ // DesktopMode
if( effects->currentTabBoxDesktopList().count() > 0 )
{
......@@ -356,7 +363,8 @@ void BoxSwitchEffect::tabBoxUpdated()
{
if( mActivated )
{
if( mMode == TabBoxWindowsMode && selected_window != effects->currentTabBoxWindow() )
if( (mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode)
&& selected_window != effects->currentTabBoxWindow() )
{
if( selected_window != NULL )
{
......@@ -409,7 +417,7 @@ void BoxSwitchEffect::tabBoxUpdated()
selected_window->addRepaintFull();
effects->addRepaint( text_area );
}
else if( mMode != TabBoxWindowsMode )
else if( mMode != TabBoxWindowsMode && mMode != TabBoxWindowsAlternativeMode )
{ // DesktopMode
if( desktops.contains( selected_desktop ))
effects->addRepaint( desktops.value( selected_desktop )->area );
......@@ -440,7 +448,7 @@ void BoxSwitchEffect::setActive()
qDeleteAll( windows );
windows.clear();
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
original_windows = effects->currentTabBoxWindowList();
setSelectedWindow( effects->currentTabBoxWindow());
......@@ -456,7 +464,7 @@ void BoxSwitchEffect::setActive()
mInput = effects->createInputWindow( this, frame_area.x(), frame_area.y(),
frame_area.width(), frame_area.height(), Qt::ArrowCursor );
effects->addRepaint( frame_area );
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
foreach( EffectWindow* w, windows.keys())
{
......@@ -474,7 +482,7 @@ void BoxSwitchEffect::setInactive()
effects->destroyInputWindow( mInput );
mInput = None;
}
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
foreach( EffectWindow* w, windows.keys())
{
......@@ -544,7 +552,7 @@ void BoxSwitchEffect::calculateFrameSize()
{
int itemcount;
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
itemcount = original_windows.count();
item_max_size.setWidth( 200 );
......@@ -582,7 +590,7 @@ void BoxSwitchEffect::calculateFrameSize()
void BoxSwitchEffect::calculateItemSizes()
{
if( mMode == TabBoxWindowsMode )
if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode )
{
qDeleteAll( windows );
windows.clear();
......
......@@ -112,6 +112,9 @@ class BoxSwitchEffect
QQueue<Direction> scheduled_directions;
EffectWindow* edge_window;
EffectWindow* right_window;
bool primaryTabBox;
bool secondaryTabBox;
};
class BoxSwitchEffect::ItemInfo
......
......@@ -54,6 +54,8 @@ CoverSwitchEffect::CoverSwitchEffect()
, selected_window( 0 )
, captionFrame( EffectFrame::Styled )
, thumbnailFrame( EffectFrame::Styled )
, primaryTabBox( false )
, secondaryTabBox( false )
{
reconfigure( ReconfigureAll );
......@@ -88,6 +90,8 @@ void CoverSwitchEffect::reconfigure( ReconfigureFlags )
thumbnailWindows = conf.readEntry( "ThumbnailWindows", 8 );
timeLine.setCurveShape( TimeLine::EaseInOutCurve );
timeLine.setDuration( animationDuration );
primaryTabBox = conf.readEntry( "TabBox", false );
secondaryTabBox = conf.readEntry( "TabBoxAlternative", false );
// thumbnail bar
color_frame = KColorScheme( QPalette::Active, KColorScheme::Window ).background().color();
......@@ -109,7 +113,7 @@ void CoverSwitchEffect::prePaintScreen( ScreenPrePaintData& data, int time )
(dynamicThumbnails && currentWindowList.size() >= thumbnailWindows)) )
calculateItemSizes();
}
if( effects->currentTabBoxWindow() == NULL )
if( selected_window == NULL )
abort();
}
effects->prePaintScreen(data, time);
......@@ -510,7 +514,9 @@ void CoverSwitchEffect::tabBoxAdded( int mode )
if( !mActivated )
{
// only for windows mode
if( mode == TabBoxWindowsMode && effects->currentTabBoxWindowList().count() > 0 )
if( (( mode == TabBoxWindowsMode && primaryTabBox ) ||
( mode == TabBoxWindowsAlternativeMode && secondaryTabBox ))
&& effects->currentTabBoxWindowList().count() > 0 )
{
input = effects->createFullScreenInputWindow( this, Qt::ArrowCursor );
activeScreen = effects->activeScreen();
......
......@@ -121,6 +121,8 @@ class CoverSwitchEffect
QRect highlight_area;
bool highlight_is_set;
bool primaryTabBox;
bool secondaryTabBox;
};
class CoverSwitchEffect::ItemInfo
......
......@@ -115,6 +115,7 @@ void FlipSwitchEffect::reconfigure( ReconfigureFlags )
effects->reserveElectricBorder( ElectricBorder( i ) );
}
m_tabbox = conf.readEntry( "TabBox", false );
m_tabboxAlternative = conf.readEntry( "TabBoxAlternative", false );
float duration = animationTime( conf, "Duration", 200 );
m_timeLine.setDuration( duration );
m_startStopTimeLine.setDuration( duration );
......@@ -549,9 +550,9 @@ void FlipSwitchEffect::tabBoxAdded( int mode )
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return;
// only for windows mode
if( m_tabbox
if( (( mode == TabBoxWindowsMode && m_tabbox ) ||
( mode == TabBoxWindowsAlternativeMode && m_tabboxAlternative ))
&& (!m_active || (m_active && m_stop))
&& mode == TabBoxWindowsMode
&& !effects->currentTabBoxWindowList().isEmpty() )
{
setActive( true, TabboxMode );
......
......@@ -98,6 +98,7 @@ class FlipSwitchEffect
QList<ElectricBorder> m_borderActivate;
QList<ElectricBorder> m_borderActivateAll;
bool m_tabbox;
bool m_tabboxAlternative;
float m_angle;
float m_xPosition;
float m_yPosition;
......
......@@ -130,6 +130,7 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a )
m_monitorWindow = w;
bool found = false;
int length = byteData.length() / sizeof( data[0] );
m_highlightedWindows.clear();
for( int i=0; i<length; i++ )
{
EffectWindow* foundWin = effects->findWindow( data[i] );
......@@ -143,7 +144,10 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a )
found = true;
}
if( !found )
{
finishHighlighting();
return;
}
prepareHighlighting();
m_windowOpacity[w] = 1.0; // Because it's not in stackingOrder() yet
......
......@@ -141,6 +141,7 @@ void PresentWindowsEffect::reconfigure( ReconfigureFlags )
m_showCaptions = conf.readEntry( "DrawWindowCaptions", true );
m_showIcons = conf.readEntry( "DrawWindowIcons", true );
m_tabBoxAllowed = conf.readEntry( "TabBox", false );
m_tabBoxAlternativeAllowed = conf.readEntry( "TabBoxAlternative", false );
m_ignoreMinimized = conf.readEntry( "IgnoreMinimized", false );
m_accuracy = conf.readEntry( "Accuracy", 1 ) * 20;
m_fillGaps = conf.readEntry( "FillGaps", true );
......@@ -639,9 +640,9 @@ void PresentWindowsEffect::tabBoxAdded( int mode )
return;
if( m_activated )
return;
if( !m_tabBoxAllowed )
return;
if( mode == TabBoxWindowsMode && effects->currentTabBoxWindowList().count() > 0 )
if( (( mode == TabBoxWindowsMode && m_tabBoxAllowed ) ||
( mode == TabBoxWindowsAlternativeMode && m_tabBoxAlternativeAllowed )) &&
effects->currentTabBoxWindowList().count() > 0 )
{
m_tabBoxEnabled = true;
setActive( true );
......
......@@ -173,6 +173,7 @@ class PresentWindowsEffect
bool m_showCaptions;
bool m_showIcons;
bool m_tabBoxAllowed;
bool m_tabBoxAlternativeAllowed;
int m_accuracy;
bool m_fillGaps;
double m_fadeDuration;
......
......@@ -5,3 +5,4 @@ add_subdirectory( kwinrules )
add_subdirectory( kwincompositing )
add_subdirectory( kwindesktop )
add_subdirectory( kwinscreenedges )
add_subdirectory( kwintabbox )
......@@ -335,9 +335,11 @@ void KWinCompositingConfig::loadGeneralTab()
// window switching
// Set current option to "none" if no plugin is activated.
ui.windowSwitchingCombo->setCurrentIndex( 0 );
if( effectEnabled( "boxswitch", effectconfig ))
KConfigGroup boxswitchconfig(mKWinConfig, "Effect-BoxSwitch");
if( effectEnabled( "boxswitch", effectconfig ) && boxswitchconfig.readEntry("TabBox", true))
ui.windowSwitchingCombo->setCurrentIndex( 1 );
if( effectEnabled( "coverswitch", effectconfig ))
KConfigGroup coverswitchconfig(mKWinConfig, "Effect-CoverSwitch");
if( effectEnabled( "coverswitch", effectconfig ) && coverswitchconfig.readEntry("TabBox", false))
ui.windowSwitchingCombo->setCurrentIndex( 3 );
KConfigGroup flipswitchconfig(mKWinConfig, "Effect-FlipSwitch");
if( effectEnabled( "flipswitch", effectconfig ) && flipswitchconfig.readEntry("TabBox", false))
......@@ -491,44 +493,48 @@ void KWinCompositingConfig::saveGeneralTab()
#undef WRITE_EFFECT_CONFIG
int windowSwitcher = ui.windowSwitchingCombo->currentIndex();
bool boxSwitch = false;
bool presentWindowSwitching = false;
bool flipSwitch = false;
bool coverSwitch = false;
bool flipSwitch = false;
switch( windowSwitcher )
{
case 0:
// no effect
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", false);
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", false);
break;
case 1:
// box switch
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", true);
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", false);
boxSwitch = true;
break;
case 2:
// present windows
presentWindowSwitching = true;
effectconfig.writeEntry("kwin4_effect_presentwindowsEnabled", true);
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", false);
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", false);
break;
case 3:
// coverswitch
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", false);
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", true);
coverSwitch = true;
break;
case 4:
// flipswitch
flipSwitch = true;
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", false);
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", false);
effectconfig.writeEntry("kwin4_effect_flipswitchEnabled", true);
break;
default:
break; // nothing
}
KConfigGroup presentwindowsconfig(mKWinConfig, "Effect-PresentWindows");
presentwindowsconfig.writeEntry("TabBox", presentWindowSwitching);
KConfigGroup flipswitchconfig(mKWinConfig, "Effect-FlipSwitch");
flipswitchconfig.writeEntry("TabBox", flipSwitch);
// activate effects if not active
if( boxSwitch )
effectconfig.writeEntry("kwin4_effect_boxswitchEnabled", true);
if( presentWindowSwitching )
effectconfig.writeEntry("kwin4_effect_presentwindowsEnabled", true);
if( coverSwitch )
effectconfig.writeEntry("kwin4_effect_coverswitchEnabled", true);
if( flipSwitch )
effectconfig.writeEntry("kwin4_effect_flipswitchEnabled", true);
KConfigGroup boxswitchconfig( mKWinConfig, "Effect-BoxSwitch" );
boxswitchconfig.writeEntry( "TabBox", boxSwitch );
boxswitchconfig.sync();
KConfigGroup presentwindowsconfig( mKWinConfig, "Effect-PresentWindows" );
presentwindowsconfig.writeEntry( "TabBox", presentWindowSwitching );
presentwindowsconfig.sync();
KConfigGroup coverswitchconfig( mKWinConfig, "Effect-CoverSwitch" );
coverswitchconfig.writeEntry( "TabBox", coverSwitch );
coverswitchconfig.sync();
KConfigGroup flipswitchconfig( mKWinConfig, "Effect-FlipSwitch" );
flipswitchconfig.writeEntry( "TabBox", flipSwitch );
flipswitchconfig.sync();
int desktopSwitcher = ui.desktopSwitchingCombo->currentIndex();
switch( desktopSwitcher )
......
include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox )
########### next target ###############
set(kcm_kwintabbox_PART_SRCS
main.cpp
layoutconfig.cpp
previewhandlerimpl.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/clientitemdelegate.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/clientmodel.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/desktopitemdelegate.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/desktopmodel.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/itemlayoutconfig.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/tabboxconfig.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/tabboxhandler.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox/tabboxview.cpp )
kde4_add_ui_files( kcm_kwintabbox_PART_SRCS main.ui )
kde4_add_ui_files( kcm_kwintabbox_PART_SRCS layoutconfig.ui )
kde4_add_plugin(kcm_kwintabbox ${kcm_kwintabbox_PART_SRCS})
target_link_libraries(kcm_kwintabbox ${KDE4_KDEUI_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_PLASMA_LIBS} ${X11_LIBRARIES} ${QT_QTXML_LIBRARY} kephal )
install(TARGETS kcm_kwintabbox DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kwintabbox.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
Icon=preferences-system-windows-focus
Exec=kcmshell4 kwintabbox
X-KDE-Library=kcm_kwintabbox
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=window-behaviour
X-KDE-Weight=60
Name=Navigate Through Windows
Comment=Configure the behaviour for navigating through windows
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2009 Martin Gräßlin <kde@martin-graesslin.com>
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. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
// own
#include "layoutconfig.h"
#include "ui_layoutconfig.h"
#include "previewhandlerimpl.h"
// tabbox
#include "tabboxconfig.h"
#include "tabboxhandler.h"
#include "tabboxview.h"
// Qt
#include <QVBoxLayout>
namespace KWin
{
namespace TabBox
{
/***************************************************
* LayoutConfigPrivate
***************************************************/
class LayoutConfigPrivate
{
public:
LayoutConfigPrivate();
~LayoutConfigPrivate() { delete previewTabbox; }
TabBoxConfig config;
Ui::LayoutConfigForm ui;
PreviewHandlerImpl* previewTabbox;
};
LayoutConfigPrivate::LayoutConfigPrivate()
: previewTabbox( new PreviewHandlerImpl() )
{
previewTabbox->setConfig( config );
}
/***************************************************
* LayoutConfig
***************************************************/
LayoutConfig::LayoutConfig(QWidget* parent)
: QWidget(parent)
{
d = new LayoutConfigPrivate;
d->ui.setupUi( this );
QVBoxLayout* layout = new QVBoxLayout( this );
QWidget* tabBoxView = tabBox->tabBoxView();
tabBoxView->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
layout->addWidget( tabBoxView );
d->ui.previewWidget->setLayout( layout );
tabBox->createModel();
tabBox->setCurrentIndex( tabBox->first() );
// init the item layout combo box
d->ui.itemLayoutCombo->addItem( i18n("Informative") );
d->ui.itemLayoutCombo->addItem( i18n("Compact") );
d->ui.itemLayoutCombo->addItem( i18n("Small Icons") );
d->ui.itemLayoutCombo->addItem( i18n("Large Icons") );
d->ui.itemLayoutCombo->addItem( i18n("Text Only") );
// TODO: user defined layouts
// init the selected item layout combo box