//[DONE] #warning "!!! NEED TO FIX ITERATORS IN THIS CLASS !!!"
-RS_FontList * RS_FontList::uniqueInstance = NULL;
+FontList * FontList::uniqueInstance = NULL;
/**
* Default constructor.
*/
-RS_FontList::RS_FontList(): fontIterator(fonts)
+FontList::FontList(): fontIterator(fonts)
{
//Dealt with here...
//#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
//fontListListeners.setAutoDelete(false);
}
-/*static*/ RS_FontList * RS_FontList::instance()
+/*static*/ FontList * FontList::instance()
{
if (uniqueInstance == NULL)
- uniqueInstance = new RS_FontList();
+ uniqueInstance = new FontList();
return uniqueInstance;
}
-RS_FontList::~RS_FontList()
+FontList::~FontList()
{
clearFonts();
}
/**
- * Initializes the font list by creating empty RS_Font
+ * Initializes the font list by creating empty Font
* objects, one for each font that could be found.
*/
-void RS_FontList::init()
+void FontList::init()
{
- RS_DEBUG->print("RS_FontList::initFonts");
+ DEBUG->print("FontList::initFonts");
- QStringList list = RS_SYSTEM->getFontList();
+ QStringList list = SYSTEM->getFontList();
// Q3Dict<char> added; //used to remeber added fonts (avoid duplication)
QMultiHash<QString, char *> added; //used to remeber added fonts (avoid duplication)
for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
- RS_DEBUG->print("font: %s:", (*it).toLatin1().data());
-//printf("RS_FontList::init(): font: %s:\n", (*it).toLatin1().data());
+ DEBUG->print("font: %s:", (*it).toLatin1().data());
+//printf("FontList::init(): font: %s:\n", (*it).toLatin1().data());
QFileInfo fi(*it);
// if (!added[fi.baseName()])
if (added.value(fi.baseName()) == 0)
{
- RS_Font * font = new RS_Font(fi.baseName());
+ Font * font = new Font(fi.baseName());
fonts.append(font);
added.insert(fi.baseName(), (char *)1);
}
- RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data());
+ DEBUG->print("base: %s", fi.baseName().toLatin1().data());
}
}
/**
* Removes all fonts in the fontlist.
*/
-void RS_FontList::clearFonts()
+void FontList::clearFonts()
{
// fonts.clear();
while (!fonts.isEmpty())
delete fonts.takeFirst();
}
-int RS_FontList::countFonts()
+int FontList::countFonts()
{
return fonts.count();
}
* Listeners are notified after the font was removed from
* the list but before it gets deleted.
*/
-void RS_FontList::removeFont(RS_Font * font)
+void FontList::removeFont(Font * font)
{
- RS_DEBUG->print("RS_FontList::removeFont()");
+ DEBUG->print("FontList::removeFont()");
// here the font is removed from the list but not deleted
// fonts.remove(font);
delete fonts.takeAt(i);
//for (uint i=0; i<fontListListeners.count(); ++i) {
- // RS_FontListListener* l = fontListListeners.at(i);
+ // FontListListener* l = fontListListeners.at(i);
// l->fontRemoved(font);
//}
}
* \p NULL if no such font was found. The font will be loaded into
* memory if it's not already.
*/
-RS_Font * RS_FontList::requestFont(const QString & name)
+Font * FontList::requestFont(const QString & name)
{
- RS_DEBUG->print("RS_FontList::requestFont %s", name.toLatin1().data());
+ DEBUG->print("FontList::requestFont %s", name.toLatin1().data());
QString name2 = name.toLower();
- RS_Font * foundFont = NULL;
+ Font * foundFont = NULL;
// QCad 1 compatibility:
if (name2.contains('#') && name2.contains('_'))
// name2 = name2.left(name2.find('#'));
name2 = name2.left(name2.indexOf('#'));
- RS_DEBUG->print("name2: %s", name2.toLatin1().data());
+ DEBUG->print("name2: %s", name2.toLatin1().data());
// Search our list of available fonts:
-// for(RS_Font * f=fonts.first(); f!=NULL; f=fonts.next())
+// for(Font * f=fonts.first(); f!=NULL; f=fonts.next())
for(int i=0; i<fonts.size(); i++)
{
- RS_Font * f = fonts[i];
+ Font * f = fonts[i];
if (f->getFileName() == name2)
{
}
//! @return First font of the list.
-RS_Font * RS_FontList::firstFont()
+Font * FontList::firstFont()
{
// return fonts.first();
// fontIterator.toFront();
* @return Next font from the list after
* calling firstFont() or nextFont().
*/
-RS_Font * RS_FontList::nextFont()
+Font * FontList::nextFont()
{
// return fonts.next();
// return fontIterator.next();
/**
* Dumps the fonts to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_FontList & l)
+std::ostream & operator<<(std::ostream & os, FontList & l)
{
os << "Fontlist: \n";
- for(RS_Font * f=l.firstFont(); f!=NULL; f=l.nextFont())
+ for(Font * f=l.firstFont(); f!=NULL; f=l.nextFont())
os << *f << "\n";
return os;