author | clem <clem> | 2004-10-07 19:36:30 (UTC) |
---|---|---|
committer | clem <clem> | 2004-10-07 19:36:30 (UTC) |
commit | b2e0fd018e1122f65dbbf8ab564e992988f35385 (patch) (side-by-side diff) | |
tree | d47db77ff4ba1e9d397bc682f5d65b05b049dd02 | |
parent | 33c90b7be9d675e8e5b39cfd569997bfcbb5decf (diff) | |
download | opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.zip opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.tar.gz opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.tar.bz2 |
small documentation format fixes
-rw-r--r-- | core/launcher/qprocess.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/odebug.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/okeyconfigmanager.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/okeyfilter.h | 8 | ||||
-rw-r--r-- | libopie2/opiecore/opluginloader.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiecore/oprocess.h | 8 | ||||
-rw-r--r-- | libopie2/opieui/oimageeffect.h | 6 | ||||
-rw-r--r-- | libopie2/opieui/opixmapeffect.h | 11 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ocombobox.h | 4 | ||||
-rw-r--r-- | libopie2/qt3/opieui/olineedit.h | 6 |
12 files changed, 33 insertions, 37 deletions
diff --git a/core/launcher/qprocess.cpp b/core/launcher/qprocess.cpp index 3fe1238..aef7967 100644 --- a/core/launcher/qprocess.cpp +++ b/core/launcher/qprocess.cpp @@ -1,470 +1,470 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <stdio.h> #include <stdlib.h> #include "qprocess.h" #ifndef QT_NO_PROCESS #include "qapplication.h" //#define QT_QPROCESS_DEBUG /*! \class QProcess qprocess.h \brief The QProcess class is used to start external programs and to communicate with them. This is a temporary class. This will be replaced by Qt 3's QProcess class. \ingroup qtopiaemb */ /*! \enum QProcess::Communication This enum type defines the communication channels connected to the process. \value Stdin Data can be written to the process's standard input. \value Stdout Data can be read from the process's standard output. \value Stderr Data can be read from the process's standard error. \value DupStderr Duplicates standard error to standard output for new processes; i.e. everything that the process writes to standard error, is reported by QProcess on standard output instead. This is especially useful if your application requires that the output on standard output and standard error is read in the same order as the process output it. Please note that this is a binary flag, so if you want to activate this together with standard input, output and error redirection (the default), you have to specify - \c{Stdin|Stdout|Stderr|DupStderr} for the setCommunication() call. + \c {Stdin|Stdout|Stderr|DupStderr} for the setCommunication() call. \sa setCommunication() communication() */ /*! Constructs a QProcess object. The \a parent and \a name parameters are passed to the QObject constructor. \sa setArguments() addArgument() start() */ QProcess::QProcess( QObject *parent, const char *name ) : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), wroteToStdinConnected( FALSE ), readStdoutCalled( FALSE ), readStderrCalled( FALSE ), comms( Stdin|Stdout|Stderr ) { init(); } /*! Constructs a QProcess with \a arg0 as the command to be executed. The \a parent and \a name parameters are passed to the QObject constructor. The process is not started. You must call start() or launch() to start the process. \sa setArguments() addArgument() start() */ QProcess::QProcess( const QString& arg0, QObject *parent, const char *name ) : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), wroteToStdinConnected( FALSE ), readStdoutCalled( FALSE ), readStderrCalled( FALSE ), comms( Stdin|Stdout|Stderr ) { init(); addArgument( arg0 ); } /*! Constructs a QProcess with \a args as the arguments of the process. The first element in the list is the command to be executed. The other elements in the list are the arguments to this command. The \a parent and \a name parameters are passed to the QObject constructor. The process is not started. You must call start() or launch() to start the process. \sa setArguments() addArgument() start() */ QProcess::QProcess( const QStringList& args, QObject *parent, const char *name ) : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), wroteToStdinConnected( FALSE ), readStdoutCalled( FALSE ), readStderrCalled( FALSE ), comms( Stdin|Stdout|Stderr ) { init(); setArguments( args ); } /*! Returns the list of arguments that are set for the process. Arguments can be specified with the constructor or with the functions setArguments() and addArgument(). \sa setArguments() addArgument() */ QStringList QProcess::arguments() const { return _arguments; } /*! Clears the list of arguments that are set for the process. \sa setArguments() addArgument() */ void QProcess::clearArguments() { _arguments.clear(); } /*! Sets \a args as the arguments for the process. The first element in the list is the command to be executed. The other elements in the list are the arguments to the command. Any previous arguments are deleted. \sa arguments() addArgument() */ void QProcess::setArguments( const QStringList& args ) { _arguments = args; } /*! Adds \a arg to the end of the list of arguments. The first element in the list of arguments is the command to be executed; the following elements are the arguments to the command. \sa arguments() setArguments() */ void QProcess::addArgument( const QString& arg ) { _arguments.append( arg ); } #ifndef QT_NO_DIR /*! Returns the working directory that was set with setWorkingDirectory(), or the current directory if none has been set. \sa setWorkingDirectory() QDir::current() */ QDir QProcess::workingDirectory() const { return workingDir; } /*! Sets \a dir as the working directory for a process. This does not affect running processes; only processes that are started afterwards are affected. Setting the working directory is especially useful for processes that try to access files with relative filenames. \sa workingDirectory() start() */ void QProcess::setWorkingDirectory( const QDir& dir ) { workingDir = dir; } #endif //QT_NO_DIR /*! Returns the communication required with the process. \sa setCommunication() */ int QProcess::communication() const { return comms; } /*! Sets \a commFlags as the communication required with the process. \a commFlags is a bitwise OR between the flags defined in \c Communication. - The default is \c{Stdin|Stdout|Stderr}. + The default is \c {Stdin|Stdout|Stderr}. \sa communication() */ void QProcess::setCommunication( int commFlags ) { comms = commFlags; } /*! Returns TRUE if the process has exited normally; otherwise returns FALSE. This implies that this function returns FALSE if the process is still running. \sa isRunning() exitStatus() processExited() */ bool QProcess::normalExit() const { // isRunning() has the side effect that it determines the exit status! if ( isRunning() ) return FALSE; else return exitNormal; } /*! Returns the exit status of the process or 0 if the process is still running. This function returns immediately and does not wait until the process is finished. If normalExit() is FALSE (e.g. if the program was killed or crashed), this function returns 0, so you should check the return value of normalExit() before relying on this value. \sa normalExit() processExited() */ int QProcess::exitStatus() const { // isRunning() has the side effect that it determines the exit status! if ( isRunning() ) return 0; else return exitStat; } /*! Reads the data that the process has written to standard output. When new data is written to standard output, the class emits the signal readyReadStdout(). If there is no data to read, this function returns a QByteArray of size 0: it does not wait until there is something to read. \sa readyReadStdout() readLineStdout() readStderr() writeToStdin() */ QByteArray QProcess::readStdout() { if ( readStdoutCalled ) { return QByteArray(); } readStdoutCalled = TRUE; QByteArray buf = bufStdout()->copy(); consumeBufStdout( -1 ); // consume everything readStdoutCalled = FALSE; return buf; } /*! Reads the data that the process has written to standard error. When new data is written to standard error, the class emits the signal readyReadStderr(). If there is no data to read, this function returns a QByteArray of size 0: it does not wait until there is something to read. \sa readyReadStderr() readLineStderr() readStdout() writeToStdin() */ QByteArray QProcess::readStderr() { if ( readStderrCalled ) { return QByteArray(); } readStderrCalled = TRUE; QByteArray buf = bufStderr()->copy(); consumeBufStderr( -1 ); // consume everything readStderrCalled = FALSE; return buf; } /*! Returns TRUE if it's possible to read an entire line of text from standard output at this time; otherwise returns FALSE. \sa readLineStdout() canReadLineStderr() */ bool QProcess::canReadLineStdout() const { QProcess *that = (QProcess*)this; return that->scanNewline( TRUE, 0 ); } /*! Returns TRUE if it's possible to read an entire line of text from standard error at this time; otherwise returns FALSE. \sa readLineStderr() canReadLineStdout() */ bool QProcess::canReadLineStderr() const { QProcess *that = (QProcess*)this; return that->scanNewline( FALSE, 0 ); } /*! Reads a line of text from standard output, excluding any trailing newline or carriage return characters, and returns it. Returns QString::null if canReadLineStdout() returns FALSE. \sa canReadLineStdout() readyReadStdout() readStdout() readLineStderr() */ QString QProcess::readLineStdout() { QByteArray a; QString s; if ( scanNewline( TRUE, &a ) ) { if ( a.isEmpty() ) s = ""; else s = QString( a ); } return s; } /*! Reads a line of text from standard error, excluding any trailing newline or carriage return characters and returns it. Returns QString::null if canReadLineStderr() returns FALSE. \sa canReadLineStderr() readyReadStderr() readStderr() readLineStdout() */ QString QProcess::readLineStderr() { QByteArray a; QString s; if ( scanNewline( FALSE, &a ) ) { if ( a.isEmpty() ) s = ""; else s = QString( a ); } return s; } /*! - This private function scans for any occurrence of \n or \r\n in the + This private function scans for any occurrence of \\n or \\r\\n in the buffer \e buf. It stores the text in the byte array \a store if it is non-null. */ bool QProcess::scanNewline( bool stdOut, QByteArray *store ) { QByteArray *buf; if ( stdOut ) buf = bufStdout(); else buf = bufStderr(); uint n = buf->size(); uint i; for ( i=0; i<n; i++ ) { if ( buf->at(i) == '\n' ) { break; } } if ( i >= n ) return FALSE; if ( store ) { uint lineLength = i; if ( lineLength>0 && buf->at(lineLength-1) == '\r' ) lineLength--; // (if there are two \r, let one stay) store->resize( lineLength ); memcpy( store->data(), buf->data(), lineLength ); if ( stdOut ) consumeBufStdout( i+1 ); else consumeBufStderr( i+1 ); } return TRUE; } /*! \fn void QProcess::launchFinished() This signal is emitted when the process was started with launch(). If the start was successful, this signal is emitted after all the data has been written to standard input. If the start failed, then this signal is emitted immediately. \sa launch() QObject::deleteLater() */ /*! Runs the process and writes the data \a buf to the process's standard input. If all the data is written to standard input, standard input is closed. The command is searched for in the path for executable programs; you can also use an absolute path in the command itself. If \a env is null, then the process is started with the same environment as the starting process. If \a env is non-null, then the values in the stringlist are interpreted as environment setttings of the form \c {key=value} and the process is started with these environment settings. For convenience, there is a small exception to this rule under Unix: if \a env does not contain any settings for the environment variable \c LD_LIBRARY_PATH, then this variable is inherited from the starting process. Returns TRUE if the process could be started; otherwise returns FALSE. Note that you should not use the slots writeToStdin() and closeStdin() on processes started with launch(), since the result is not well-defined. If you need these slots, use start() instead. The process may or may not read the \a buf data sent to its standard input. You can call this function even when a process that was started with this instance is still running. Be aware that if you do this the standard input of the process that was launched first will be closed, with any pending data being deleted, and the process will be left to run out of your control. Similarly, if the process could not be started the standard input will be closed and the pending data deleted. (On operating systems that have zombie processes, Qt will also wait() on the old process.) The object emits the signal launchFinished() when this function call is finished. If the start was successful, this signal is emitted after all the data has been written to standard input. If the start failed, then this signal is emitted immediately. \sa start() launchFinished(); */ bool QProcess::launch( const QByteArray& buf, QStringList *env ) { if ( start( env ) ) { if ( !buf.isEmpty() ) { connect( this, SIGNAL(wroteToStdin()), this, SLOT(closeStdinLaunch()) ); writeToStdin( buf ); } else { closeStdin(); emit launchFinished(); } return TRUE; diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index b5ae4e5..8b64c41 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -241,198 +241,198 @@ void ODevice::initButtons() ODevice::~ODevice() { // we leak m_devicebuttons and m_cpu_frequency // but it's a singleton and it is not so importantant // -zecke delete d; } bool ODevice::setSoftSuspend ( bool /*soft*/ ) { return false; } //#include <linux/apm_bios.h> #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) /** * This method will try to suspend the device * It only works if the user is the QWS Server and the apm application * is installed. * It tries to suspend and then waits some time cause some distributions * do have asynchronus apm implementations. * This method will either fail and return false or it'll suspend the * device and return once the device got woken up * * @return if the device got suspended */ bool ODevice::suspend() { if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices return false; bool res = false; ODevice::sendSuspendmsg(); struct timeval tvs, tvn; ::gettimeofday ( &tvs, 0 ); ::sync(); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); // This is needed because the iPAQ apm implementation is asynchronous and we // can not be sure when exactly the device is really suspended // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. if ( res ) { do { // wait at most 1.5 sec: either suspend didn't work or the device resumed ::usleep ( 200 * 1000 ); ::gettimeofday ( &tvn, 0 ); } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); } return res; } //#include <linux/fb.h> better not rely on kernel headers in userspace ... #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 /* VESA Blanking Levels */ #define VESA_NO_BLANKING 0 #define VESA_VSYNC_SUSPEND 1 #define VESA_HSYNC_SUSPEND 2 #define VESA_POWERDOWN 3 /** * This sets the display on or off */ bool ODevice::setDisplayStatus ( bool on ) { qDebug("ODevice::setDisplayStatus(%d)", on); if ( d->m_model == Model_Unknown ) return false; bool res = false; int fd; #ifdef QT_QWS_DEVFS if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { #else if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { #endif res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); ::close ( fd ); } return res; } /** * This sets the display brightness * -* @param p The brightness to be set on a scale from 0 to 255 +* @param b The brightness to be set on a scale from 0 to 255 * @return success or failure */ -bool ODevice::setDisplayBrightness ( int p) +bool ODevice::setDisplayBrightness ( int b) { - Q_UNUSED( p ) + Q_UNUSED( b ) return false; } /** * * @return Returns the number of steppings on the brightness slider * in the Light-'n-Power settings. Values smaller zero and bigger * than 255 do not make sense. * * \sa QSlider::setLineStep * \sa QSlider::setPageStep */ int ODevice::displayBrightnessResolution() const { return 16; } /** * This sets the display contrast * @param p The contrast to be set on a scale from 0 to 255 * @return success or failure */ bool ODevice::setDisplayContrast ( int p) { Q_UNUSED( p ) return false; } /** * @return return the max value for the brightness settings slider * or 0 if the device doesn't support setting of a contrast */ int ODevice::displayContrastResolution() const { return 0; } /** * This returns the vendor as string * @return Vendor as QString */ QString ODevice::vendorString() const { return d->m_vendorstr; } /** * This returns the vendor as one of the values of OVendor * @return OVendor */ OVendor ODevice::vendor() const { return d->m_vendor; } /** * This returns the model as a string * @return A string representing the model */ QString ODevice::modelString() const { return d->m_modelstr; } /** * This does return the OModel used */ OModel ODevice::model() const { return d->m_model; } /** * This does return the systen name */ QString ODevice::systemString() const { return d->m_systemstr; } /** * Return System as OSystem value */ OSystem ODevice::system() const { return d->m_system; } /** * @return the version string of the base system */ QString ODevice::systemVersionString() const { return d->m_sysverstr; } diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index ab95dc3..05a1a25 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h @@ -34,130 +34,130 @@ #define OCONFIG_H //FIXME: Implement for X11 or reuse libqpe/Config there also? //FIXME: Or rather use QSettings also for libqpe? #include <qpe/config.h> class QColor; class QFont; namespace Opie { namespace Core { /** * A Configuration class based on the Qtopia @ref Config class * featuring additional handling of color and font entries */ class OConfig : public Config { public: /** * Constructs a OConfig object with a @a name. */ OConfig( const QString &name, Domain domain = User ); /** * Destructs the OConfig object. * * Writes back any dirty configuration entries, and destroys * dynamically created objects. */ virtual ~OConfig(); /** * @returns the name of the current group. * The current group is used for searching keys and accessing entries. * @todo make const */ const QString& group()const { return git.key(); }; /** * @returns a @ref QColor entry or a @a default value if the key is not found. */ QColor readColorEntry( const QString& key, const QColor* pDefault ) const; /** * @returns a @ref QFont value or a @a default value if the key is not found. */ QFont readFontEntry( const QString& key, const QFont* pDefault ) const; private: class Private; Private *d; }; /** * @brief Helper class for easier use of OConfig groups. * * Careful programmers always set the group of a * @ref OConfig object to the group they want to read from * and set it back to the old one of afterwards. This is usually * written as: * <pre> * * QString oldgroup config()->group(); * config()->setGroup( "TheGroupThatIWant" ); * ... * config()->writeEntry( "Blah", "Blubb" ); * * config()->setGroup( oldgroup ); * </pre> * * In order to facilitate this task, you can use * OConfigGroupSaver. Simply construct such an object ON THE STACK * when you want to switch to a new group. Then, when the object goes * out of scope, the group will automatically be restored. If you * want to use several different groups within a function or method, * you can still use OConfigGroupSaver: Simply enclose all work with * one group (including the creation of the OConfigGroupSaver object) * in one block. * * \code * OConfigGroupSaver saver(cfg,"TheGroupThatInWhat"); * \endcode * * Note that OConfigGroupSaver (cfg,"TheGroupThatInWhat"); would get imediately * destructed after created and that you would save in the old group which * is unwished. * * @author Matthias Kalle Dalheimer <Kalle@kde.org> * @version $Id$ * @see OConfig */ class OConfigGroupSaver { public: /** * Constructor. - * Create the object giving a @config object and a @a group to become + * Create the object giving a OConfig object and a @a group to become * the current group. */ OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) { _config->setGroup( group ); } OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) { _config->setGroup( group ); } OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) { _config->setGroup( group ); } /** * Destructor. * Restores the last current group. * @todo make it not inline for bc reasons. See KDE BC guide */ ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } OConfig* config() { return _config; }; private: OConfig* _config; QString _oldgroup; OConfigGroupSaver( const OConfigGroupSaver& ); OConfigGroupSaver& operator=( const OConfigGroupSaver& ); class Private; Private *d; }; } } #endif // OCONFIG_H diff --git a/libopie2/opiecore/odebug.h b/libopie2/opiecore/odebug.h index 21a6c26..18dc09e 100644 --- a/libopie2/opiecore/odebug.h +++ b/libopie2/opiecore/odebug.h @@ -323,169 +323,169 @@ class ondbgstream { * Does nothing. * @return this stream */ ondbgstream &operator<<(char ) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &operator<<(unsigned char ) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &operator<<(int ) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &operator<<(unsigned int ) { return *this; } /** * Does nothing. */ void flush() {} /** * Does nothing. * @return this stream */ ondbgstream &operator<<(const QString& ) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &operator<<(const QCString& ) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &operator<<(const char *) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator<<(const void *) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator<<(void *) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator<<(double) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator<<(long) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator<<(unsigned long) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream& operator << (QWidget*) { return *this; } /** * Does nothing. * @return this stream */ ondbgstream &form(const char *, ...) { return *this; } ondbgstream& operator<<( const QDateTime& ) { return *this; } ondbgstream& operator<<( const QDate& ) { return *this; } ondbgstream& operator<<( const QTime& ) { return *this; } ondbgstream& operator<<( const QPoint & ) { return *this; } ondbgstream& operator<<( const QSize & ) { return *this; } ondbgstream& operator<<( const QRect & ) { return *this; } ondbgstream& operator<<( const QRegion & ) { return *this; } ondbgstream& operator<<( const QStringList & ) { return *this; } ondbgstream& operator<<( const QColor & ) { return *this; } ondbgstream& operator<<( const QBrush & ) { return *this; } private: class Private; Private *d; }; /*====================================================================================== * related functions *======================================================================================*/ /** * Does nothing. - * @param a stream + * @param s stream * @return the given @p s */ inline ondbgstream& endl( ondbgstream & s) { return s; } /** * Does nothing. - * @param a stream + * @param s stream * @return the given @p s */ inline ondbgstream& flush( ondbgstream & s) { return s; } inline ondbgstream& perror( ondbgstream & s) { return s; } /** * Returns a debug stream. You can use it to print debug * information. * @param area an id to identify the output, 0 for default */ odbgstream odDebug(int area = 0); odbgstream odDebug(bool cond, int area = 0); /** * Returns a backtrace. * @param levels the number of levels (-1 for unlimited) of the backtrace * @return a backtrace */ QString odBacktrace(int levels = -1); /** * Returns a dummy debug stream. The stream does not print anything. * @param area an id to identify the output, 0 for default * @see odDebug() */ -inline ondbgstream ondDebug(int = 0) { return ondbgstream(); } +inline ondbgstream ondDebug(int area = 0) { return ondbgstream(); } inline ondbgstream ondDebug(bool , int = 0) { return ondbgstream(); } inline QString ondBacktrace() { return QString::null; } inline QString ondBacktrace(int) { return QString::null; } /** * Returns a warning stream. You can use it to print warning * information. * @param area an id to identify the output, 0 for default */ odbgstream odWarning(int area = 0); odbgstream odWarning(bool cond, int area = 0); /** * Returns an error stream. You can use it to print error * information. * @param area an id to identify the output, 0 for default */ odbgstream odError(int area = 0); odbgstream odError(bool cond, int area = 0); /** * Returns a fatal error stream. You can use it to print fatal error * information. * @param area an id to identify the output, 0 for default */ odbgstream odFatal(int area = 0); odbgstream odFatal(bool cond, int area = 0); /** * Deletes the odebugrc cache and therefore forces KDebug to reread the * config file */ void odClearDebugConfig(); #ifdef OPIE_NO_DEBUG #define odDebug ondDebug #define odBacktrace ondBacktrace #endif } } #endif diff --git a/libopie2/opiecore/okeyconfigmanager.cpp b/libopie2/opiecore/okeyconfigmanager.cpp index 891cda7..48546bd 100644 --- a/libopie2/opiecore/okeyconfigmanager.cpp +++ b/libopie2/opiecore/okeyconfigmanager.cpp @@ -4,193 +4,193 @@ namespace Opie { namespace Core { namespace Internal { /* * the virtual and hardware key events have both issues... */ void fixupKeys( int& key, int &mod, QKeyEvent* e ) { key = e->key(); mod = e->state(); /* * virtual keyboard * else change the button mod only */ if ( key == 0 ) { key = e->ascii(); if ( key > 96 && key < 123) key -= 32; }else{ int new_mod = 0; if ( mod & 256 ) new_mod |= Qt::ShiftButton; else if ( mod & 512 ) new_mod |= Qt::ControlButton; else if ( mod & 1024 ) new_mod |= Qt::AltButton; mod = new_mod == 0? mod : new_mod; } } } /** * The default Constructor of a OKeyPair. * A Key and a Modifier ( Alt/Shift/Ctrl ) * needs to be supplied. * Use Qt::Key for the information. * The default arguments create an Empty OKeyPair. If you * want to get an empty OKeyPair use the static method for getting * the emptyKey() * * @see OKeyPair OKeyPair::emptyKey() */ OKeyPair::OKeyPair( int key, int mod ) : m_key( key ), m_mod( mod ) {} /** * The destructor */ OKeyPair::~OKeyPair() {} /** * Is this OKeyPair empty/valid? */ bool OKeyPair::isEmpty()const { return ( ( m_key == -1 )&& ( m_mod == -1 ) ); } /** * get the keycode for this OKeyPair. The Key relates to Qt::Key. * * @see Qt::Key * @see setKey */ int OKeyPair::keycode()const { return m_key; } /** * get the modifier key for this OKeyPair. The Modifier State relates * to the Qt::ButtonState * * @see Qt::ButtonState * @see setModifier */ int OKeyPair::modifier()const { return m_mod; } /** * Set the keycode * @param key The Keycode to set * * @see keycode() * @see Qt::Key */ void OKeyPair::setKeycode( int key ) { m_key = key; } /** * Set the modifier key * - * @param the Modifier key + * @param mod the Modifier key * @see Qt::ButtonState * @see modifier() */ void OKeyPair::setModifier( int mod ) { m_mod = mod; } /** * Return an OKeyPair for the Return Key without any modifier. */ OKeyPair OKeyPair::returnKey() { return OKeyPair( Qt::Key_Return, 0 ); } /** * Return an OKeyPair for the Left Arrow Key * without any modifier Key */ OKeyPair OKeyPair::leftArrowKey() { return OKeyPair( Qt::Key_Left, 0 ); } /** * Return an OKeyPair for the Right Arrow Key * without any modifier Key */ OKeyPair OKeyPair::rightArrowKey() { return OKeyPair( Qt::Key_Right, 0 ); } /** * Return an OKeyPair for the Up Arrow Key * without any modifier Key */ OKeyPair OKeyPair::upArrowKey() { return OKeyPair( Qt::Key_Up, 0 ); } /** * Return an OKeyPair for the Down Arrow Key * without any modifier Key */ OKeyPair OKeyPair::downArrowKey() { return OKeyPair( Qt::Key_Down, 0 ); } /** * Return an Empty OKeyPair */ OKeyPair OKeyPair::emptyKey() { return OKeyPair(); } /** * This functions uses the Opie::Core::ODevice::buttons * for OKeyPairList * * @see Opie::Core::ODevice * @see Opie::Core::ODeviceButton * @see Opie::Core::ODevice::button */ OKeyPair::List OKeyPair::hardwareKeys() { const QValueList<Opie::Core::ODeviceButton> but = Opie::Core::ODevice::inst()->buttons(); OKeyPair::List lst; for ( QValueList<Opie::Core::ODeviceButton>::ConstIterator it = but.begin(); it != but.end(); ++it ) lst.append( OKeyPair( (*it).keycode(), 0 ) ); return lst; } /** * Equals operator. Check if two OKeyPairs have the same key and modifier * @see operator!= */ bool OKeyPair::operator==( const OKeyPair& pair)const { if ( m_key != pair.m_key ) return false; if ( m_mod != pair.m_mod ) return false; return true; } /** * Not equal operator. calls the equal operator internally */ bool OKeyPair::operator!=( const OKeyPair& pair)const { return !(*this == pair); } /** * The normal Constructor to create a OKeyConfigItem * * You can set the the key paramater of this item but if diff --git a/libopie2/opiecore/okeyfilter.h b/libopie2/opiecore/okeyfilter.h index d183641..1871247 100644 --- a/libopie2/opiecore/okeyfilter.h +++ b/libopie2/opiecore/okeyfilter.h @@ -1,100 +1,100 @@ /* This file is part of the Opie Project =. Copyright (C) 2004 Rajko 'Alwin' Albrecht <alwin@handhelds.org> .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* QT */ #include <qwindowsystem_qws.h> #include <qvaluelist.h> namespace Opie { namespace Core { class ODevice; /** * A singleton which will manage all possible keyboard filters inside opie. * It makes sure that key handlers of odevice are checked first than the * keyfilters of software. * @short a keyfilter proxy * @see QWSServer::KeyboardFilter * @author Rajko Albrecht * @version 1.0 */ class OKeyFilter { friend class Opie::Core::ODevice; protected: /** * Protected constructor - generate class via inst() * @see inst() */ OKeyFilter(); /** * Protected constructor - generate class via inst() * @see inst() */ OKeyFilter(const OKeyFilter&){}; /** * Append filter to the primary list. * This is only allowed for friend classes from odevice * @param aFilter a filter to append * @see addHandler */ - virtual void addPreHandler(QWSServer::KeyboardFilter*aFilter)=0; + virtual void addPreHandler(QWSServer::KeyboardFilter *aFilter)=0; /** * Remove the specified filter from list and give back ownership. * This is only allowed for friend classes from odevice * @param aFilter a filter to remove * @see remHandler */ - virtual void remPreHandler(QWSServer::KeyboardFilter*aFilter)=0; + virtual void remPreHandler(QWSServer::KeyboardFilter *aFilter)=0; public: virtual ~OKeyFilter(); /** * Append filter to the secondary list. * @param aFilter a filter to append * @see addPreHandler */ - virtual void addHandler(QWSServer::KeyboardFilter*)=0; + virtual void addHandler(QWSServer::KeyboardFilter *aFilter)=0; /** * Remove the specified filter from list and give back ownership. * @param aFilter a filter to remove * @see remPreHandler */ - virtual void remHandler(QWSServer::KeyboardFilter*)=0; + virtual void remHandler(QWSServer::KeyboardFilter *aFilter)=0; /** * Returns a handler to an instance of OKeyFilter * @return a pointer to a working OKeyFilter */ static OKeyFilter*inst(); }; } } diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp index ec19fa0..2a6e369 100644 --- a/libopie2/opiecore/opluginloader.cpp +++ b/libopie2/opiecore/opluginloader.cpp @@ -430,427 +430,426 @@ QUnknownInterface* OGenericPluginLoader::load( const OPluginItem& item, const QU QLibrary *lib = Internal::OPluginLibraryHolder::self()->ref( pa ); if ( !lib ) { setSafeMode(); return 0l; } /** * try to load the plugin and just in case initialize the pointer to a pointer again */ QUnknownInterface* iface=0; if ( lib->queryInterface( uuid, &iface ) == QS_OK ) { installTranslators( item.name() ); m_library.insert( iface, lib ); }else iface = 0; setSafeMode(); return iface; } /** * @internal and reads in the safe mode */ void OGenericPluginLoader::readConfig() { /* read the config for SafeMode */ OConfig conf( m_dir + "-odpplugins" ); conf.setGroup( "General" ); m_isSafeMode = conf.readBoolEntry( "SafeMode", false ); } /** * @internal Enter or leave SafeMode */ void OGenericPluginLoader::setSafeMode(const QString& str, bool b) { OConfig conf( m_dir + "-odpplugins" ); conf.setGroup( "General" ); conf.writeEntry( "SafeMode", b ); conf.writeEntry( "CrashedPlugin", str ); } /** * @internal * * Set the List of Plugin Dirs to lst. Currently only QPEApplication::qpeDir()+"/plugins/"+mytype * is used as plugin dir */ void OGenericPluginLoader::setPluginDirs( const QStringList& lst ) { m_plugDirs = lst; } /** * * @internal * Set the Plugin Dir to str. Str will be the only element in the list of plugin dirs */ void OGenericPluginLoader::setPluginDir( const QString& str) { m_plugDirs.clear(); m_plugDirs.append( str ); } /** * @internal */ bool OGenericPluginLoader::isSorted()const{ return m_isSorted; } /* * make libfoo.so.1.0.0 -> foo on UNIX * make libfoo.dylib -> foo on MAC OS X Unix * windows is obviously missing */ /** * @internal */ QString OGenericPluginLoader::unlibify( const QString& str ) { QString st = str.mid( str.find( "lib" )+3 ); #ifdef Q_OS_MACX return st.left( st.findRev( ".dylib" ) ); #else return st.left( st.findRev( ".so" ) ); #endif } /** * @internal * * \brief method to return available plugins. Internal and for reeimplementations * *Return a List of Plugins for a dir and add positions and remove disabled. * If a plugin is on the excluded list assign position -2 * - * @param dir The dir to look in + * @param _dir The dir to look in * @param sorted Should positions be read? * @param disabled Remove excluded from the list */ OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorted, bool disabled )const { #ifdef Q_OS_MACX QDir dir( _dir, "lib*.dylib" ); #else QDir dir( _dir, "lib*.so" ); #endif OPluginItem::List lst; /* * get excluded list and then iterate over them * Excluded list contains the name * Position is a list with 'name.pos.name.pos.name.pos' * * For the look up we will create two QMap<QString,pos> */ QMap<QString, int> positionMap; QMap<QString, int> excludedMap; OConfig cfg( m_dir+"-odpplugins" ); cfg.setGroup( _dir ); QStringList excludes = cfg.readListEntry( "Excluded", ',' ); for ( QStringList::Iterator it = excludes.begin(); it != excludes.end(); ++it ) excludedMap.insert( *it, -2 ); if ( sorted ) { QStringList pos = cfg.readListEntry( "Positions", '.' ); QStringList::Iterator it = pos.begin(); QString tmp; int i; while ( it != pos.end() ) { tmp = *it++; i = (*it++).toInt(); positionMap.insert( tmp, i ); } } QStringList list = dir.entryList(); for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QString str = unlibify( *it ); OPluginItem item( str, _dir + "/" + *it ); bool ex = excludedMap.contains( str ); /* * if disabled but we should show all mark it as disabled * else continue because we don't want to add the item * else if sorted we assign the right position */ if ( ex && !disabled) item.setEnabled( false ); else if ( ex && disabled ) continue; else if ( sorted ) item.setPosition( positionMap[str] ); lst.append( item ); } return lst; } /** * @internal generate a list of languages from $LANG */ QStringList OGenericPluginLoader::languageList() { if ( m_languages.isEmpty() ) { /* * be_BY.CP1251 We will add, be_BY.CP1251,be_BY,be * to our list of languages. * Also for de_DE@euro we will add de_DE@eurp, de_DE, de * to our list of languages */ QString str = ::getenv( "LANG" ); m_languages += str; int pos = str.find( '@' ); if( pos > 0 ) m_languages += str.left( pos ); pos = str.find( '.' ); if ( pos > 0 ) m_languages += str.left( pos ); int n_pos = str.find( '_' ); if ( n_pos > 0 ) m_languages += str.left( n_pos ); } return m_languages; } /** * @internal * Tries to install languages using the languageList for the type */ void OGenericPluginLoader::installTranslators(const QString& type) { QStringList lst = languageList(); /* * for each language and maybe later for each language dir... * try to load a Translator */ for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { QTranslator* trans = new QTranslator( qApp ); QString tfn = QPEApplication::qpeDir()+"/i18n/" + *it + "/lib" + type + ".qm" ; /* * If loaded then install else clean up and don't leak */ if ( trans->load( tfn ) ) qApp->installTranslator( trans ); else delete trans; } } /** * \brief Simple c'tor. * * Simple C'tor same as the one of the base class. Additional this * class can cast for you if you nee it. * * * @param name The name of your plugin class * @param sorted If plugins are sorted * * @see OGenericPluginLoader */ OPluginLoader::OPluginLoader( const QString& name, bool sorted ) : OGenericPluginLoader( name, sorted ) { } /** * d'tor * @see OGenericPluginLoader::~OGenericPluginLoader */ OPluginLoader::~OPluginLoader() { } /** * \brief C'Tor using a OGenericPluginLoader * The C'tor. Pass your OGenericPluginLoader to manage * OGenericPluginLoader::allAvailable plugins. * * * @param loader A Pointer to your OGenericPluginLoader - * @param name The name */ OPluginManager::OPluginManager( OGenericPluginLoader* loader) : m_loader( loader ), m_isSorted( false ) { } /** * \brief Overloaded c'tor using a List of Plugins and a type name * Overloaded Constructor to work with a 'Type' of plugins * and a correspending list of those. In this case calling load * is a no operation. * * @param name The name of your plugin ('today','inputmethods','applets') * @param lst A List with plugins of your type to manage * @param isSorted If the List should be treated sorted */ OPluginManager::OPluginManager( const QString& name, const OPluginItem::List& lst, bool isSorted) : m_loader( 0l ), m_cfgName( name ), m_plugins( lst ), m_isSorted( isSorted ) { } /** * \brief A simple d'tor */ OPluginManager::~OPluginManager() { } /** * \brief Return the OPluginItem where loading is likely to have crashed on. * Return the Item that made the OGenericPluginLoader crash * the returned OPluginItem could be empty if no crash occured * which should apply most of the time. It could also be empty if the crashed * plugin is not in the current list of available/managed plugins * * @see OPluginItem::isEmpty * @return OPluginItem that crashed the loader */ OPluginItem OPluginManager::crashedPlugin()const { return m_crashed; } /** * \brief Return a list of plugins that are managed by this OPluginManager * * Return the list of managed plugins. This could either result * from passing a OGenericPluginLoader and calling load or by * giving name and a list of plugins. */ OPluginItem::List OPluginManager::managedPlugins()const { return m_plugins; } /** * \brief Set the position of the items * * Replace the OPluginItem with the name and path and this way * apply the new position. The search is linear and this way O(n/2) * You still need to call save() to make your changes effective. After saving * a call to OGenericPluginLoader::filtered() returns the newly configured order and items * * @param item The OPluginItem to be replaced internall * */ void OPluginManager::setPosition( const OPluginItem& item) { replace( item ); } /** * \brief Enable the item specified as argument * * This will make sure that OPluginItem::setEnabled is called and then will replace * the item with one that matches name and path internally. * @see setPosition * - * @param the Item to enable + * @param item the Item to enable */ void OPluginManager::enable( const OPluginItem& item ) { setEnabled( item, true ); } /** * \brief disable the Item. * * Disable the OPluginItem. Same applies as in * @see setPosition and @see enable * * @param item Item to disable */ void OPluginManager::disable( const OPluginItem& item) { setEnabled( item, false ); } /** * \brief Enable or disable the OPluginItem. * Depending on the value of the parameter this will either disable * or enable the pluginitem. * Beside that same as in @see disable, @see enable, @see setPosition * applies. * * @param _item The OPluginItem to enable or to disable. * @param b Enable or disable the plugin. * */ void OPluginManager::setEnabled( const OPluginItem& _item, bool b ) { OPluginItem item = _item; item.setEnabled( b ); replace( item ); } /** * \brief Load necessary information after constructing the object * If you speified a OGenericPluginLoader you need to call this method * so that this manager knows what to manage and have a right value for \sa crashedPlugin * For the name and the list of plugins this does only try to find out the crashed plugin */ void OPluginManager::load() { OConfig cfg( configName() ); cfg.setGroup( "General" ); QString crashedPath = cfg.readEntry( "CrashedPlugin" ); /* if we've a loader this applies if we were called from the first part */ if ( m_loader ) m_plugins = m_loader->allAvailable( m_loader->isSorted() ); /* fast and normal route if we did not crash... */ if ( crashedPath.isEmpty() ) return; /* lets try to find the plugin path and this way the associated item */ for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) if ( (*it).path() == crashedPath ) { m_crashed = *it; break; } } /** * \brief Save the values and this way make it available. * * Save the current set of data. A call to @see OGenericPluginLoader::filtered * now would return your saved changes. */ void OPluginManager::save() { QMap<QString, QStringList> excluded; // map for path to excluded name QMap<QString, QStringList> positions; // if positions matter contains splitted up by dirs bool sorted = m_loader ? m_loader->isSorted() : m_isSorted; /* * We will create some maps for the groups to include positions a */ for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) { OPluginItem item = *it; QString path = QFileInfo( item.path() ).dirPath(true); if ( sorted ) { positions[path].append( item.name() ); positions[path].append( QString::number( item.position() ) ); } if ( !item.isEnabled() ) excluded[path].append( item.name() ); if ( !excluded.contains( path ) ) excluded[path] = QString::null; } /* * The code below wouldn't work because we can't delete groups/keys from the config * ### for ODP make Config right! */ // if ( excluded.isEmpty() && positions.isEmpty() ) return; diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index be1436c..ac6be98 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h @@ -1,237 +1,237 @@ /* This file is part of the Opie Project Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> Copyright (C) The Opie Team <opie-devel@handhelds.org> =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OPROCESS_H #define OPROCESS_H /* QT */ #include <qcstring.h> #include <qobject.h> #include <qvaluelist.h> /* STD */ #include <sys/types.h> // for pid_t #include <sys/wait.h> #include <signal.h> #include <unistd.h> class QSocketNotifier; namespace Opie { namespace Core { namespace Internal { class OProcessController; class OProcessPrivate; } /** * Child process invocation, monitoring and control. * - * @sect General usage and features + * @par General usage and features * *This class allows a KDE and OPIE application to start child processes without having *to worry about UN*X signal handling issues and zombie process reaping. * *@see KProcIO * *Basically, this class distinguishes three different ways of running *child processes: * *@li OProcess::DontCare -- The child process is invoked and both the child *process and the parent process continue concurrently. * *Starting a DontCare child process means that the application is *not interested in any notification to determine whether the *child process has already exited or not. * *@li OProcess::NotifyOnExit -- The child process is invoked and both the *child and the parent process run concurrently. * *When the child process exits, the OProcess instance *corresponding to it emits the Qt signal @ref processExited(). * *Since this signal is @em not emitted from within a UN*X *signal handler, arbitrary function calls can be made. * *Be aware: When the OProcess objects gets destructed, the child *process will be killed if it is still running! *This means in particular, that you cannot use a OProcess on the stack *with OProcess::NotifyOnExit. * *@li OProcess::Block -- The child process starts and the parent process *is suspended until the child process exits. (@em Really not recommended *for programs with a GUI.) * *OProcess also provides several functions for determining the exit status *and the pid of the child process it represents. * *Furthermore it is possible to supply command-line arguments to the process *in a clean fashion (no null -- terminated stringlists and such...) * *A small usage example: *<pre> *OProcess *proc = new OProcess; * **proc << "my_executable"; **proc << "These" << "are" << "the" << "command" << "line" << "args"; *QApplication::connect(proc, SIGNAL(processExited(Opie::Core::OProcess *)), * pointer_to_my_object, SLOT(my_objects_slot(Opie::Core::OProcess *))); *proc->start(); *</pre> * *This will start "my_executable" with the commandline arguments "These"... * *When the child process exits, the respective Qt signal will be emitted. * - *@sect Communication with the child process + *@par Communication with the child process * *OProcess supports communication with the child process through *stdin/stdout/stderr. * *The following functions are provided for getting data from the child *process or sending data to the child's stdin (For more information, *have a look at the documentation of each function): * *@li bool @ref writeStdin(char *buffer, int buflen); *@li -- Transmit data to the child process's stdin. * *@li bool @ref closeStdin(); *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). *Returns false if you try to close stdin for a process that has been started *without a communication channel to stdin. * *@li bool @ref closeStdout(); *@li -- Closes the child process's stdout. *Returns false if you try to close stdout for a process that has been started *without a communication channel to stdout. * *@li bool @ref closeStderr(); *@li -- Closes the child process's stderr. *Returns false if you try to close stderr for a process that has been started *without a communication channel to stderr. * * - *@sect QT signals: + *@par QT signals: * *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); *@li -- Indicates that new data has arrived from either the *child process's stdout or stderr. * *@li void @ref wroteStdin(OProcess *proc); *@li -- Indicates that all data that has been sent to the child process *by a prior call to @ref writeStdin() has actually been transmitted to the *client . * *@author Christian Czezakte e9025461@student.tuwien.ac.at *@author Holger Freyther (Opie Port) * **/ class OProcess : public QObject { Q_OBJECT public: /** * Modes in which the communication channel can be opened. * * If communication for more than one channel is required, * the values have to be or'ed together, for example to get * communication with stdout as well as with stdin, you would * specify @p Stdin @p | @p Stdout * * If @p NoRead is specified in conjunction with @p Stdout, * no data is actually read from @p Stdout but only * the signal @ref childOutput(int fd) is emitted. */ enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, AllOutput = 6, All = 7, NoRead }; /** * Run-modes for a child process. */ enum RunMode { /** * The application does not receive notifications from the subprocess when * it is finished or aborted. */ DontCare, /** * The application is notified when the subprocess dies. */ NotifyOnExit, /** * The application is suspended until the started process is finished. */ Block }; /** * Constructor */ OProcess( QObject *parent = 0, const char *name = 0 ); /** * Constructor */ OProcess( const QString &arg0, QObject *parent = 0, const char *name = 0 ); /** * Constructor */ OProcess( const QStringList &args, QObject *parent = 0, const char *name = 0 ); /** *Destructor: * * If the process is running when the destructor for this class * is called, the child process is killed with a SIGKILL, but * only if the run mode is not of type @p DontCare. * Processes started as @p DontCare keep running anyway. */ virtual ~OProcess(); /** @deprecated The use of this function is now deprecated. -- Please use the "operator<<" instead of "setExecutable". Sets the executable to be started with this OProcess object. Returns false if the process is currently running (in that case the executable remains unchanged.) @see operator<< */ bool setExecutable( const QString& proc ); /** * Sets the executable and the command line argument list for this process. @@ -398,225 +398,227 @@ public: * * @return @p false if no communication to the process's stderr * had been specified in the call to @ref start(). */ bool closeStderr(); /** * Lets you see what your arguments are for debugging. * \todo make const */ const QValueList<QCString> &args() { return arguments; } /** * Controls whether the started process should drop any * setuid/segid privileges or whether it should keep them * * The default is @p false : drop privileges */ void setRunPrivileged( bool keepPrivileges ); /** * Returns whether the started process will drop any * setuid/segid privileges or whether it will keep them */ bool runPrivileged() const; /** * Modifies the environment of the process to be started. * This function must be called before starting the process. */ void setEnvironment( const QString &name, const QString &value ); /** * Changes the current working directory (CWD) of the process * to be started. * This function must be called before starting the process. */ void setWorkingDirectory( const QString &dir ); /** * Specify whether to start the command via a shell or directly. * The default is to start the command directly. * If @p useShell is true @p shell will be used as shell, or * if shell is empty, the standard shell is used. * @p quote A flag indicating whether to quote the arguments. * * When using a shell, the caller should make sure that all filenames etc. * are properly quoted when passed as argument. * @see quote() */ void setUseShell( bool useShell, const char *shell = 0 ); /** * This function can be used to quote an argument string such that * the shell processes it properly. This is e. g. necessary for * user-provided file names which may contain spaces or quotes. * It also prevents expansion of wild cards and environment variables. */ static QString quote( const QString &arg ); /** * Detaches OProcess from child process. All communication is closed. * No exit notification is emitted any more for the child process. * Deleting the OProcess will no longer kill the child process. * Note that the current process remains the parent process of the * child process. */ void detach(); /** * @return the PID of @a process, or -1 if the process is not running */ static int processPID( const QString& process ); signals: /** * Emitted after the process has terminated when * the process was run in the @p NotifyOnExit (==default option to * @ref start()) or the @ref Block mode. **/ void processExited( Opie::Core::OProcess *proc ); /** * Emitted, when output from the child process has * been received on stdout. * * To actually get * these signals, the respective communication link (stdout/stderr) * has to be turned on in @ref start(). * + * @param proc The process * @param buffer The data received. * @param buflen The number of bytes that are available. * * You should copy the information contained in @p buffer to your private * data structures before returning from this slot. **/ void receivedStdout( Opie::Core::OProcess *proc, char *buffer, int buflen ); /** * Emitted when output from the child process has * been received on stdout. * * To actually get these signals, the respective communications link * (stdout/stderr) has to be turned on in @ref start() and the * @p NoRead flag should have been passed. * * You will need to explicitly call resume() after your call to start() * to begin processing data from the child process's stdout. This is * to ensure that this signal is not emitted when no one is connected * to it, otherwise this signal will not be emitted. * * The data still has to be read from file descriptor @p fd. **/ void receivedStdout( int fd, int &len ); /** * Emitted, when output from the child process has * been received on stderr. * To actually get * these signals, the respective communication link (stdout/stderr) * has to be turned on in @ref start(). * + * @param proc The process * @param buffer The data received. * @param buflen The number of bytes that are available. * * You should copy the information contained in @p buffer to your private * data structures before returning from this slot. */ void receivedStderr( Opie::Core::OProcess *proc, char *buffer, int buflen ); /** * Emitted after all the data that has been * specified by a prior call to @ref writeStdin() has actually been * written to the child process. **/ void wroteStdin( Opie::Core::OProcess *proc ); protected slots: /** * This slot gets activated when data from the child's stdout arrives. * It usually calls "childOutput" */ void slotChildOutput( int fdno ); /** * This slot gets activated when data from the child's stderr arrives. * It usually calls "childError" */ void slotChildError( int fdno ); /* Slot functions for capturing stdout and stderr of the child */ /** * Called when another bulk of data can be sent to the child's * stdin. If there is no more data to be sent to stdin currently * available, this function must disable the QSocketNotifier "innot". */ void slotSendData( int dummy ); protected: /** * Sets up the environment according to the data passed via * setEnvironment(...) */ void setupEnvironment(); /** * The list of the process' command line arguments. The first entry * in this list is the executable itself. */ QValueList<QCString> arguments; /** * How to run the process (Block, NotifyOnExit, DontCare). You should * not modify this data member directly from derived classes. */ RunMode run_mode; /** * true if the process is currently running. You should not * modify this data member directly from derived classes. For * reading the value of this data member, please use "isRunning()" * since "runs" will probably be made private in later versions * of OProcess. */ bool runs; /** * The PID of the currently running process (see "getPid()"). * You should not modify this data member in derived classes. * Please use "getPid()" instead of directly accessing this * member function since it will probably be made private in * later versions of OProcess. */ pid_t pid_; /** * The process' exit status as returned by "waitpid". You should not * modify the value of this data member from derived classes. You should * rather use @ref exitStatus than accessing this data member directly * since it will probably be made private in further versions of * OProcess. */ int status; /** * See setRunPrivileged() */ bool keepPrivs; /* Functions for setting up the sockets for communication. setupCommunication -- is called from "start" before "fork"ing. commSetupDoneP -- completes communication socket setup in the parent diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h index 4f86d5b..4422741 100644 --- a/libopie2/opieui/oimageeffect.h +++ b/libopie2/opieui/oimageeffect.h @@ -126,282 +126,282 @@ public: * @param opacity opacity (in percent) which determines how much the source * image will be blended into the destination image. * @return The destination image (dst) containing the result. */ static QImage& blend(QImage& src, QImage& dst, float opacity); /** * Blend the provided image into a background of the indicated color. * * @param initial_intensity this parameter takes values from -1 to 1: * a) if positive: how much to fade the image in its * less affected spot * b) if negative: roughly indicates how much of the image * remains unaffected * @param bgnd indicates the color of the background to blend in * @param eff lets you choose what kind of blending you like * @param anti_dir blend in the opposite direction (makes no much sense * with concentric blending effects) * @param image must be 32bpp */ static QImage& blend(QImage &image, float initial_intensity, const QColor &bgnd, GradientType eff, bool anti_dir=false); /** * Blend an image into another one, using a gradient type * for blending from one to another. * * @param image1 source1 and result of blending * @param image2 source2 of blending * @param gt gradient type for blending between source1 and source2 * @param xf x decay length for unbalanced gradient tpye * @param yf y decay length for unbalanced gradient tpye */ static QImage& blend(QImage &image1,QImage &image2, GradientType gt, int xf=100, int yf=100); /** * Blend an image into another one, using a color channel of a * third image for the decision of blending from one to another. * * @param image1 Source 1 and result of blending * @param image2 Source 2 of blending * @param blendImage If the gray value of of pixel is 0, the result * for this pixel is that of image1; for a gray value * of 1, the pixel of image2 is used; for a value * inbetween, a corresponding blending is used. * @param channel The RBG channel to use for the blending decision. */ static QImage& blend(QImage &image1, QImage &image2, QImage &blendImage, RGBComponent channel); /** * Blend an image into another one, using alpha in the expected way. * @author Rik Hemsley (rikkus) <rik@kde.org> */ static bool blend(const QImage & upper, const QImage & lower, QImage & output); // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); /** * Blend an image into another one, using alpha in the expected way and * over coordinates @p x and @p y with respect to the lower image. * The output is a QImage which is the @p upper image already blended * with the @p lower one, so its size will be (in general) the same than * @p upper instead of the same size than @p lower like the method above. * In fact, the size of @p output is like upper's one only when it can be * painted on lower, if there has to be some clipping, output's size will * be the clipped area and x and y will be set to the correct up-left corner * where the clipped rectangle begins. */ static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); /** * Blend an image into another one, using alpha in the expected way and * over coordinates @p x and @p y with respect to the lower image. * The output is painted in the own @p lower image. This is an optimization * of the blend method above provided by convenience. */ static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); /** * Modifies the intensity of a pixmap's RGB channel component. * * @author Daniel M. Duley (mosfet) * @param image The QImage to process. * @param percent Percent value. Use a negative value to dim. * @param channel Which channel(s) should be modified * @return The @p image, provided for convenience. */ static QImage& channelIntensity(QImage &image, float percent, RGBComponent channel); /** * Fade an image to a certain background color. * * The number of colors will not be changed. * - * @param image The QImage to process. + * @param img The QImage to process. * @param val The strength of the effect. 0 <= val <= 1. * @param color The background color. * @return Returns the @ref image(), provided for convenience. */ static QImage& fade(QImage &img, float val, const QColor &color); /** * This recolors a pixmap. The most dark color will become color a, * the most bright one color b, and in between. * * @param image A QImage to process. * @param ca Color a * @param cb Color b */ static QImage& flatten(QImage &image, const QColor &ca, const QColor &cb, int ncols=0); /** * Build a hash on any given @ref QImage * * @param image The QImage to process * @param lite The hash faces the indicated lighting (cardinal poles). * @param spacing How many unmodified pixels inbetween hashes. * @return Returns the @ref image(), provided for convenience. */ static QImage& hash(QImage &image, Lighting lite=NorthLite, unsigned int spacing=0); /** * Either brighten or dim the image by a specified percent. * For example, .50 will modify the colors by 50%. * * @author Daniel M. Duley (mosfet) * @param image The QImage to process. * @param percent The percent value. Use a negative value to dim. * @return Returns The @ref image(), provided for convenience. */ static QImage& intensity(QImage &image, float percent); /** * Modulate the image with a color channel of another image. * * @param image The QImage to modulate and result. * @param modImage The QImage to use for modulation. * @param reverse Invert the meaning of image/modImage; result is image! * @param type The modulation Type to use. * @param factor The modulation amplitude; with 0 no effect [-200;200]. * @param channel The RBG channel of image2 to use for modulation. * @return Returns the @ref image(), provided for convenience. */ static QImage& modulate(QImage &image, QImage &modImage, bool reverse, ModulationType type, int factor, RGBComponent channel); /** * Convert an image to grayscale. * * @author Daniel M. Duley (mosfet) * @param image The @ref QImage to process. * @param fast Set to @p true in order to use a faster but non-photographic * quality algorithm. Appropriate for things such as toolbar icons. * @return Returns the @ref image(), provided for convenience. */ static QImage& toGray(QImage &image, bool fast = false); /** * Desaturate an image evenly. * * @param image The QImage to process. * @param desat A value between 0 and 1 setting the degree of desaturation * @return Returns the @ref image(), provided for convenience. */ static QImage& desaturate(QImage &image, float desat = 0.3); /** * Fast, but low quality contrast of an image. Also see contrastHSV. * * @author Daniel M. Duley (mosfet) * @param image The QImage to process. * @param c A contrast value between -255 to 255. * @return The @ref image(), provided for convenience. */ static QImage& contrast(QImage &image, int c); /** * Dither an image using Floyd-Steinberg dithering for low-color * situations. * - * @param image The QImage to process. + * @param img The QImage to process. * @param palette The color palette to use * @param size The size of the palette * @return Returns the @ref image(), provided for convenience. */ static QImage& dither(QImage &img, const QColor *palette, int size); /** * Calculate the image for a selected image, for instance a selected icon * on the desktop. * @param img the QImage to select * @param col the selected color, usually from QColorGroup::highlight(). */ static QImage& selectedImage( QImage &img, const QColor &col ); /** * High quality, expensive HSV contrast. You can do a faster one by just * taking a intensity threshold (ie: 128) and incrementing RGB color * channels above it and decrementing those below it, but this gives much * better results. * * @author Daniel M. Duley (mosfet) * @param img The QImage to process. * @param sharpen If true sharpness is increase, (spiffed). Otherwise * it is decreased, (dulled). */ static void contrastHSV(QImage &img, bool sharpen=true); /** * Normalizes the pixel values to span the full range of color values. * This is a contrast enhancement technique. * @author Daniel M. Duley (mosfet) */ static void normalize(QImage &img); /** * Performs histogram equalization on the reference * image. * @author Daniel M. Duley (mosfet) */ static void equalize(QImage &img); /** * Thresholds the reference image. You can also threshold images by using * ThresholdDither in the various QPixmap/QImage convert methods, but this * lets you specify a threshold value. * * @author Daniel M. Duley (mosfet) * @param img The QImage to process. * @param value The threshold value. */ static void threshold(QImage &img, unsigned int value=128); /** * Produces a 'solarization' effect seen when exposing a photographic * film to light during the development process. * * @author Daniel M. Duley (mosfet) * @param img The QImage to process. * @param factor The extent of the solarization (0-99.9) */ static void solarize(QImage &img, double factor=50.0); /** * Embosses the source image. This involves highlighting the edges * and applying various other enhancements in order to get a metal * effect. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @return The embossed image. The original is not changed. */ static QImage emboss(QImage &src); /** * Minimizes speckle noise in the source image using the 8 hull * algorithm. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @return The despeckled image. The original is not changed. */ static QImage despeckle(QImage &src); /** * Produces a neat little "charcoal" effect. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param factor The factor for detecting lines (0-99.0). * @return The charcoal image. The original is not changed. */ static QImage charcoal(QImage &src, double factor=50.0); /** * Rotates the image by the specified amount * @@ -437,128 +437,128 @@ public: /** * Blurs an image by convolving pixel neighborhoods. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param factor The percent weight to give to the center pixel. * @return The blurred image. The original is not changed. */ static QImage blur(QImage &src, double factor=50.0); /** * Detects edges in an image using pixel neighborhoods and an edge * detection mask. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param factor The percent weight to give to the center pixel. * @return The image with edges detected. The original is not changed. */ static QImage edge(QImage &src, double factor=50.0); /** * Implodes an image by a specified percent. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param factor The extent of the implosion. * @param background An RGBA value to use for the background. After the * effect some pixels may be "empty". This value is used for those pixels. * @return The imploded image. The original is not changed. */ static QImage implode(QImage &src, double factor=30.0, unsigned int background = 0xFFFFFFFF); /** * Produces an oil painting effect. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param radius The radius of the pixel neighborhood used in applying the * effect. * @return The new image. The original is not changed. */ static QImage oilPaint(QImage &src, int radius=3); /** * Sharpens the pixels in the image using pixel neighborhoods. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param factor The percent weight to give to the center pixel. * @return The sharpened image. The original is not changed. */ static QImage sharpen(QImage &src, double factor=30.0); /** * Randomly displaces pixels. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param amount The vicinity for choosing a random pixel to swap. * @return The image with pixels displaced. The original is not changed. */ static QImage spread(QImage &src, unsigned int amount=3); /** * Shades the image using a distance light source. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param color_shading If true do color shading, otherwise do grayscale. * @param azimuth Determines the light source and direction. * @param elevation Determines the light source and direction. * @return The shaded image. The original is not changed. */ static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, double elevation=30.0); /** * Swirls the image by a specified amount * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param degrees The tightness of the swirl. * @param background An RGBA value to use for the background. After the * effect some pixels may be "empty". This value is used for those pixels. * @return The swirled image. The original is not changed. */ static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = 0xFFFFFFFF); /** * Modifies the pixels along a sine wave. * * @author Daniel M. Duley (mosfet) * @param src The QImage to process. * @param amplitude The amplitude of the sine wave. - * @param wavelength The frequency of the sine wave. + * @param frequency The frequency of the sine wave. * @return The new image. The original is not changed. */ static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, unsigned int background = 0xFFFFFFFF); private: /** * Helper function to fast calc some altered (lighten, shaded) colors * */ static unsigned int lHash(unsigned int c); static unsigned int uHash(unsigned int c); /** * Helper function to find the nearest color to the RBG triplet */ static int nearestColor( int r, int g, int b, const QColor *pal, int size ); static void hull(const int x_offset, const int y_offset, const int polarity, const int width, const int height, unsigned int *f, unsigned int *g); static unsigned int generateNoise(unsigned int pixel, NoiseType type); static unsigned int interpolateColor(QImage *image, double x, double y, unsigned int background); }; } } #endif diff --git a/libopie2/opieui/opixmapeffect.h b/libopie2/opieui/opixmapeffect.h index b780f9f..85a1e25 100644 --- a/libopie2/opieui/opixmapeffect.h +++ b/libopie2/opieui/opixmapeffect.h @@ -59,161 +59,156 @@ public: * An unbalanced gradient is a gradient where the transition from * color a to color b is not linear, but in this case, exponential. * * @param pixmap The pixmap that should be written. * @param ca Color a. * @param cb Color b. * @param type The type of gradient. * @param xfactor The x decay length. Use a value between -200 and 200. * @param yfactor The y decay length. * @param ncols The number of colors. See #gradient. * @return The generated pixmap, for convencience. */ static OPixmap& unbalancedGradient(OPixmap& pixmap, const QColor &ca, const QColor &cb, GradientType type, int xfactor = 100, int yfactor = 100, int ncols=3); /** * Creates a pixmap of a given size with the given pixmap. * * if the * given size is bigger than the size of the pixmap, the pixmap is * tiled. * * @param pixmap This is the source pixmap * @param size The size the new pixmap should have. * @return The generated, tiled pixmap. */ static OPixmap createTiled(const OPixmap& pixmap, QSize size); /** * Either brightens or dims a pixmap by a specified ratio. * * @param pixmap The pixmap to process. * @param ratio The ratio to use. Use negative value to dim. * @return Returns The @ref pixmap(), provided for convenience. */ static OPixmap& intensity(OPixmap& pixmap, float ratio); /** * Modifies the intensity of a pixmap's RGB channel component. * * @param pixmap The pixmap to process. * @param ratio value. Use negative value to dim. * @param channel Which channel(s) should be modified * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& channelIntensity(OPixmap& pixmap, float ratio, RGBComponent channel); /** * Blends the provided pixmap into a background of the indicated color. * * @param pixmap The pixmap to process. * @param initial_intensity this parameter takes values from -1 to 1: * @li If positive, it tells how much to fade the image in its * less affected spot. * @li If negative, it tells roughly indicates how much of the image * remains unaffected * @param bgnd Indicates the color of the background to blend in. * @param eff Lets you choose what kind of blending you like. * @param anti_dir Blend in the opposite direction (makes no much sense * with concentric blending effects). * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& blend(OPixmap& pixmap, float initial_intensity, const QColor &bgnd, GradientType eff, bool anti_dir=false, int ncols=3); /** * Builds a hash on any given pixmap. * * @param pixmap The pixmap to process. * @param lite The hash faces the indicated lighting (cardinal poles) * @param spacing How many unmodified pixels inbetween hashes. * @return Returns The @ref pixmap(), provided for convenience. */ static OPixmap& hash(OPixmap& pixmap, Lighting lite=NorthLite, unsigned int spacing=0, int ncols=3); /** * Creates a pattern from a pixmap. * * The given pixmap is "flattened" * between color a to color b. * * @param pixmap The pixmap to process. * @param ca Color a. * @param cb Color b. * @param ncols The number of colors to use. The image will be * dithered to this depth. Pass zero to prevent dithering. * @return The @ref pixmap(), provided for convenience. */ static OPixmap pattern(const OPixmap& pixmap, QSize size, const QColor &ca, const QColor &cb, int ncols=8); /** - * Recolors a pixmap. - * - * The most dark color will become color a, - * the most bright one color b, and in between. + * Fades a pixmap to a certain color. * * @param pixmap The pixmap to process. - * @param ca Color a. - * @param cb Color b. - * @param ncols The number of colors to use. Pass zero to prevent - * dithering. + * @param val The strength of the effect. 0 <= val <= 1. + * @param color The color to blend to. * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& fade(OPixmap& pixmap, double val, const QColor &color); /** * Converts a pixmap to grayscale. * * @param pixmap The pixmap to process. * @param fast Set to @p true in order to use a faster but non-photographic * quality algorithm. Appropriate for things such as toolbar icons. * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& toGray(OPixmap& pixmap, bool fast=false); /** * Desaturates a pixmap. * * @param pixmap The pixmap to process. * @param desat A value between 0 and 1 setting the degree of desaturation * @return Returns The @ref pixmap(), provided for convenience. */ static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); /** * Modifies the contrast of a pixmap. * * @param pixmap The pixmap to process. * @param c A contrast value between -255 and 255. * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& contrast(OPixmap& pixmap, int c); /** * Dithers a pixmap using Floyd-Steinberg dithering for low-color * situations. * * @param pixmap The pixmap to process. * @param palette The color palette to use. * @param size The size of the palette. * @return Returns the @ref pixmap(), provided for convenience. */ static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); /** * Calculate a 'selected' pixmap, for instance a selected icon * on the desktop. * @param pixmap the pixmap to select * @param col the selected color, usually from QColorGroup::highlight(). */ static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); }; } } #endif diff --git a/libopie2/qt3/opieui/ocombobox.h b/libopie2/qt3/opieui/ocombobox.h index 4e35b61..3f60f54 100644 --- a/libopie2/qt3/opieui/ocombobox.h +++ b/libopie2/qt3/opieui/ocombobox.h @@ -1,196 +1,196 @@ /* This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> is part of the Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> Opie Project Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org> =. Originally part of the KDE projects .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OCOMBOBOX_H #define OCOMBOBOX_H /* QT */ #include <qcombobox.h> /* OPIE */ #include <opie2/olineedit.h> #include <opie2/ocompletion.h> #include <opie2/ocompletionbase.h> /* FORWARDS */ class QListBoxItem; class QPopupMenu; class OCompletionBox; typedef QString OURL; /** * A combined button, line-edit and a popup list widget. * - * @sect Detail + * @par Detail * * This widget inherits from @ref QComboBox and implements * the following additional functionalities: a completion * object that provides both automatic and manual text * completion as well as text rotation features, configurable * key-bindings to activate these features, and a popup-menu * item that can be used to allow the user to set text completion * modes on the fly based on their preference. * * To support these new features OComboBox also emits a few * more additional signals as well. The main ones are the * @ref completion( const QString& ) and @ref textRotation( KeyBindingType ) * signals. The completion signal is intended to be connected to a slot * that will assist the user in filling out the remaining text while * the rotation signals is intended to be used to traverse through all * possible matches whenever text completion results in multiple matches. * The @ref returnPressed() and @ref returnPressed( const QString& ) * signal is emitted when the user presses the Enter/Return key. * * This widget by default creates a completion object when you invoke * the @ref completionObject( bool ) member function for the first time * or use @ref setCompletionObject( OCompletion*, bool ) to assign your * own completion object. Additionally, to make this widget more functional, * OComboBox will by default handle the text rotation and completion * events internally whenever a completion object is created through either * one of the methods mentioned above. If you do not need this functionality, * simply use @ref OCompletionBase::setHandleSignals( bool ) or alternatively * set the boolean parameter in the above methods to FALSE. * * The default key-bindings for completion and rotation is determined * from the global settings in @ref OStdAccel. These values, however, * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). * The values can easily be reverted back to the default setting, by simply * calling @ref useGlobalSettings(). An alternate method would be to default * individual key-bindings by usning @ref setKeyBinding() with the default * second argument. * * Note that if this widget is not editable ( i.e. select-only ), then only * one completion mode, @p CompletionAuto, will work. All the other modes are * simply ignored. The @p CompletionAuto mode in this case allows you to * automatically select an item from the list by trying to match the pressed * keycode with the first letter of the enteries in the combo box. * - * @sect Useage + * @par Usage * * To enable the basic completion feature: * * <pre> * OComboBox *combo = new OComboBox( true, this, "mywidget" ); * OCompletion *comp = combo->completionObject(); * // Connect to the return pressed signal - optional * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); * </pre> * * To use your own completion object: * * <pre> * OComboBox *combo = new OComboBox( this,"mywidget" ); * OURLCompletion *comp = new OURLCompletion(); * combo->setCompletionObject( comp ); * // Connect to the return pressed signal - optional * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); * </pre> * * Note that you have to either delete the allocated completion object * when you don't need it anymore, or call * setAutoDeleteCompletionObject( true ); * * Miscellaneous function calls: * * <pre> * // Tell the widget not to handle completion and rotation * combo->setHandleSignals( false ); * // Set your own completion key for manual completions. * combo->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); * // Hide the context (popup) menu * combo->setContextMenuEnabled( false ); * // Temporarly disable signal emition * combo->disableSignals(); * // Default the all key-bindings to their system-wide settings. * combo->useGlobalKeyBindings(); * </pre> * * @short An enhanced combo box. * @author Dawit Alemayehu <adawit@kde.org> */ class OComboBox : public QComboBox, public OCompletionBase { Q_OBJECT //Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) //Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) //Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) public: /** * Constructs a read-only or rather select-only combo box with a * parent object and a name. * * @param parent The parent object of this widget * @param name The name of this widget */ OComboBox( QWidget *parent=0, const char *name=0 ); /** * Constructs a "read-write" or "read-only" combo box depending on * the value of the first argument( @p rw ) with a parent, a * name. * * @param rw When @p true, widget will be editable. * @param parent The parent object of this widget. * @param name The name of this widget. */ OComboBox( bool rw, QWidget *parent=0, const char *name=0 ); /** * Destructor. */ virtual ~OComboBox(); /** * Sets @p url into the edit field of the combobox. It uses * @ref OURL::prettyURL() so that the url is properly decoded for * displaying. */ //void setEditURL( const OURL& url ); /** * Inserts @p url at position @p index into the combobox. The item will * be appended if @p index is negative. @ref OURL::prettyURL() is used * so that the url is properly decoded for displaying. */ //void insertURL( const OURL& url, int index = -1 ); /** * Inserts @p url with the pixmap &p pixmap at position @p index into * the combobox. The item will be appended if @p index is negative. * @ref OURL::prettyURL() is used so that the url is properly decoded * for displaying. diff --git a/libopie2/qt3/opieui/olineedit.h b/libopie2/qt3/opieui/olineedit.h index ecfca27..db3d7ef 100644 --- a/libopie2/qt3/opieui/olineedit.h +++ b/libopie2/qt3/opieui/olineedit.h @@ -1,224 +1,224 @@ /* This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> is part of the Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>, Dawit Alemayehu <adawit@kde.org> Opie Project Copyright (C) 1999 Preston Brown <pbrown@kde.org>, Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com> Copyright (C) 1997 Sven Radej (sven.radej@iname.com) =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OLINEEDIT_H #define OLINEEDIT_H /* QT */ #include <qlineedit.h> /* OPIE */ #include <opie2/ocompletion.h> #include <opie2/ocompletionbase.h> class QPopupMenu; class OCompletionBox; typedef QString KURL; //class KURL; /** * An enhanced QLineEdit widget for inputting text. * - * @sect Detail + * @par Detail * * This widget inherits from @ref QLineEdit and implements the following * additional functionalities: q completion object that provides both * automatic and manual text completion as well as multiple match iteration * features, configurable key-bindings to activate these features and a * popup-menu item that can be used to allow the user to set text completion * modes on the fly based on their preference. * * To support these new features OLineEdit also emits a few more * additional signals. These are: @ref completion( const QString& ), * textRotation( KeyBindingType ), and @ref returnPressed( const QString& ). * The completion signal can be connected to a slot that will assist the * user in filling out the remaining text. The text rotation signal is * intended to be used to iterate through the list of all possible matches * whenever there is more than one match for the entered text. The * @p returnPressed( const QString& ) signals are the same as QLineEdit's * except it provides the current text in the widget as its argument whenever * appropriate. * * This widget by default creates a completion object when you invoke * the @ref completionObject( bool ) member function for the first time or * use @ref setCompletionObject( OCompletion*, bool ) to assign your own * completion object. Additionally, to make this widget more functional, * OLineEdit will by default handle the text rotation and completion * events internally when a completion object is created through either one * of the methods mentioned above. If you do not need this functionality, * simply use @ref OCompletionBase::setHandleSignals( bool ) or set the * boolean parameter in the above functions to FALSE. * * The default key-bindings for completion and rotation is determined * from the global settings in @ref OStdAccel. These values, however, * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). * The values can easily be reverted back to the default setting, by simply * calling @ref useGlobalSettings(). An alternate method would be to default * individual key-bindings by usning @ref setKeyBinding() with the default * second argument. * * NOTE that if the @p EchoMode for this widget is set to something other * than @p QLineEdit::Normal, the completion mode will always be defaulted * to @ref PGlobalSettings::CompletionNone. This is done purposefully to guard * against protected entries such as passwords being cached in @ref OCompletion's * list. Hence, if the @p EchoMode is not @ref QLineEdit::Normal, the completion * mode is automatically disabled. * - * @sect Useage + * @par Usage * * To enable the basic completion feature : * * <pre> * OLineEdit *edit = new OLineEdit( this, "mywidget" ); * OCompletion *comp = edit->completionObject(); * // Fill the completion object with a list of possible matches * QStringList list; * list << "mickeyl@handhelds.org" << "mickey@tm.informatik.uni-frankfurt.de>" << "mickey@Vanille.de"; * comp->setItems( list ); * // Connect to the return pressed signal (optional) * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); * </pre> * * To use a customized completion objects or your * own completion object : * * <pre> * OLineEdit *edit = new OLineEdit( this,"mywidget" ); * KURLCompletion *comp = new KURLCompletion(); * edit->setCompletionObject( comp ); * // Connect to the return pressed signal - optional * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); * </pre> * * Note that you have to either delete the allocated completion object * when you don't need it anymore, or call * setAutoDeleteCompletionObject( true ); * - * @sect Miscellaneous function calls : + * @par Miscellaneous function calls : * * <pre> * // Tell the widget not to handle completion and * // iteration internally. * edit->setHandleSignals( false ); * // Set your own completion key for manual completions. * edit->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); * // Hide the context (popup) menu * edit->setContextMenuEnabled( false ); * // Temporarly disable signal emitions * // (both completion & iteration signals) * edit->disableSignals(); * // Default the key-bindings to system settings. * edit->useGlobalKeyBindings(); * </pre> * * @short An enhanced single line input widget. * @author Dawit Alemayehu <adawit@kde.org> * @author Opie adaption by Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> */ class OLineEdit : public QLineEdit, public OCompletionBase { friend class OComboBox; Q_OBJECT Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) public: /** * Constructs a OLineEdit object with a default text, a parent, * and a name. * * @param string Text to be shown in the edit widget. * @param parent The parent object of this widget. * @param name the name of this widget */ OLineEdit( const QString &string, QWidget *parent, const char *name = 0 ); /** * Constructs a OLineEdit object with a parent and a name. * * @param string Text to be shown in the edit widget. * @param parent The parent object of this widget. * @param name The name of this widget. */ OLineEdit ( QWidget *parent=0, const char *name=0 ); /** * Destructor. */ virtual ~OLineEdit (); /** * Sets @p url into the lineedit. It uses @ref KURL::prettyURL() so * that the url is properly decoded for displaying. */ void setURL( const KURL& url ); /** * Puts the text cursor at the end of the string. * * This method is deprecated. Use @ref QLineEdit::end() * instead. * * @deprecated * @ref QLineEdit::end() */ void cursorAtEnd() { end( false ); } /** * Re-implemented from @ref OCompletionBase for internal reasons. * * This function is re-implemented in order to make sure that * the EchoMode is acceptable before we set the completion mode. * * See @ref OCompletionBase::setCompletionMode */ virtual void setCompletionMode( OGlobalSettings::Completion mode ); /** * Enables/disables the popup (context) menu. * * Note that when this function is invoked with its argument * set to @p true, then both the context menu and the completion * menu item are enabled. If you do not want to the completion * item to be visible simply invoke @ref hideModechanger() right * after calling this method. Also by default, the context * menu is automatically created if this widget is editable. Thus * you need to call this function with the argument set to false * if you do not want this behaviour. * * @param showMenu If @p true, show the context menu. */ |