#include <stdlib.h>
-/* XPM */
-static const char* pixmap_not_found_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #A80000",
-" ",
-" ",
-" . . ",
-" .+. .+. ",
-" .+++. .+++. ",
-" .+++.+++. ",
-" .+++++. ",
-" .+++. ",
-" .+++++. ",
-" .+++.+++. ",
-" .+++. .+++. ",
-" .+. .+. ",
-" . . ",
-" ",
-" ",
-" "};
-
/*!
- Class: QtxResourceMgr::Resources
- Level: Internal
+ Class: QtxResourceMgr::Resources
+ Level: Internal
*/
QtxResourceMgr::Resources::Resources( const QString& fileName )
else
res = false;
}
- else
+ else
res = paramNode.isComment();
paramNode = paramNode.nextSibling();
return res;
}
-QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const bool useDefault ) const
+QPixmap QtxResourceMgr::defaultPixmap() const
+{
+ return myDefaultPix;
+}
+
+void QtxResourceMgr::setDefaultPixmap( const QPixmap& pix )
+{
+ myDefaultPix = pix;
+}
+
+QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name ) const
+{
+ return loadPixmap( prefix, name, true );
+}
+
+QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const bool useDef ) const
+{
+ return loadPixmap( prefix, name, useDef ? defaultPixmap() : QPixmap() );
+}
+
+QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const QPixmap& defPix ) const
{
initialize();
- static QPixmap defaultPixmap( pixmap_not_found_xpm );
QPixmap pix;
for ( ResListIterator it( myResources ); it.current() && pix.isNull(); ++it )
pix = it.current()->loadPixmap( resSection(), prefix, name );
- if ( pix.isNull() && useDefault )
- return defaultPixmap;
+ if ( pix.isNull() )
+ pix = defPix;
return pix;
}
#include <qmap.h>
#include <qcolor.h>
+#include <qpixmap.h>
#include <qstringlist.h>
#include <qtranslator.h>
QString option( const QString& ) const;
void setOption( const QString&, const QString& );
+ QPixmap defaultPixmap() const;
+ virtual void setDefaultPixmap( const QPixmap& );
+
QString resSection() const;
QString langSection() const;
- QPixmap loadPixmap( const QString&, const QString&, const bool = true ) const;
+ QPixmap loadPixmap( const QString&, const QString& ) const;
+ QPixmap loadPixmap( const QString&, const QString&, const bool ) const;
+ QPixmap loadPixmap( const QString&, const QString&, const QPixmap& ) const;
void loadLanguage( const QString& = QString::null, const QString& = QString::null );
void raiseTranslators( const QString& );
ResList myResources;
TransListMap myTranslator;
QString myCurSection;
+ QPixmap myDefaultPix;
};
class QTX_EXPORT QtxResourceMgr::Format