used ui file for detectWidget
svn path=/trunk/KDE/kdebase/workspace/; revision=1042063
This commit is contained in:
parent
3e5959d829
commit
af01b788dc
4 changed files with 105 additions and 91 deletions
|
@ -16,6 +16,8 @@ set(kwin_oxygen_config_PART_SRCS
|
|||
oxygenshadowconfigurationui.cpp
|
||||
)
|
||||
|
||||
kde4_add_ui_files(kwin_oxygen_config_PART_SRCS oxygendetectwidget.ui)
|
||||
|
||||
kde4_add_plugin(kwin_oxygen_config ${kwin_oxygen_config_PART_SRCS})
|
||||
|
||||
target_link_libraries(
|
||||
|
|
|
@ -46,57 +46,6 @@
|
|||
namespace Oxygen
|
||||
{
|
||||
|
||||
//_________________________________________________________
|
||||
DetectWidget::DetectWidget( QWidget* parent ):
|
||||
QWidget( parent )
|
||||
{
|
||||
|
||||
QVBoxLayout* vboxLayout = new QVBoxLayout();
|
||||
vboxLayout->setMargin( 0 );
|
||||
setLayout( vboxLayout );
|
||||
|
||||
QGroupBox* box( new QGroupBox( i18n( "Information about Selected Window" ), this ) );
|
||||
vboxLayout->addWidget( box );
|
||||
|
||||
// display layout
|
||||
QGridLayout *gridLayout = new QGridLayout();
|
||||
box->setLayout( gridLayout );
|
||||
|
||||
// class
|
||||
gridLayout->addWidget( new QLabel( i18n( "Class: " ), box ), 0, 0, 1, 1, Qt::AlignRight|Qt::AlignVCenter );
|
||||
gridLayout->addWidget( windowClass = new QLabel( box ), 0, 1, 1, 1 );
|
||||
|
||||
// title
|
||||
gridLayout->addWidget( new QLabel( i18n( "Title: " ), box ), 1, 0, 1, 1, Qt::AlignRight|Qt::AlignVCenter );
|
||||
gridLayout->addWidget( windowTitle = new QLabel( box ), 1, 1, 1, 1 );
|
||||
|
||||
box = new QGroupBox( i18n( "Window Property Selection" ), this );
|
||||
QButtonGroup* group( new QButtonGroup( this ) );
|
||||
box->setLayout( new QVBoxLayout() );
|
||||
vboxLayout->addWidget( box );
|
||||
|
||||
QCheckBox* checkbox;
|
||||
group->addButton( checkbox = new QCheckBox( i18n( "Use window class (whole application)" ) ) );
|
||||
checkboxes.insert( std::make_pair( checkbox, OxygenException::WindowClassName ) );
|
||||
checkbox->setChecked( true );
|
||||
box->layout()->addWidget( checkbox );
|
||||
|
||||
group->addButton( checkbox = new QCheckBox( i18n( "Use window title" ) ) );
|
||||
checkboxes.insert( std::make_pair( checkbox, OxygenException::WindowTitle ) );
|
||||
box->layout()->addWidget( checkbox );
|
||||
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
OxygenException::Type DetectWidget::exceptionType( void ) const
|
||||
{
|
||||
for( CheckBoxMap::const_iterator iter = checkboxes.begin(); iter != checkboxes.end(); ++iter )
|
||||
{ if( iter->first->isChecked() ) return iter->second; }
|
||||
|
||||
assert( false );
|
||||
return OxygenException::WindowClassName;
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
DetectDialog::DetectDialog( QWidget* parent ):
|
||||
KDialog( parent ),
|
||||
|
@ -107,8 +56,11 @@ namespace Oxygen
|
|||
setButtons( Ok|Cancel );
|
||||
showButtonSeparator( false );
|
||||
|
||||
QWidget* local( new QWidget( this ) );
|
||||
widget.setupUi( local );
|
||||
|
||||
// central widget
|
||||
setMainWidget( widget = new DetectWidget( this ) );
|
||||
setMainWidget( local );
|
||||
|
||||
}
|
||||
|
||||
|
@ -140,8 +92,8 @@ namespace Oxygen
|
|||
QString wmclass_name = info.windowClassName();
|
||||
QString title = info.name();
|
||||
|
||||
widget->setWindowClass( wmclass_class + " (" + wmclass_name + ' ' + wmclass_class + ')' );
|
||||
widget->setWindowTitle( title );
|
||||
widget.windowClass->setText( wmclass_class + " (" + wmclass_name + ' ' + wmclass_class + ')' );
|
||||
widget.windowTitle->setText( title );
|
||||
emit detectionDone( exec() == KDialog::Accepted );
|
||||
|
||||
return;
|
||||
|
|
|
@ -40,45 +40,11 @@
|
|||
#include <kwindowsystem.h>
|
||||
|
||||
#include "../oxygenexception.h"
|
||||
#include "ui_oxygendetectwidget.h"
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
class DetectWidget: public QWidget
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
DetectWidget( QWidget* );
|
||||
|
||||
//! window class
|
||||
void setWindowClass( QString value )
|
||||
{ windowClass->setText( value ); }
|
||||
|
||||
//! window title
|
||||
void setWindowTitle( QString value )
|
||||
{ windowTitle->setText( value ); }
|
||||
|
||||
//! window machine
|
||||
void setWindowMachine( QString value )
|
||||
{ windowMachine->setText( value ); }
|
||||
|
||||
//! type
|
||||
OxygenException::Type exceptionType( void ) const;
|
||||
|
||||
private:
|
||||
|
||||
QLabel* windowClass;
|
||||
QLabel* windowTitle;
|
||||
QLabel* windowMachine;
|
||||
|
||||
// map checkboxes against exception type
|
||||
typedef std::map<QCheckBox*, OxygenException::Type > CheckBoxMap;
|
||||
CheckBoxMap checkboxes;
|
||||
|
||||
};
|
||||
|
||||
class DetectDialog : public KDialog
|
||||
{
|
||||
|
||||
|
@ -101,7 +67,11 @@ namespace Oxygen
|
|||
|
||||
//! exception type
|
||||
OxygenException::Type exceptionType() const
|
||||
{ return widget->exceptionType(); }
|
||||
{
|
||||
if( widget.windowClassCheckBox->isChecked() ) return OxygenException::WindowClassName;
|
||||
else if( widget.windowTitleCheckBox->isChecked() ) return OxygenException::WindowTitle;
|
||||
else return OxygenException::WindowClassName;
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -129,7 +99,7 @@ namespace Oxygen
|
|||
QString machine;
|
||||
|
||||
//! main widget
|
||||
DetectWidget* widget;
|
||||
Ui_DetectWidget widget;
|
||||
|
||||
//! invisible dialog used to grab mouse
|
||||
KDialog* grabber;
|
||||
|
|
90
clients/oxygen/config/oxygendetectwidget.ui
Normal file
90
clients/oxygen/config/oxygendetectwidget.ui
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DetectWidget</class>
|
||||
<widget class="QWidget" name="DetectWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>331</width>
|
||||
<height>183</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Information about Selected Window</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Class: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="windowClass">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Title: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="windowTitle">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Window Property Selection</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="windowClassCheckBox">
|
||||
<property name="text">
|
||||
<string>Use window class (whole application)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="windowTitleCheckBox">
|
||||
<property name="locale">
|
||||
<locale language="French" country="France"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use window title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue