From d29a9c43c37cc1b557e5b9837089375b5a79a814 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 1 Aug 2013 20:19:37 +0200 Subject: [PATCH] Fixed compilation against qt5/kf5 --- clients/oxygen/demo/CMakeLists.txt | 38 +++++++---- clients/oxygen/demo/main.cpp | 29 ++------ .../oxygen/demo/oxygenshadowdemodialog.cpp | 67 +++++++------------ clients/oxygen/demo/oxygenshadowdemodialog.h | 10 +-- clients/oxygen/demo/ui/oxygenshadowdemo.ui | 64 +++++++++++++++--- 5 files changed, 114 insertions(+), 94 deletions(-) diff --git a/clients/oxygen/demo/CMakeLists.txt b/clients/oxygen/demo/CMakeLists.txt index 340c1c70e0..ea0163903d 100644 --- a/clients/oxygen/demo/CMakeLists.txt +++ b/clients/oxygen/demo/CMakeLists.txt @@ -3,24 +3,36 @@ include_directories( ${KDE4_KDEUI_INCLUDES} ) ########### next target ############### -set( oxygen_shadow_demo_SOURCES +set(oxygen_shadow_demo_SOURCES oxygenshadowdemodialog.cpp oxygenshadowdemowidget.cpp main.cpp) -kde4_add_ui_files(oxygen_shadow_demo_SOURCES - ui/oxygenshadowdemo.ui +set(oxygen_shadow_demo_FORMS ui/oxygenshadowdemo.ui) + +qt5_wrap_ui(oxygen_shadow_demo_FORMS_HEADERS ${oxygen_shadow_demo_FORMS} ) + +add_executable(oxygen-shadow-demo + ${oxygen_shadow_demo_SOURCES} + ${oxygen_shadow_demo_FORMS_HEADERS} ) -kde4_add_executable( oxygen-shadow-demo ${oxygen_shadow_demo_SOURCES} ) +target_link_libraries(oxygen-shadow-demo + Qt5::Core + Qt5::Gui + Qt5::Widgets + Qt5::DBus +) -target_link_libraries( oxygen-shadow-demo - ${KDE4_KDEUI_LIBS} - ${X11_X11_LIB} - ${X11_Xrender_LIB} - ${KDE4_KIO_LIBS} - oxygenstyle - ) +target_link_libraries(oxygen-shadow-demo + ${KWidgets_LIBRARIES} + ${KI18n_LIBRARIES} +) -########### install files ############### -install (TARGETS oxygen-shadow-demo ${INSTALL_TARGETS_DEFAULT_ARGS} ) +target_link_libraries(oxygen-shadow-demo oxygenstyle ) + +if(X11_FOUND) + target_link_libraries(oxygen-shadow-demo ${X11_LIBRARIES} ) +endif() + +install(TARGETS oxygen-shadow-demo ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff --git a/clients/oxygen/demo/main.cpp b/clients/oxygen/demo/main.cpp index c28068825e..c60a0bbafc 100644 --- a/clients/oxygen/demo/main.cpp +++ b/clients/oxygen/demo/main.cpp @@ -26,36 +26,19 @@ #include "oxygenshadowdemodialog.h" -#include -#include -#include -#include -#include +#include +#include -#include +#include int main(int argc, char *argv[]) { - KAboutData aboutData( - "oxygen-shadow-demo", - "kstyle_config", - ki18n( "Oxygen Shadow Demo" ), - KDE_VERSION_STRING, - ki18n( "Oxygen decoration shadows demonstration" ), - KAboutData::License_GPL_V2, - ki18n( "(c) 2011, Hugo Pereira Da Costa" )); - aboutData.addAuthor( ki18n( "Hugo Pereira Da Costa" ),KLocalizedString(), "hugo@oxygen-icons.org" ); - - KCmdLineArgs::init( argc, argv, &aboutData ); - KApplication app; - - app.setWindowIcon( KIcon( "oxygen" ) ); - - // create dialog + QApplication app( argc, argv ); + app.setApplicationName( i18n( "Oxygen Shadow Demo" ) ); + app.setWindowIcon( QIcon::fromTheme( QStringLiteral( "oxygen" ) ) ); Oxygen::ShadowDemoDialog dialog; dialog.show(); - bool result = app.exec(); return result; diff --git a/clients/oxygen/demo/oxygenshadowdemodialog.cpp b/clients/oxygen/demo/oxygenshadowdemodialog.cpp index e4c4e6be8e..c5f2e4ea05 100644 --- a/clients/oxygen/demo/oxygenshadowdemodialog.cpp +++ b/clients/oxygen/demo/oxygenshadowdemodialog.cpp @@ -32,32 +32,25 @@ #include #include +#include namespace Oxygen { //_________________________________________________________ ShadowDemoDialog::ShadowDemoDialog( QWidget* parent ): - KDialog( parent ), - _helper( "oxygen" ), + QDialog( parent ), + _helper(), _cache( _helper ) { setWindowTitle( i18n( "Oxygen Shadow Demo" ) ); + setupUi( this ); - setButtons( KDialog::Cancel|KDialog::Apply ); - button( KDialog::Apply )->setText( i18n("Save") ); - button( KDialog::Apply )->setIcon( KIcon("document-save-as") ); - button( KDialog::Apply )->setToolTip( i18n( "Save shadows as pixmaps in provided directory" ) ); - - QWidget *mainWidget( new QWidget( this ) ); - ui.setupUi( mainWidget ); - setMainWidget( mainWidget ); - - ui.inactiveRoundWidget->setHelper( _helper ); - ui.inactiveSquareWidget->setHelper( _helper ); - ui.activeRoundWidget->setHelper( _helper ); - ui.activeSquareWidget->setHelper( _helper ); + inactiveRoundWidget->setHelper( _helper ); + inactiveSquareWidget->setHelper( _helper ); + activeRoundWidget->setHelper( _helper ); + activeSquareWidget->setHelper( _helper ); // reparse configuration reparseConfiguration(); @@ -72,19 +65,19 @@ namespace Oxygen _backgroundCheckBox->setChecked( true ); buttonBox->addButton( _backgroundCheckBox, QDialogButtonBox::ResetRole ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), ui.inactiveRoundWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), ui.inactiveSquareWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), ui.activeRoundWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), ui.activeSquareWidget, SLOT(toggleBackground(bool)) ); + connect( _backgroundCheckBox, SIGNAL(toggled(bool)), inactiveRoundWidget, SLOT(toggleBackground(bool)) ); + connect( _backgroundCheckBox, SIGNAL(toggled(bool)), inactiveSquareWidget, SLOT(toggleBackground(bool)) ); + connect( _backgroundCheckBox, SIGNAL(toggled(bool)), activeRoundWidget, SLOT(toggleBackground(bool)) ); + connect( _backgroundCheckBox, SIGNAL(toggled(bool)), activeSquareWidget, SLOT(toggleBackground(bool)) ); } - // connections - connect( button( KDialog::Apply ), SIGNAL(clicked()), SLOT(save()) ); - // use DBus connection to update on oxygen configuration change QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.connect( QString(), "/OxygenWindeco", "org.kde.Oxygen.Style", "reparseConfiguration", this, SLOT(reparseConfiguration()) ); + dbus.connect( QString(), + QStringLiteral( "/OxygenWindeco" ), + QStringLiteral( "org.kde.Oxygen.Style" ), + QStringLiteral( "reparseConfiguration" ), this, SLOT(reparseConfiguration()) ); } @@ -100,34 +93,26 @@ namespace Oxygen ShadowCache::Key key; key.active = false; key.hasBorder = true; - ui.inactiveRoundWidget->setTileSet( *_cache.tileSet( key ) ); - ui.inactiveRoundWidget->setShadowSize( _cache.shadowSize() ); + inactiveRoundWidget->setTileSet( *_cache.tileSet( key ) ); + inactiveRoundWidget->setShadowSize( _cache.shadowSize() ); key.active = false; key.hasBorder = false; - ui.inactiveSquareWidget->setTileSet( *_cache.tileSet( key ) ); - ui.inactiveSquareWidget->setShadowSize( _cache.shadowSize() ); - ui.inactiveSquareWidget->setSquare( true ); + inactiveSquareWidget->setTileSet( *_cache.tileSet( key ) ); + inactiveSquareWidget->setShadowSize( _cache.shadowSize() ); + inactiveSquareWidget->setSquare( true ); key.active = true; key.hasBorder = true; - ui.activeRoundWidget->setTileSet( *_cache.tileSet( key ) ); - ui.activeRoundWidget->setShadowSize( _cache.shadowSize() ); + activeRoundWidget->setTileSet( *_cache.tileSet( key ) ); + activeRoundWidget->setShadowSize( _cache.shadowSize() ); key.active = true; key.hasBorder = false; - ui.activeSquareWidget->setTileSet( *_cache.tileSet( key ) ); - ui.activeSquareWidget->setShadowSize( _cache.shadowSize() ); - ui.activeSquareWidget->setSquare( true ); + activeSquareWidget->setTileSet( *_cache.tileSet( key ) ); + activeSquareWidget->setShadowSize( _cache.shadowSize() ); + activeSquareWidget->setSquare( true ); } - //_________________________________________________________ - void ShadowDemoDialog::save( void ) - { - - QString dir( KFileDialog::getExistingDirectory() ); - ui.inactiveRoundWidget->tileSet().save( dir + "/shadow" ); - - } } diff --git a/clients/oxygen/demo/oxygenshadowdemodialog.h b/clients/oxygen/demo/oxygenshadowdemodialog.h index de50c32834..0b290f762b 100644 --- a/clients/oxygen/demo/oxygenshadowdemodialog.h +++ b/clients/oxygen/demo/oxygenshadowdemodialog.h @@ -31,12 +31,12 @@ #include "oxygenhelper.h" #include "oxygenshadowcache.h" -#include #include +#include namespace Oxygen { - class ShadowDemoDialog: public KDialog + class ShadowDemoDialog: public QDialog, Ui::OxygenShadowDemoDialog { Q_OBJECT @@ -55,14 +55,8 @@ namespace Oxygen //! reparse configuration void reparseConfiguration( void ); - //! save - void save( void ); - private: - //! ui - Ui_ShadowDemo ui; - //! helper Helper _helper; diff --git a/clients/oxygen/demo/ui/oxygenshadowdemo.ui b/clients/oxygen/demo/ui/oxygenshadowdemo.ui index cad06cee3a..e8f16e774f 100644 --- a/clients/oxygen/demo/ui/oxygenshadowdemo.ui +++ b/clients/oxygen/demo/ui/oxygenshadowdemo.ui @@ -1,16 +1,19 @@ - ShadowDemo - + OxygenShadowDemoDialog + 0 0 - 492 - 378 + 535 + 466 - + + Dialog + + @@ -31,15 +34,25 @@ + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + - - - + + + @@ -54,5 +67,38 @@ - + + + buttonBox + accepted() + OxygenShadowDemoDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + OxygenShadowDemoDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + +