Fixed compilation against qt5/kf5
This commit is contained in:
parent
e261b3b20c
commit
d29a9c43c3
5 changed files with 114 additions and 94 deletions
|
@ -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} )
|
||||
|
|
|
@ -26,36 +26,19 @@
|
|||
|
||||
#include "oxygenshadowdemodialog.h"
|
||||
|
||||
#include <KCmdLineArgs>
|
||||
#include <KApplication>
|
||||
#include <KIcon>
|
||||
#include <KAboutData>
|
||||
#include <kdeversion.h>
|
||||
#include <QApplication>
|
||||
#include <QIcon>
|
||||
|
||||
#include <cassert>
|
||||
#include <KLocalizedString>
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -32,32 +32,25 @@
|
|||
|
||||
#include <KPushButton>
|
||||
#include <KFileDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
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" );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
#include "oxygenhelper.h"
|
||||
#include "oxygenshadowcache.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShadowDemo</class>
|
||||
<widget class="QWidget" name="ShadowDemo">
|
||||
<class>OxygenShadowDemoDialog</class>
|
||||
<widget class="QDialog" name="OxygenShadowDemoDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>492</width>
|
||||
<height>378</height>
|
||||
<width>535</width>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,1">
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,1,0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
|
@ -31,15 +34,25 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Oxygen::ShadowDemoWidget" name="inactiveRoundWidget" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Oxygen::ShadowDemoWidget" name="activeRoundWidget" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="Oxygen::ShadowDemoWidget" name="inactiveSquareWidget" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Oxygen::ShadowDemoWidget" name="activeRoundWidget" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Oxygen::ShadowDemoWidget" name="activeSquareWidget" native="true"/>
|
||||
</item>
|
||||
|
@ -54,5 +67,38 @@
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>OxygenShadowDemoDialog</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>OxygenShadowDemoDialog</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>
|
||||
|
|
Loading…
Reference in a new issue