OSDN Git Service

Version 0.5
[fontmanager/fontmanager.git] / installedfontinfo.cpp
index eb7fb06..d7618c0 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Takumi Asaki
+** Copyright (C) 2012 Takumi Asaki
 ** All rights reserved.
 ** Contact: Takumi Asaki (takumi.asaki@gmail.com)
 **
@@ -181,6 +181,13 @@ void InstalledFontInfo::setFontProperty(FontsConfigProperties *prop)
         mFontProperty->setParent(this);
 }
 
+bool InstalledFontInfo::compare(const InstalledFontInfo *info1, InstalledFontInfo *info2)
+{
+    QString key1 = info1->localefamily() + ":" + info1->localefullname();
+    QString key2 = info2->localefamily() + ":" + info2->localefullname();
+    return (key1 < key2);
+}
+
 bool InstalledFontInfo::analyze(const QByteArray &buf, const QString &localFontPath)
 {
     static QRegExp headerRegexp("^Pattern has \\d+ elts \\(size \\d+\\)$");
@@ -234,6 +241,8 @@ bool InstalledFontInfo::analyze(const QByteArray &buf, const QString &localFontP
         }
     }
 
+    emit detailsChanged();
+
     return true;
 }
 
@@ -260,7 +269,7 @@ QStringList InstalledFontInfo::toStringList(const QString &value)
 
 int InstalledFontInfo::toInt(const QString &value)
 {
-    static QRegExp reg("\\d+\\(i\\)\\(s\\)");
+    static QRegExp reg("(\\d+)\\(i\\)\\(s\\)");
     int val = 0;
     if (reg.indexIn(value) == 0)
         val = reg.cap(1).toInt();