moved QDialog layout to ui for DetectWidget.
This commit is contained in:
parent
d90d0f5c8e
commit
965aaabda8
3 changed files with 71 additions and 35 deletions
|
@ -34,7 +34,8 @@
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QtGui/QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include <QtGui/QX11Info>
|
#include <QtGui/QX11Info>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -47,19 +48,15 @@ namespace Oxygen
|
||||||
|
|
||||||
//_________________________________________________________
|
//_________________________________________________________
|
||||||
DetectDialog::DetectDialog( QWidget* parent ):
|
DetectDialog::DetectDialog( QWidget* parent ):
|
||||||
KDialog( parent ),
|
QDialog( parent ),
|
||||||
_grabber( 0 )
|
_grabber( 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
// define buttons
|
// setup
|
||||||
setButtons( Ok|Cancel );
|
setupUi( this );
|
||||||
|
|
||||||
QWidget* local( new QWidget( this ) );
|
connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL(clicked()), this, SLOT(close()) );
|
||||||
ui.setupUi( local );
|
windowClassCheckBox->setChecked( true );
|
||||||
ui.windowClassCheckBox->setChecked( true );
|
|
||||||
|
|
||||||
// central widget
|
|
||||||
setMainWidget( local );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,13 +84,12 @@ namespace Oxygen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString wmClassClass = _info.windowClassClass();
|
const QString wmClassClass( QString::fromUtf8( _info.windowClassClass() ) );
|
||||||
QString wmClassName = _info.windowClassName();
|
const QString wmClassName( QString::fromUtf8( _info.windowClassName() ) );
|
||||||
QString title = _info.name();
|
|
||||||
|
|
||||||
ui.windowClass->setText( wmClassClass + " (" + wmClassName + ' ' + wmClassClass + ')' );
|
windowClass->setText( QStringLiteral( "%1 (%2 %3)" ).arg( wmClassClass ).arg( wmClassName ).arg( wmClassClass ) );
|
||||||
ui.windowTitle->setText( title );
|
Ui::OxygenDetectWidget::windowTitle->setText( _info.name() );
|
||||||
emit detectionDone( exec() == KDialog::Accepted );
|
emit detectionDone( exec() == QDialog::Accepted );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -106,7 +102,7 @@ namespace Oxygen
|
||||||
// use a dialog, so that all user input is blocked
|
// use a dialog, so that all user input is blocked
|
||||||
// use WX11BypassWM and moving away so that it's not actually visible
|
// use WX11BypassWM and moving away so that it's not actually visible
|
||||||
// grab only mouse, so that keyboard can be used e.g. for switching windows
|
// grab only mouse, so that keyboard can be used e.g. for switching windows
|
||||||
_grabber = new KDialog( 0, Qt::X11BypassWindowManagerHint );
|
_grabber = new QDialog( 0, Qt::X11BypassWindowManagerHint );
|
||||||
_grabber->move( -1000, -1000 );
|
_grabber->move( -1000, -1000 );
|
||||||
_grabber->setModal( true );
|
_grabber->setModal( true );
|
||||||
_grabber->show();
|
_grabber->show();
|
||||||
|
@ -143,7 +139,7 @@ namespace Oxygen
|
||||||
Window child;
|
Window child;
|
||||||
uint mask;
|
uint mask;
|
||||||
int rootX, rootY, x, y;
|
int rootX, rootY, x, y;
|
||||||
Window parent = QX11Info::appRootWindow();
|
Window parent = reinterpret_cast<Window>( QX11Info::appRootWindow() );
|
||||||
Atom wm_state = XInternAtom( QX11Info::display(), "WM_STATE", False );
|
Atom wm_state = XInternAtom( QX11Info::display(), "WM_STATE", False );
|
||||||
|
|
||||||
// why is there a loop of only 10 here
|
// why is there a loop of only 10 here
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
#include "oxygenconfiguration.h"
|
#include "oxygenconfiguration.h"
|
||||||
#include "ui_oxygendetectwidget.h"
|
#include "ui_oxygendetectwidget.h"
|
||||||
|
|
||||||
#include <KDialog>
|
|
||||||
#include <QEvent>
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
#include <kwindowsystem.h>
|
#include <kwindowsystem.h>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
namespace Oxygen
|
namespace Oxygen
|
||||||
{
|
{
|
||||||
|
|
||||||
class DetectDialog : public KDialog
|
class DetectDialog : public QDialog, Ui::OxygenDetectWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -67,8 +67,8 @@ namespace Oxygen
|
||||||
//! exception type
|
//! exception type
|
||||||
Configuration::EnumExceptionType exceptionType() const
|
Configuration::EnumExceptionType exceptionType() const
|
||||||
{
|
{
|
||||||
if( ui.windowClassCheckBox->isChecked() ) return Configuration::ExceptionWindowClassName;
|
if( windowClassCheckBox->isChecked() ) return Configuration::ExceptionWindowClassName;
|
||||||
else if( ui.windowTitleCheckBox->isChecked() ) return Configuration::ExceptionWindowTitle;
|
else if( windowTitleCheckBox->isChecked() ) return Configuration::ExceptionWindowTitle;
|
||||||
else return Configuration::ExceptionWindowClassName;
|
else return Configuration::ExceptionWindowClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,14 +94,8 @@ namespace Oxygen
|
||||||
//! execute
|
//! execute
|
||||||
void executeDialog( void );
|
void executeDialog( void );
|
||||||
|
|
||||||
//! window machine
|
|
||||||
QString machine;
|
|
||||||
|
|
||||||
//! main widget
|
|
||||||
Ui_DetectWidget ui;
|
|
||||||
|
|
||||||
//! invisible dialog used to grab mouse
|
//! invisible dialog used to grab mouse
|
||||||
KDialog* _grabber;
|
QDialog* _grabber;
|
||||||
|
|
||||||
//! current window information
|
//! current window information
|
||||||
KWindowInfo _info;
|
KWindowInfo _info;
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>DetectWidget</class>
|
<class>OxygenDetectWidget</class>
|
||||||
<widget class="QWidget" name="DetectWidget">
|
<widget class="QDialog" name="OxygenDetectWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>331</width>
|
<width>400</width>
|
||||||
<height>183</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
@ -80,8 +83,51 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>OxygenDetectWidget</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>OxygenDetectWidget</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in a new issue