diff --git a/kdeui/CMakeLists.txt b/kdeui/CMakeLists.txt index 9bb8fe32f3..d3651e6521 100644 --- a/kdeui/CMakeLists.txt +++ b/kdeui/CMakeLists.txt @@ -1,519 +1,521 @@ project(kdeui) include_directories( ${CMAKE_SOURCE_DIR}/interfaces ${CMAKE_SOURCE_DIR}/interfaces/kregexpeditor ${CMAKE_SOURCE_DIR}/kdecore/sonnet ${CMAKE_SOURCE_DIR}/kdeui ${KDE4_KDECORE_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/actions ${CMAKE_CURRENT_SOURCE_DIR}/colors ${CMAKE_CURRENT_SOURCE_DIR}/config ${CMAKE_CURRENT_SOURCE_DIR}/dialogs ${CMAKE_CURRENT_SOURCE_DIR}/findreplace ${CMAKE_CURRENT_SOURCE_DIR}/fonts ${CMAKE_CURRENT_SOURCE_DIR}/icons ${CMAKE_CURRENT_SOURCE_DIR}/itemviews ${CMAKE_CURRENT_SOURCE_DIR}/jobs ${CMAKE_CURRENT_SOURCE_DIR}/kernel ${CMAKE_CURRENT_SOURCE_DIR}/paged ${CMAKE_CURRENT_SOURCE_DIR}/plotting ${CMAKE_CURRENT_SOURCE_DIR}/shortcuts ${CMAKE_CURRENT_SOURCE_DIR}/sonnet ${CMAKE_CURRENT_SOURCE_DIR}/util ${CMAKE_CURRENT_SOURCE_DIR}/widgets ${CMAKE_CURRENT_SOURCE_DIR}/windowmanagement ${CMAKE_CURRENT_SOURCE_DIR}/xmlgui ) add_subdirectory( about ) add_subdirectory( tests ) add_subdirectory( sonnet/tests ) ########### next target ############### set(kdeui_LIB_SRCS actions/kactioncollection.cpp actions/kaction.cpp actions/kactionmenu.cpp actions/kcodecaction.cpp actions/kfontaction.cpp actions/kfontsizeaction.cpp actions/kpastetextaction.cpp actions/krecentfilesaction.cpp actions/kselectaction.cpp actions/kstandardaction.cpp actions/ktoggleaction.cpp actions/ktoggletoolbaraction.cpp actions/ktogglefullscreenaction.cpp actions/ktoolbarlabelaction.cpp actions/ktoolbarpopupaction.cpp actions/ktoolbarspaceraction.cpp colors/kcolorspaces.cpp colors/kcolorutils.cpp colors/kcolorscheme.cpp colors/kcolorcollection.cpp colors/kcolorbutton.cpp colors/kcolorcombo.cpp colors/kcolordialog.cpp colors/kcolormimedata.cpp colors/kcolorvalueselector.cpp colors/khuesaturationselect.cpp config/kconfigskeleton.cpp config/kconfiggroupgui.cpp dialogs/kaboutkdedialog_p.cpp dialogs/kassistantdialog.cpp dialogs/kconfigdialog.cpp dialogs/kconfigdialogmanager.cpp dialogs/kbugreport.cpp dialogs/kdeprintdialog.cpp dialogs/kdialog.cpp dialogs/kedittoolbar.cpp dialogs/kinputdialog.cpp dialogs/kmessagebox.cpp dialogs/kmessageboxmessagehandler.cpp dialogs/kaboutapplicationdialog.cpp dialogs/knewpassworddialog.cpp dialogs/kpassworddialog.cpp dialogs/kpixmapregionselectordialog.cpp dialogs/kprogressdialog.cpp dialogs/kshortcutsdialog.cpp dialogs/ksplashscreen.cpp dialogs/kswitchlanguagedialog_p.cpp dialogs/ktip.cpp findreplace/kfind.cpp findreplace/kreplace.cpp findreplace/kfinddialog.cpp findreplace/kreplacedialog.cpp fonts/kfontchooser.cpp fonts/kfontdialog.cpp fonts/kfontrequester.cpp icons/kiconeffect.cpp icons/kiconengine.cpp icons/kicon.cpp icons/kiconloader.cpp icons/kicontheme.cpp icons/kiconcache.cpp icons/kpixmapcache.cpp itemviews/klistwidget.cpp itemviews/klistwidgetsearchline.cpp itemviews/ktreewidgetsearchline.cpp itemviews/kextendableitemdelegate.cpp itemviews/kcategorizedsortfilterproxymodel.cpp itemviews/kcategorizedview.cpp itemviews/kcategorydrawer.cpp jobs/kdialogjobuidelegate.cpp jobs/kabstractwidgetjobtracker.cpp jobs/kwidgetjobtracker.cpp jobs/kstatusbarjobtracker.cpp jobs/kuiserverjobtracker.cpp kernel/kapplication.cpp kernel/kclipboard.cpp kernel/kuniqueapplication.cpp kernel/ksessionmanager.cpp kernel/kstyle.cpp kernel/kstartupinfo.cpp kernel/kglobalsettings.cpp paged/kpagedialog.cpp paged/kpagemodel.cpp paged/kpageview.cpp paged/kpageview_p.cpp paged/kpagewidget.cpp paged/kpagewidgetmodel.cpp plotting/kplotaxis.cpp plotting/kplotpoint.cpp plotting/kplotobject.cpp plotting/kplotwidget.cpp shortcuts/kshortcut.cpp shortcuts/kstandardshortcut.cpp shortcuts/kglobalaccel.cpp shortcuts/kacceleratormanager.cpp shortcuts/kcheckaccelerators.cpp shortcuts/kgesture.cpp shortcuts/kgesturemap.cpp sonnet/dialog.cpp sonnet/configwidget.cpp sonnet/highlighter.cpp sonnet/configdialog.cpp util/kckey.cpp util/kcompletion.cpp util/kcompletionbase.cpp util/kcrash.cpp util/kcursor.cpp util/kguiitem.cpp util/kkeyserver.cpp util/kmanagerselection.cpp util/knotification.cpp util/knotificationmanager.cpp util/knotificationrestrictions.cpp util/knumvalidator.cpp util/kpassivepopup.cpp util/kpassivepopupmessagehandler.cpp util/kpixmapprovider.cpp util/kstandardguiitem.cpp util/ksvgrenderer.cpp util/ksystemtrayicon.cpp util/kwallet.cpp util/kwhatsthismanager.cpp util/kwordwrap.cpp util/kxerrorhandler.cpp util/kxmessages.cpp util/kundostack.cpp widgets/kactionselector.cpp widgets/kanimatedbutton.cpp widgets/karrowbutton.cpp widgets/kdialogbuttonbox.cpp widgets/kbuttongroup.cpp widgets/kcharselect.cpp widgets/kcharselectdata.cpp widgets/kcmodule.cpp widgets/kcombobox.cpp widgets/kcompletionbox.cpp widgets/kdatepicker.cpp widgets/kdatetable.cpp widgets/kdatetimewidget.cpp widgets/kdatewidget.cpp widgets/keditlistbox.cpp + widgets/kfadewidgeteffect.cpp widgets/khbox.cpp widgets/khelpmenu.cpp widgets/khistorycombobox.cpp widgets/kkeysequencewidget.cpp widgets/klanguagebutton.cpp widgets/kled.cpp widgets/klineedit.cpp widgets/kmainwindow.cpp widgets/kmenu.cpp widgets/kmenubar.cpp widgets/kmultitabbar.cpp widgets/knuminput.cpp widgets/kpixmapregionselectorwidget.cpp widgets/kpushbutton.cpp widgets/krestrictedline.cpp widgets/kruler.cpp widgets/kselector.cpp widgets/kseparator.cpp widgets/kshortcutwidget.cpp widgets/ksqueezedtextlabel.cpp widgets/kstatusbar.cpp widgets/kstringvalidator.cpp widgets/ktabbar.cpp widgets/ktabwidget.cpp widgets/ktextbrowser.cpp widgets/ktextedit.cpp widgets/ktimezonewidget.cpp widgets/ktitlewidget.cpp widgets/ktoolbar.cpp widgets/kurllabel.cpp widgets/kvbox.cpp widgets/kxyselector.cpp widgets/kdeuiwidgetsproxystyle.cpp xmlgui/kxmlguibuilder.cpp xmlgui/kxmlguiwindow.cpp xmlgui/kmainwindowiface.cpp xmlgui/kmenumenuhandler_p.cpp xmlgui/ktoolbarhandler.cpp xmlgui/kxmlguiclient.cpp xmlgui/kxmlguifactory.cpp xmlgui/kxmlguifactory_p.cpp xmlgui/kxmlguiversionhandler.cpp ) if (Q_WS_X11) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_x11.cpp ) endif (Q_WS_X11) if (Q_WS_MAC) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_mac.cpp ) endif (Q_WS_MAC) if (Q_WS_WIN) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} kernel/kapplication_win.cpp ) endif (Q_WS_WIN) if (Q_WS_X11) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} windowmanagement/kwindowsystem_x11.cpp windowmanagement/kwindowinfo_x11.cpp windowmanagement/netwm.cpp ) endif (Q_WS_X11) if (Q_WS_MAC) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} windowmanagement/kwindowsystem_mac.cpp ) endif (Q_WS_MAC) if (Q_WS_WIN) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} windowmanagement/kwindowsystem_win.cpp) endif (Q_WS_WIN) if (Q_WS_QWS) set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} windowmanagement/kwindowsystem_qws.cpp) endif (Q_WS_QWS) if(MINGW) add_definitions(-D_WIN32_WINNT=0x0500 -DWINVER=0x0500) endif(MINGW) set( kdeui_UI dialogs/kpassworddialog.ui dialogs/knewpassworddialog.ui dialogs/kshortcutsdialog.ui widgets/kshortcutwidget.ui sonnet/sonnetui.ui sonnet/configui.ui ) kde4_add_ui_files(kdeui_LIB_SRCS ${kdeui_UI} ) set(kwallet_adaptor ${CMAKE_SOURCE_DIR}/kio/misc/kwalletd/kwalletdadaptor.h) set(kwallet_xml ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KWallet.xml) qt4_generate_dbus_interface( ${kwallet_adaptor} org.kde.KWallet.xml ) install(FILES ${kwallet_xml} DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) qt4_add_dbus_interface( kdeui_LIB_SRCS ${kwallet_xml} kwallet_interface ) qt4_add_dbus_interfaces(kdeui_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/jobs/org.kde.UiServer.xml ) qt4_add_dbus_adaptor(kdeui_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/jobs/org.kde.UiServerCallbacks.xml kuiserverjobtracker_p.h KSharedUiServerProxy uiservercallbacks ) kde4_add_library(kdeui SHARED ${kdeui_LIB_SRCS}) target_link_libraries(kdeui ${QT_QTSVG_LIBRARY} ${KDE4_KDECORE_LIBS} ${X11_LIBRARIES} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} ) if(MINGW) target_link_libraries(kdeui gdi32) endif(MINGW) if(X11_XTest_FOUND) target_link_libraries(kdeui ${X11_XTest_LIB}) endif(X11_XTest_FOUND) if(X11_Xcursor_FOUND) target_link_libraries(kdeui ${X11_Xcursor_LIB}) endif(X11_Xcursor_FOUND) if (X11_Xfixes_FOUND) target_link_libraries(kdeui ${X11_Xfixes_LIB}) endif(X11_Xfixes_FOUND) set_target_properties(kdeui PROPERTIES VERSION ${KDE_NON_GENERIC_LIB_VERSION} SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION} ) install(TARGETS kdeui DESTINATION ${LIB_INSTALL_DIR}) ########### install files ############### if (Q_WS_MAC) install( FILES util/kkeyserver_mac.h DESTINATION ${INCLUDE_INSTALL_DIR} ) else (Q_WS_MAC) # maybe these shouldn't be installed on windows? they have been so far, so leaving it this way for now install( FILES util/fixx11h.h util/kkeyserver_x11.h DESTINATION ${INCLUDE_INSTALL_DIR} ) endif (Q_WS_MAC) install( FILES dialogs/aboutkde.png dialogs/ktip-bulb.png DESTINATION ${DATA_INSTALL_DIR}/kdeui/pics ) install( FILES widgets/kcharselect-data DESTINATION ${DATA_INSTALL_DIR}/kcharselect ) install( FILES xmlgui/ui_standards.rc DESTINATION ${CONFIG_INSTALL_DIR}/ui ) install( FILES kdeui_export.h actions/kactioncollection.h actions/kaction.h actions/kactionmenu.h actions/kcodecaction.h actions/kfontaction.h actions/kfontsizeaction.h actions/kpastetextaction.h actions/krecentfilesaction.h actions/kselectaction.h actions/kstandardaction.h actions/ktoggleaction.h actions/ktoggletoolbaraction.h actions/ktogglefullscreenaction.h actions/ktoolbarlabelaction.h actions/ktoolbarpopupaction.h actions/ktoolbarspaceraction.h colors/kcolorutils.h colors/kcolorscheme.h colors/kcolorcollection.h colors/kcolorbutton.h colors/kcolorchoosermode.h colors/kcolorcombo.h colors/kcolordialog.h colors/kcolormimedata.h colors/kcolorvalueselector.h colors/khuesaturationselect.h config/kconfigskeleton.h dialogs/kaboutapplicationdialog.h dialogs/kassistantdialog.h dialogs/kbugreport.h dialogs/kconfigdialog.h dialogs/kconfigdialogmanager.h dialogs/kdeprintdialog.h dialogs/kdialog.h dialogs/kedittoolbar.h dialogs/kinputdialog.h dialogs/kmessagebox.h dialogs/kmessageboxmessagehandler.h dialogs/knewpassworddialog.h dialogs/kpassworddialog.h dialogs/kpixmapregionselectordialog.h dialogs/kprogressdialog.h dialogs/ksplashscreen.h dialogs/kshortcutsdialog.h dialogs/kshortcutseditor.h dialogs/ktip.h findreplace/kfind.h findreplace/kreplace.h findreplace/kfinddialog.h findreplace/kreplacedialog.h fonts/kfontchooser.h fonts/kfontdialog.h fonts/kfontrequester.h icons/kiconeffect.h icons/kicon.h icons/k3icon_p.h # we install the private header as it is needed by kcm (tokoe) icons/kiconloader.h icons/kicontheme.h icons/kiconcache.h icons/kpixmapcache.h itemviews/klistwidget.h itemviews/klistwidgetsearchline.h itemviews/ktreewidgetsearchline.h itemviews/kextendableitemdelegate.h itemviews/kcategorizedsortfilterproxymodel.h itemviews/kcategorizedview.h itemviews/kcategorydrawer.h jobs/kdialogjobuidelegate.h jobs/kabstractwidgetjobtracker.h jobs/kwidgetjobtracker.h jobs/kstatusbarjobtracker.h jobs/kuiserverjobtracker.h kernel/kapplication.h kernel/kuniqueapplication.h kernel/ksessionmanager.h kernel/kstyle.h kernel/kstartupinfo.h kernel/kglobalsettings.h paged/kpagedialog.h paged/kpagemodel.h paged/kpageview.h paged/kpagewidget.h paged/kpagewidgetmodel.h plotting/kplotwidget.h plotting/kplotpoint.h plotting/kplotobject.h plotting/kplotaxis.h shortcuts/kshortcut.h shortcuts/kstandardshortcut.h shortcuts/kglobalaccel.h shortcuts/kacceleratormanager.h shortcuts/kgesture.h util/kaccelgen.h util/kcompletion.h util/kcrash.h util/kcursor.h util/kguiitem.h util/kkeyserver.h util/kmanagerselection.h util/knotification.h util/knotificationrestrictions.h util/knumvalidator.h util/kpassivepopup.h util/kpassivepopupmessagehandler.h util/kpixmapprovider.h util/kstandardguiitem.h util/ksvgrenderer.h util/ksystemtrayicon.h util/kwallet.h util/kwordwrap.h util/kxerrorhandler.h util/kxmessages.h util/kundostack.h widgets/kactionselector.h widgets/kanimatedbutton.h widgets/karrowbutton.h widgets/kdatepicker.h widgets/kcmodule.h widgets/kcombobox.h widgets/kcompletionbox.h widgets/kbuttongroup.h widgets/kcharselect.h widgets/kdatetable.h widgets/kdatetimewidget.h widgets/kdatewidget.h widgets/kdialogbuttonbox.h widgets/keditlistbox.h + widgets/kfadewidgeteffect.h widgets/khbox.h widgets/khelpmenu.h widgets/khistorycombobox.h widgets/kkeysequencewidget.h widgets/klanguagebutton.h widgets/kled.h widgets/klineedit.h widgets/kmainwindow.h widgets/kmenu.h widgets/kmenubar.h widgets/kmultitabbar.h widgets/knuminput.h widgets/kpixmapregionselectorwidget.h widgets/kpushbutton.h widgets/krestrictedline.h widgets/kseparator.h widgets/ksqueezedtextlabel.h widgets/kstringvalidator.h widgets/ktextbrowser.h widgets/ktextedit.h widgets/ktimezonewidget.h widgets/ktitlewidget.h widgets/ktabbar.h widgets/ktabwidget.h widgets/kruler.h widgets/kselector.h widgets/kshortcutwidget.h widgets/kstatusbar.h widgets/ktoolbar.h widgets/kurllabel.h widgets/kvbox.h widgets/kxyselector.h windowmanagement/kwindowsystem.h windowmanagement/kwindowinfo.h windowmanagement/netwm_def.h windowmanagement/netwm.h xmlgui/kxmlguiwindow.h xmlgui/kxmlguiclient.h xmlgui/kxmlguibuilder.h xmlgui/kxmlguifactory.h DESTINATION ${INCLUDE_INSTALL_DIR}) install( FILES sonnet/dialog.h sonnet/highlighter.h sonnet/configdialog.h sonnet/configwidget.h DESTINATION ${INCLUDE_INSTALL_DIR}/sonnet ) install(PROGRAMS preparetips DESTINATION ${BIN_INSTALL_DIR} ) if (Q_WS_MAC) install(PROGRAMS kernel/start-session-bus.sh DESTINATION ${BIN_INSTALL_DIR} ) endif (Q_WS_MAC) install( FILES colors/40.colors colors/Oxygen.colors colors/Web.colors colors/Royal.colors colors/Rainbow.colors DESTINATION ${CONFIG_INSTALL_DIR}/colors) set( kded_globalaccel_SRCS shortcuts/kdedglobalaccel.cpp ) if ( Q_WS_X11 ) set( kded_globalaccel_SRCS ${kded_globalaccel_SRCS} shortcuts/kglobalaccel_x11.cpp ) endif ( Q_WS_X11 ) if ( Q_WS_MAC ) set( kded_globalaccel_SRCS ${kded_globalaccel_SRCS} shortcuts/kglobalaccel_mac.cpp ) endif ( Q_WS_MAC ) if ( Q_WS_WIN ) set( kded_globalaccel_SRCS ${kded_globalaccel_SRCS} shortcuts/kglobalaccel_win.cpp ) endif ( Q_WS_WIN ) if ( Q_WS_QWS ) set( kded_globalaccel_SRCS ${kded_globalaccel_SRCS} shortcuts/kglobalaccel_qws.cpp ) endif ( Q_WS_QWS ) kde4_add_plugin( kded_globalaccel ${kded_globalaccel_SRCS} ) target_link_libraries(kded_globalaccel ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ) install( TARGETS kded_globalaccel DESTINATION ${PLUGIN_INSTALL_DIR} ) install( FILES shortcuts/kdedglobalaccel.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) install( FILES jobs/org.kde.UiServer.xml jobs/org.kde.UiServerCallbacks.xml shortcuts/org.kde.KdedGlobalAccel.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) diff --git a/kdeui/widgets/kfadewidgeteffect.cpp b/kdeui/widgets/kfadewidgeteffect.cpp new file mode 100644 index 0000000000..2390e44e25 --- /dev/null +++ b/kdeui/widgets/kfadewidgeteffect.cpp @@ -0,0 +1,75 @@ +/* This file is part of the KDE project + Copyright (C) 2008 Matthias Kretz + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) version 3. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ + +#include "kfadewidgeteffect.h" +#include "kfadewidgeteffect_p.h" +#include +#include + +KFadeWidgetEffectPrivate::KFadeWidgetEffectPrivate(QWidget *_destWidget) + : destWidget(_destWidget) +{ +} + +KFadeWidgetEffect::KFadeWidgetEffect(QWidget *destWidget) + : QWidget(destWidget ? destWidget->parentWidget() : 0), + d_ptr(new KFadeWidgetEffectPrivate(destWidget)) +{ + Q_D(KFadeWidgetEffect); + d->q_ptr = this; + Q_ASSERT(destWidget && destWidget->parentWidget()); + setGeometry(QRect(destWidget->mapTo(parentWidget(), QPoint(0, 0)), destWidget->size())); + d->oldPixmap = QPixmap::grabWidget(destWidget); + d->timeLine.setFrameRange(0, 255); + connect(&d->timeLine, SIGNAL(finished()), SLOT(finished())); + connect(&d->timeLine, SIGNAL(frameChanged(int)), SLOT(repaint())); + show(); +} + +KFadeWidgetEffect::~KFadeWidgetEffect() +{ + delete d_ptr; +} + +void KFadeWidgetEffectPrivate::finished() +{ + Q_Q(KFadeWidgetEffect); + destWidget->setUpdatesEnabled(false); + q->hide(); + q->deleteLater(); + destWidget->setUpdatesEnabled(true); +} + +void KFadeWidgetEffect::start(int duration) +{ + Q_D(KFadeWidgetEffect); + d->timeLine.setDuration(duration); + d->timeLine.start(); +} + +void KFadeWidgetEffect::paintEvent(QPaintEvent *) +{ + Q_D(KFadeWidgetEffect); + QPainter p(this); + p.setOpacity(1.0 - d->timeLine.currentValue()); + p.drawPixmap(rect(), d->oldPixmap); +} + +#include "moc_kfadewidgeteffect.cpp" diff --git a/kdeui/widgets/kfadewidgeteffect.h b/kdeui/widgets/kfadewidgeteffect.h new file mode 100644 index 0000000000..717aa4d671 --- /dev/null +++ b/kdeui/widgets/kfadewidgeteffect.h @@ -0,0 +1,92 @@ +/* This file is part of the KDE project + Copyright (C) 2008 Matthias Kretz + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) version 3. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ + +#ifndef KFADEWIDGETEFFECT_H +#define KFADEWIDGETEFFECT_H + +#include +#include + +class KFadeWidgetEffectPrivate; + +/** \class KFadeWidgetEffect kfadewidgeteffect.h KFadeWidgetEffect + * \brief Animates changes fading the new UI over the old look. + * + * This widget will put itself above the widget that will change and show a fading transition from + * the old to the new UI. It will delete itself after the animation is finished. + * Example: + * \code + * KFadeWidgetEffect *animation = new KFadeWidgetEffect(widgetThatWillChange); + * // do changes on widgetThatWillChange + * // ... + * animation->start(); + * \endcode + * + * \note The widget that changes needs to have a parent widget. KFadeWidgetEffect does not work + * for toplevel widgets (windows). + * + * \author Matthias Kretz + * \since 4.1 + */ +class KDEUI_EXPORT KFadeWidgetEffect : public QWidget +{ + Q_OBJECT + Q_DECLARE_PRIVATE(KFadeWidgetEffect) + public: + /** + * Create the animation widget. Takes a snapshot of the \p destWidget to use as old image + * that gets faded out. + * + * \param destWidget The widget that will change and should fade to the new look. + */ + KFadeWidgetEffect(QWidget *destWidget); + + /** + * Destructor. + * + * \warning KFadeWidgetEffect deletes itself after the animation is finished. + */ + ~KFadeWidgetEffect(); + + /** + * Starts the animation. + * + * Call this function after all visual changes are done. + * + * \param duration The duration of the animation in milliseconds. + */ + void start(int duration = 250); + + protected: + /** + * \internal + */ + void paintEvent(QPaintEvent *); + + /** + * \internal + */ + KFadeWidgetEffectPrivate *const d_ptr; + + private: + Q_PRIVATE_SLOT(d_func(), void finished()) +}; + +#endif // KFADEWIDGETEFFECT_H diff --git a/kdeui/widgets/kfadewidgeteffect_p.h b/kdeui/widgets/kfadewidgeteffect_p.h new file mode 100644 index 0000000000..9842a517a1 --- /dev/null +++ b/kdeui/widgets/kfadewidgeteffect_p.h @@ -0,0 +1,44 @@ +/* This file is part of the KDE project + Copyright (C) 2008 Matthias Kretz + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) version 3. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ + +#ifndef KFADEWIDGETEFFECT_P_H +#define KFADEWIDGETEFFECT_P_H + +#include "kfadewidgeteffect.h" + +#include +#include + +class KFadeWidgetEffectPrivate +{ + Q_DECLARE_PUBLIC(KFadeWidgetEffect) + protected: + KFadeWidgetEffectPrivate(QWidget *_destWidget); + KFadeWidgetEffect *q_ptr; + + private: + void finished(); + + QTimeLine timeLine; + QPixmap oldPixmap; + QWidget *destWidget; +}; + +#endif // KFADEWIDGETEFFECT_P_H