-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 |
11 files changed, 30 insertions, 34 deletions
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 @@ -273,134 +273,134 @@ bool ODevice::suspend() 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; } 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 @@ -66,98 +66,98 @@ class OConfig : public Config /** * @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 @@ -355,137 +355,137 @@ class ondbgstream { 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 @@ -36,129 +36,129 @@ namespace Internal { /** * 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; 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 @@ -4,97 +4,97 @@ .=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 @@ -462,129 +462,129 @@ void OGenericPluginLoader::readConfig() { /** * @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] ); @@ -620,205 +620,204 @@ QStringList OGenericPluginLoader::languageList() { 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. 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,205 +1,205 @@ /* 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 ); /** @@ -430,161 +430,163 @@ public: * 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. */ 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 @@ -158,218 +158,218 @@ public: * @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 @@ -469,96 +469,96 @@ public: 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 @@ -91,129 +91,124 @@ public: * @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,164 +1,164 @@ /* 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 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,192 +1,192 @@ /* 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. * |