dialog.h | dialog.h | |||
---|---|---|---|---|
// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- | ||||
/* | /* | |||
* dialog.h | * Copyright 2008 by Alessandro Diaferia <alediaferia@gmail.com> | |||
* | * Copyright 2007 by Alexis Ménard <darktears31@gmail.com> | |||
* Copyright (C) 2003 Zack Rusin <zack@kde.org> | * Copyright 2007 Sebastian Kuegler <sebas@kde.org> | |||
* Copyright (C) 2009-2010 Michel Ludwig <michel.ludwig@kdemail.net> | * Copyright 2006 Aaron Seigo <aseigo@kde.org> | |||
* | * | |||
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | * modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | * License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | * version 2.1 of the License, or (at your option) any later version. | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | * Foundation, Inc., 51 Franklin St, Fifth Floor, | |||
* 02110-1301 USA | * Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef SONNET_DIALOG_H | ||||
#define SONNET_DIALOG_H | ||||
#include <kdialog.h> | #ifndef PLASMA_DIALOG_H | |||
#define PLASMA_DIALOG_H | ||||
#include <QtGui/QWidget> | ||||
#include <QtGui/QGraphicsSceneEvent> | ||||
#include <QtGui/QGraphicsView> | ||||
class QListWidgetItem; | #include <plasma/plasma_export.h> | |||
class QModelIndex; | #include <plasma/plasma.h> | |||
namespace Sonnet | namespace Plasma | |||
{ | { | |||
class BackgroundChecker; | ||||
/** | class DialogPrivate; | |||
* @short Spellcheck dialog | ||||
* | /** | |||
* \code | * @class Dialog plasma/dialog.h <Plasma/Dialog> | |||
* Sonnet::Dialog dlg = new Sonnet::Dialog( | * | |||
* new Sonnet::BackgroundChecker(this), this); | * @short A dialog that uses the Plasma style | |||
* //connect signals | * | |||
* ... | * Dialog provides a dialog-like widget that can be used to display additio | |||
* dlg->setBuffer( someText ); | nal | |||
* dlg->show(); | * information. | |||
* \endcode | * | |||
* | * Dialog uses the plasma theme, and usually has no window decoration. It's | |||
* You can change buffer inside a slot connected to done() signal | meant | |||
* and spellcheck will continue with new data automatically. | * as an interim solution to display widgets as extension to plasma applets | |||
*/ | , for | |||
class KDEUI_EXPORT Dialog : public KDialog | * example when you click on an applet like the devicenotifier or the clock | |||
{ | , the | |||
Q_OBJECT | * widget that is then displayed, is a Dialog. | |||
*/ | ||||
class PLASMA_EXPORT Dialog : public QWidget | ||||
{ | ||||
Q_OBJECT | ||||
public: | public: | |||
Dialog(BackgroundChecker *checker, | /** | |||
QWidget *parent); | * Use these flags to choose the active resize corners. | |||
~Dialog(); | */ | |||
enum ResizeCorner { | ||||
QString originalBuffer() const; | NoCorner = 0, | |||
QString buffer() const; | NorthEast = 1, | |||
SouthEast = 2, | ||||
void show(); | NorthWest = 4, | |||
void activeAutoCorrect(bool _active); | SouthWest = 8, | |||
All = NorthEast | SouthEast | NorthWest | SouthWest | ||||
// Hide warning about done(), which is a slot in QDialog and a sign | }; | |||
al here. | Q_DECLARE_FLAGS(ResizeCorners, ResizeCorner) | |||
using KDialog::done; | ||||
/** | ||||
/** | * @param parent the parent widget, for plasmoids, this is usually | |||
* Controls whether an (indefinite) progress dialog is shown when t | 0. | |||
he spell | * @param f the Qt::WindowFlags, default is to not show a windowbor | |||
* checking takes longer than the given time to complete. By defaul | der. | |||
t no | */ | |||
* progress dialog is shown. If the progress dialog is set to be sh | explicit Dialog(QWidget * parent = 0, Qt::WindowFlags f = Qt::Wind | |||
own, no | ow); | |||
* time consuming operation (for example, showing a notification me | virtual ~Dialog(); | |||
ssage) should | ||||
* be performed in a slot connected to the 'done' signal as this mi | /** | |||
ght trigger | * Sets a QGraphicsWidget to be shown as the content in this dialog | |||
* the progress dialog unnecessarily. | . | |||
* The dialog will then set up a QGraphicsView and coordinate geome | ||||
try with | ||||
* the widget automatically. | ||||
* | * | |||
* @param timeout time after which the progress dialog should appea | * @param widget the QGraphicsWidget to display in this dialog | |||
r; a negative | ||||
* value can be used to hide it | ||||
* @since 4.4 | ||||
*/ | */ | |||
void showProgressDialog(int timeout = 500); | void setGraphicsWidget(QGraphicsWidget *widget); | |||
/** | /** | |||
* Controls whether a message box indicating the completion of the | * @return the graphics widget shown in this dialog | |||
spell checking | */ | |||
* is shown or not. By default it is not shown. | QGraphicsWidget *graphicsWidget(); | |||
/** | ||||
* @param corners the corners the resize handlers should be placed | ||||
in. | ||||
*/ | ||||
void setResizeHandleCorners(ResizeCorners corners); | ||||
/** | ||||
* Convenience method to get the enabled resize corners. | ||||
* @return which resize corners are active. | ||||
*/ | ||||
ResizeCorners resizeCorners() const; | ||||
/** | ||||
* @return true if currently being resized by the user | ||||
*/ | ||||
bool isUserResizing() const; | ||||
/** | ||||
* Sets the minimum values that each of four sides of the rect may | ||||
expand to or from | ||||
* | * | |||
* @since 4.4 | * @param left the screen coordinate that the left may not go beyon | |||
d; -1 for no limit | ||||
* @param top the screen coordinate that the top may not go beyond; | ||||
-1 for no limit | ||||
* @param right the screen coordinate that the right may not go bey | ||||
ond; -1 for no limit | ||||
* @param bottom the screen coordinate that the bottom may not go b | ||||
eyond; -1 for no limit | ||||
*/ | */ | |||
void showSpellCheckCompletionMessage( bool b = true ); | void setMinimumResizeLimits(int left, int top, int right, int botto m); | |||
/** | /** | |||
* Controls whether the spell checking is continued after the repla | * Retrives the minimum resize limits for the dialog | |||
cement of a | ||||
* misspelled word has been performed. By default it is continued. | ||||
* | * | |||
* @param left the screen coordinate that the left may not go beyon | ||||
d; -1 for no limit | ||||
* @param top the screen coordinate that the top may not go beyond; | ||||
-1 for no limit | ||||
* @param right the screen coordinate that the right may not go bey | ||||
ond; -1 for no limit | ||||
* @param bottom the screen coordinate that the bottom may not go b | ||||
eyond; -1 for no limit | ||||
*/ | ||||
void getMinimumResizeLimits(int *left, int *top, int *right, int *b | ||||
ottom); | ||||
/** | ||||
* Causes an animated hide; requires compositing to work, otherwise | ||||
* the dialog will simply hide. | ||||
* @since 4.3 | ||||
*/ | ||||
void animatedHide(Plasma::Direction direction); | ||||
/** | ||||
* Causes an animated show; requires compositing to work, otherwise | ||||
* the dialog will simply show. | ||||
* @since 4.3 | ||||
*/ | ||||
void animatedShow(Plasma::Direction direction); | ||||
/** | ||||
* @return the preferred aspect ratio mode for placement and resizi | ||||
ng | ||||
* @since 4.4 | * @since 4.4 | |||
*/ | */ | |||
void setSpellCheckContinuedAfterReplacement( bool b ); | Plasma::AspectRatioMode aspectRatioMode() const; | |||
public Q_SLOTS: | /** | |||
void setBuffer(const QString &); | * Sets the preferred aspect ratio mode for placement and resizing | |||
* @since 4.4 | ||||
*/ | ||||
void setAspectRatioMode(Plasma::AspectRatioMode mode); | ||||
Q_SIGNALS: | Q_SIGNALS: | |||
/** | /** | |||
* The dialog won't be closed if you setBuffer() in slot connected | * Fires when the dialog automatically resizes. | |||
to this signal | ||||
* | ||||
* Also emitted after stop() signal | ||||
*/ | */ | |||
void done( const QString& newBuffer ); | void dialogResized(); | |||
void misspelling( const QString& word, int start ); | ||||
void replace( const QString& oldWord, int start, | ||||
const QString& newWord ); | ||||
void stop(); | ||||
void cancel(); | ||||
void autoCorrect( const QString & currentWord, const QString & repl | ||||
aceWord ); | ||||
/** | /** | |||
* Signal sends when spell checking is finished/stopped/completed | * Emit a signal when the dialog become visible/invisible | |||
* @since 4.1 | ||||
*/ | */ | |||
void spellCheckStatus(const QString &); | void dialogVisible(bool status); | |||
public Q_SLOTS: | ||||
/** | /** | |||
* Emitted when the user changes the language used for spellcheckin | * Adjusts the dialog to the associated QGraphicsWidget's geometry | |||
g, | * Should not normally need to be called by users of Dialog as Dial | |||
* which is shown in a combobox of this dialog. | og | |||
* | * does it automatically. Event compression may cause unwanted dela | |||
* @param dictionary the new language the user selected | ys, | |||
* @since 4.1 | * however, and so this method may be called to immediately cause a | |||
* synchronization. | ||||
* @since 4.5 | ||||
*/ | ||||
void syncToGraphicsWidget(); | ||||
protected: | ||||
/** | ||||
* Reimplemented from QWidget | ||||
*/ | ||||
void paintEvent(QPaintEvent *e); | ||||
bool event(QEvent *event); | ||||
void resizeEvent(QResizeEvent *e); | ||||
bool eventFilter(QObject *watched, QEvent *event); | ||||
void hideEvent(QHideEvent *event); | ||||
void showEvent(QShowEvent *event); | ||||
void focusInEvent(QFocusEvent *event); | ||||
void mouseMoveEvent(QMouseEvent *event); | ||||
void mousePressEvent(QMouseEvent *event); | ||||
void mouseReleaseEvent(QMouseEvent *event); | ||||
void keyPressEvent(QKeyEvent *event); | ||||
void moveEvent(QMoveEvent *event); | ||||
/** | ||||
* Convenience method to know whether the point is in a control are | ||||
a (e.g. resize area) | ||||
* or not. | ||||
* @return true if the point is in the control area. | ||||
*/ | */ | |||
void languageChanged( const QString &language ); | bool inControlArea(const QPoint &point); | |||
private Q_SLOTS: | private: | |||
void slotMisspelling(const QString& word, int start ); | DialogPrivate *const d; | |||
void slotDone(); | ||||
friend class DialogPrivate; | ||||
void slotFinished(); | /** | |||
void slotCancel(); | * React to theme changes | |||
*/ | ||||
void slotAddWord(); | Q_PRIVATE_SLOT(d, void themeChanged()) | |||
void slotReplaceWord(); | Q_PRIVATE_SLOT(d, void checkBorders()) | |||
void slotReplaceAll(); | Q_PRIVATE_SLOT(d, void delayedAdjustSize()) | |||
void slotSkip(); | ||||
void slotSkipAll(); | ||||
void slotSuggest(); | ||||
void slotChangeLanguage( const QString& ); | ||||
void slotSelectionChanged(const QModelIndex &); | ||||
void slotAutocorrect(); | ||||
void setGuiEnabled(bool b); | friend class PopupAppletPrivate; | |||
void setProgressDialogVisible(bool b); | }; | |||
private: | } // Plasma namespace | |||
void updateDialog( const QString& word ); | ||||
void fillDictionaryComboBox(); | ||||
void updateDictionaryComboBox(); | ||||
void fillSuggestions( const QStringList& suggs ); | ||||
void initConnections(); | ||||
void initGui(); | ||||
void continueChecking(); | ||||
private: | Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Dialog::ResizeCorners) | |||
class Private; | ||||
Private* const d; | ||||
Q_DISABLE_COPY( Dialog ) | ||||
}; | ||||
} | ||||
#endif | #endif | |||
End of changes. 30 change blocks. | ||||
129 lines changed or deleted | 190 lines changed or added | |||
kdeversion.h | kdeversion.h | |||
---|---|---|---|---|
skipping to change at line 47 | skipping to change at line 47 | |||
* This macro contains the KDE version in string form. As it is a macro, | * This macro contains the KDE version in string form. As it is a macro, | |||
* it contains the version at compile time. See versionString() if you need | * it contains the version at compile time. See versionString() if you need | |||
* the KDE version used at runtime. | * the KDE version used at runtime. | |||
* | * | |||
* @note The version string might contain a section in parentheses, | * @note The version string might contain a section in parentheses, | |||
* especially for development versions of KDE. | * especially for development versions of KDE. | |||
* If you use that macro directly for a file format (e.g. OASIS Open Docume nt) | * If you use that macro directly for a file format (e.g. OASIS Open Docume nt) | |||
* or for a protocol (e.g. http) be careful that it is appropriate. | * or for a protocol (e.g. http) be careful that it is appropriate. | |||
* (Fictional) example: "4.0.90 (>=20070101)" | * (Fictional) example: "4.0.90 (>=20070101)" | |||
*/ | */ | |||
#define KDE_VERSION_STRING "4.11.00" | #define KDE_VERSION_STRING "4.11.1" | |||
/** | /** | |||
* @def KDE_VERSION_MAJOR | * @def KDE_VERSION_MAJOR | |||
* @ingroup KDEMacros | * @ingroup KDEMacros | |||
* @brief Major version of KDE, at compile time | * @brief Major version of KDE, at compile time | |||
*/ | */ | |||
#define KDE_VERSION_MAJOR 4 | #define KDE_VERSION_MAJOR 4 | |||
/** | /** | |||
* @def KDE_VERSION_MINOR | * @def KDE_VERSION_MINOR | |||
* @ingroup KDEMacros | * @ingroup KDEMacros | |||
* @brief Minor version of KDE, at compile time | * @brief Minor version of KDE, at compile time | |||
*/ | */ | |||
#define KDE_VERSION_MINOR 11 | #define KDE_VERSION_MINOR 11 | |||
/** | /** | |||
* @def KDE_VERSION_RELEASE | * @def KDE_VERSION_RELEASE | |||
* @ingroup KDEMacros | * @ingroup KDEMacros | |||
* @brief Release version of KDE, at compile time | * @brief Release version of KDE, at compile time | |||
*/ | */ | |||
#define KDE_VERSION_RELEASE 00 | #define KDE_VERSION_RELEASE 1 | |||
/** | /** | |||
* @ingroup KDEMacros | * @ingroup KDEMacros | |||
* @brief Make a number from the major, minor and release number of a KDE v ersion | * @brief Make a number from the major, minor and release number of a KDE v ersion | |||
* | * | |||
* This function can be used for preprocessing when KDE_IS_VERSION is not | * This function can be used for preprocessing when KDE_IS_VERSION is not | |||
* appropriate. | * appropriate. | |||
*/ | */ | |||
#define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) | #define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
knewstuff_export.h | knewstuff_export.h | |||
---|---|---|---|---|
/* This file is part of the KDE project | /* This file is part of the KDE project | |||
Copyright (C) 2007 David Faure <faure@kde.org> | Copyright (C) 2007 David Faure <faure@kde.org> | |||
Copyright (C) 2009 Jeremy Whiting <jpwhiting@kde.org> | ||||
This library is free software; you can redistribute it and/or | This library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU Lesser General Public | modify it under the terms of the GNU Lesser General Public | |||
License as published by the Free Software Foundation; either | License as published by the Free Software Foundation; either | |||
version 2.1 of the License, or (at your option) any later version. | version 2.1 of the License, or (at your option) any later version. | |||
This library is distributed in the hope that it will be useful, | This library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
Lesser General Public License for more details. | Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public | |||
License along with this library. If not, see <http://www.gnu.org/licen ses/>. | License along with this library. If not, see <http://www.gnu.org/licen ses/>. | |||
*/ | */ | |||
#ifndef KNEWSTUFF2_EXPORT_H | #ifndef KNEWSTUFF3_EXPORT_H | |||
#define KNEWSTUFF2_EXPORT_H | #define KNEWSTUFF3_EXPORT_H | |||
/* needed for KDE_EXPORT and KDE_IMPORT macros */ | /* needed for KDE_EXPORT and KDE_IMPORT macros */ | |||
#include <kdemacros.h> | #include <kdemacros.h> | |||
#ifndef KNEWSTUFF_EXPORT | #ifndef KNEWSTUFF_EXPORT | |||
# if defined(KDELIBS_STATIC_LIBS) | # if defined(KDELIBS_STATIC_LIBS) | |||
/* No export/import for static libraries */ | /* No export/import for static libraries */ | |||
# define KNEWSTUFF_EXPORT | # define KNEWSTUFF_EXPORT | |||
# elif defined(MAKE_KNEWSTUFF2_LIB) | # elif defined(MAKE_KNEWSTUFF3_LIB) | |||
/* We are building this library */ | /* We are building this library */ | |||
# define KNEWSTUFF_EXPORT KDE_EXPORT | # define KNEWSTUFF_EXPORT KDE_EXPORT | |||
# else | # else | |||
/* We are using this library */ | /* We are using this library */ | |||
# define KNEWSTUFF_EXPORT KDE_IMPORT | # define KNEWSTUFF_EXPORT KDE_IMPORT | |||
# endif | # endif | |||
#endif | #endif | |||
# ifndef KNEWSTUFF_EXPORT_DEPRECATED | # ifndef KNEWSTUFF_EXPORT_DEPRECATED | |||
# define KNEWSTUFF_EXPORT_DEPRECATED KDE_DEPRECATED KNEWSTUFF_EXPORT | # define KNEWSTUFF_EXPORT_DEPRECATED KDE_DEPRECATED KNEWSTUFF_EXPORT | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||
kurl.h | kurl.h | |||
---|---|---|---|---|
skipping to change at line 566 | skipping to change at line 566 | |||
* Returns the query of the URL. | * Returns the query of the URL. | |||
* The query may contain the 0 character. | * The query may contain the 0 character. | |||
* If a query is present it always starts with a '?'. | * If a query is present it always starts with a '?'. | |||
* A single '?' means an empty query. | * A single '?' means an empty query. | |||
* An empty string means no query. | * An empty string means no query. | |||
* @return The encoded query, or QString() if there is none. | * @return The encoded query, or QString() if there is none. | |||
*/ | */ | |||
QString query() const; | QString query() const; | |||
/** | /** | |||
* Returns the reference (or "fragment") of the URL. | * Returns the @em encoded reference (or "fragment") of the URL (everythi | |||
* The reference is @em never decoded automatically. | ng after '#'). | |||
* @return the undecoded reference, or QString() if there is none | * @return the encoded reference, or QString("") if the reference part is | |||
empty, | ||||
* or QString() if the URL has no reference. | ||||
*/ | */ | |||
QString ref() const; | QString ref() const; | |||
/** | /** | |||
* Sets the reference/fragment part (everything after '#'). | * Sets the reference/fragment part (everything after '#'). | |||
* If you have an encoded fragment already (as a QByteArray), you can cal | * If you have an encoded fragment already (as a QByteArray), you can cal | |||
l setFragment directly. | l setEncodedFragment directly. | |||
* @param fragment the unencoded reference (or QString() to remove it). | * @param fragment the @em encoded reference (or QString() to remove it). | |||
*/ | */ | |||
void setRef( const QString& fragment ); | void setRef( const QString& fragment ); | |||
/** | /** | |||
* Checks whether the URL has a reference/fragment part. | * Checks whether the URL has a reference/fragment part. | |||
* @return true if the URL has a reference part. In a URL like | * @return true if the URL has a reference part. In a URL like | |||
* http://www.kde.org/kdebase.tar#tar:/README it would | * http://www.kde.org/kdebase.tar#tar:/README it would | |||
* return true, too. | * return true, too. | |||
*/ | */ | |||
bool hasRef() const; | bool hasRef() const; | |||
/** | /** | |||
* Returns the HTML reference (the part of the URL after "#"). | * Returns the @em unencoded reference (or "fragment") of the URL (everyt | |||
* @return The HTML-style reference. | hing after '#'). | |||
* @return the unencoded reference, or QString("") if the reference part | ||||
is empty, | ||||
* or QString() if the URL has no reference. | ||||
* @see split | * @see split | |||
* @see hasSubUrl | * @see hasSubUrl | |||
* @see encodedHtmlRef | * @see encodedHtmlRef | |||
*/ | */ | |||
QString htmlRef() const; | QString htmlRef() const; | |||
/** | /** | |||
* Returns the HTML reference (the part of the URL after "#") in | * Returns the @em encoded reference (or "fragment") of the URL (everythi | |||
* encoded form. | ng after '#'). | |||
* @return The HTML-style reference in its original form. | * @return the encoded reference, or QString("") if the reference part is | |||
empty, | ||||
* or QString() if the URL has no reference. | ||||
* @see ref | ||||
*/ | */ | |||
QString encodedHtmlRef() const; | QString encodedHtmlRef() const; | |||
/** | /** | |||
* Sets the HTML-style reference. | * Sets the HTML-style reference. | |||
* | * | |||
* @param _ref The new reference. This is considered to be @em not encode d in | * @param _ref The new reference. This is considered to be @em not encode d in | |||
* contrast to setRef(). Use QString() to remove it. | * contrast to setRef(). Use QString() to remove it. | |||
* @see htmlRef() | * @see htmlRef() | |||
*/ | */ | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 19 lines changed or added | |||
texthintinterface.h | texthintinterface.h | |||
---|---|---|---|---|
/* This file is part of the KDE libraries | /* This file is part of the KDE libraries | |||
Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> | Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> | |||
Copyright (C) 2013 Dominik Haumann <dhaumann@kde.org> | ||||
This library is free software; you can redistribute it and/or | This library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU Library General Public | modify it under the terms of the GNU Library General Public | |||
License as published by the Free Software Foundation; either | License as published by the Free Software Foundation; either | |||
version 2 of the License, or (at your option) any later version. | version 2 of the License, or (at your option) any later version. | |||
This library is distributed in the hope that it will be useful, | This library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
Library General Public License for more details. | Library General Public License for more details. | |||
You should have received a copy of the GNU Library General Public Licens e | You should have received a copy of the GNU Library General Public Licens e | |||
along with this library; see the file COPYING.LIB. If not, write to | along with this library; see the file COPYING.LIB. If not, write to | |||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |||
Boston, MA 02110-1301, USA. | Boston, MA 02110-1301, USA. | |||
*/ | */ | |||
#ifndef KDELIBS_KTEXTEDITOR_TEXTHINTINTERFACE_H | #ifndef KDELIBS_KTEXTEDITOR_TEXTHINTINTERFACE_H | |||
#define KDELIBS_KTEXTEDITOR_TEXTHINTINTERFACE_H | #define KDELIBS_KTEXTEDITOR_TEXTHINTINTERFACE_H | |||
#include <QtCore/QString> | #include <QtCore/QString> | |||
#include <QtCore/QStringList> | ||||
#include <ktexteditor/ktexteditor_export.h> | #include <ktexteditor/ktexteditor_export.h> | |||
#include <ktexteditor/cursor.h> | #include <ktexteditor/cursor.h> | |||
namespace KTextEditor | namespace KTextEditor | |||
{ | { | |||
/** | /** | |||
* This is an interface for the KTextEditor::View class. | * \brief Text hint interface showing tool tips under the mouse for the Vie | |||
w. | ||||
* | ||||
* \ingroup kte_group_view_extensions | * \ingroup kte_group_view_extensions | |||
* | ||||
* \section texthint_introduction Introduction | ||||
* | ||||
* The text hint interface provides a way to show tool tips for text locate | ||||
d | ||||
* under the mouse. Possible applications include showing a value of a vari | ||||
able | ||||
* when debugging an application, or showing a complete path of an include | ||||
* directive. | ||||
* | ||||
* By default, the text hint interface is disable for the View. To enable i | ||||
t, | ||||
* call enableTextHints() with the desired timeout. The timeout specifies t | ||||
he | ||||
* delay the user needs to hover over the text before the tool tip is shown | ||||
. | ||||
* Therefore, the timeout should not be too large, a value of 200 milliseco | ||||
nds | ||||
* is recommended. | ||||
* | ||||
* Once text hints are enabled, the signal needTextHint() is emitted after | ||||
the | ||||
* timeout whenever the mouse moved to a new text position in the View. | ||||
* Therefore, in order to show a tool tip, you need to connect to this sign | ||||
al | ||||
* and then fill the parameter \p text with the text to display. | ||||
* | ||||
* To disable all text hints, call disableTextHints(). This, however will d | ||||
isable | ||||
* the text hints entirely for the View. If there are multiple users of the | ||||
* TextHintInterface, this might lead to a conflict. | ||||
* | ||||
* \section texthint_access Accessing the TextHintInterface | ||||
* | ||||
* The TextHintInterface is an extension interface for a | ||||
* View, i.e. the View inherits the interface \e provided that the | ||||
* used KTextEditor library implements the interface. Use qobject_cast to | ||||
* access the interface: | ||||
* \code | ||||
* // view is of type KTextEditor::View* | ||||
* KTextEditor::TextHintInterface *iface = | ||||
* qobject_cast<KTextEditor::TextHintInterface*>( view ); | ||||
* | ||||
* if( iface ) { | ||||
* // the implementation supports the interface | ||||
* // do stuff | ||||
* } | ||||
* \endcode | ||||
* | ||||
* \since KDE 4.11 | ||||
*/ | */ | |||
class KTEXTEDITOR_EXPORT TextHintInterface | class KTEXTEDITOR_EXPORT TextHintInterface | |||
{ | { | |||
public: | public: | |||
TextHintInterface(); | TextHintInterface(); | |||
virtual ~TextHintInterface(); | virtual ~TextHintInterface(); | |||
/** | /** | |||
* enable Texthints. If they are enabled a signal needTextHint is emitt | * Enable text hints with the specified \p timeout in milliseconds. | |||
ed, if the mouse | * The timeout specifies the delay the user needs to hover over the tex | |||
* changed the position and a new character is beneath the mouse cursor | t | |||
. The signal is delayed | * befure the tool tip is shown. Therefore, \p timeout should not be | |||
* for a certain time, specifiedin the timeout parameter. | * too large, a value of 200 milliseconds is recommended. | |||
* | ||||
* After enabling the text hints, the signal needTextHint() is emitted | ||||
* whenever the mouse position changed and a new character is underneat | ||||
h | ||||
* the mouse cursor. Calling the signal is delayed for the time specifi | ||||
ed | ||||
* by \p timeout. | ||||
* | ||||
* \param timeout tool tip delay in milliseconds | ||||
* | ||||
* \todo KDE5 add default value for timeout | ||||
*/ | */ | |||
virtual void enableTextHints(int timeout)=0; | virtual void enableTextHints(int timeout) = 0; | |||
/** | /** | |||
* Disable texthints. Per default they are disabled. | * Disable all text hints for the view. | |||
* By default, text hints are disabled. | ||||
*/ | */ | |||
virtual void disableTextHints()=0; | virtual void disableTextHints() = 0; | |||
//signals | ||||
// | ||||
// signals | ||||
// | ||||
public: | ||||
/** | /** | |||
* emit this signal, if a tooltip text is needed for displaying. | * This signal is emitted whenever the timeout for displaying a text hi | |||
* I you don't want a tooltip to be displayd set text to an emtpy strin | nt | |||
g in a connected slot, | * is triggered. The text cursor \p position specifies the mouse positi | |||
* otherwise set text to the string you want the editor to display | on | |||
* in the text. To show a text hint, fill \p text with the text to be | ||||
* displayed. If you do not want a tool tip to be displayed, set \p tex | ||||
t to | ||||
* an empty QString() in the connected slot. | ||||
* | ||||
* \param position text cursor under the mouse position | ||||
* \param text tool tip to be displayed, or empty string to hide | ||||
* | ||||
* \todo KDE5: add first parameter "KTextEditor::View * view" | ||||
*/ | */ | |||
virtual void needTextHint(const KTextEditor::Cursor& position, QStri ng &text)=0; | virtual void needTextHint(const KTextEditor::Cursor& position, QString &text) = 0; | |||
private: | private: | |||
class TextHintInterfacePrivate* const d; | class TextHintInterfacePrivate* const d; | |||
}; | }; | |||
} | } | |||
Q_DECLARE_INTERFACE(KTextEditor::TextHintInterface, "org.kde.KTextEditor.Te xtHintInterface") | Q_DECLARE_INTERFACE(KTextEditor::TextHintInterface, "org.kde.KTextEditor.Te xtHintInterface") | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
17 lines changed or deleted | 92 lines changed or added | |||