mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
error handling for missing graphical icons
preview of emoticons based on dynamic list of emoticons, not hardcoded anymore
This commit is contained in:
parent
fc0ed91c74
commit
ca3182e281
@ -127,12 +127,21 @@ bool SmileyPack::load(const QString& filename)
|
||||
{
|
||||
QString emoticon = stringElement.text();
|
||||
filenameTable.insert(emoticon, file);
|
||||
emoticonSet.push_back(emoticon);
|
||||
|
||||
cacheSmiley(file); // preload all smileys
|
||||
|
||||
|
||||
QPixmap pm;
|
||||
pm.loadFromData(getCachedSmiley(emoticon), "PNG");
|
||||
|
||||
if(pm.size().width() > 0)
|
||||
emoticonSet.push_back(emoticon);
|
||||
|
||||
stringElement = stringElement.nextSibling().toElement();
|
||||
|
||||
}
|
||||
emoticons.push_back(emoticonSet);
|
||||
|
||||
if(emoticonSet.size() > 0)
|
||||
emoticons.push_back(emoticonSet);
|
||||
}
|
||||
|
||||
// success!
|
||||
@ -176,7 +185,6 @@ QIcon SmileyPack::getAsIcon(const QString &key)
|
||||
{
|
||||
QPixmap pm;
|
||||
pm.loadFromData(getCachedSmiley(key), "PNG");
|
||||
|
||||
return QIcon(pm);
|
||||
}
|
||||
|
||||
|
@ -124,11 +124,29 @@ void GeneralForm::onUseProxyUpdated()
|
||||
|
||||
void GeneralForm::reloadSmiles()
|
||||
{
|
||||
QString smiles[] = {":)", ";)", ":p", ":O", ":'("};
|
||||
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
|
||||
QStringList smiles;
|
||||
smiles << ":)" << ";)" << ":p" << ":O" << ":'("; //just in case...
|
||||
|
||||
for(int i = 0; i < emoticons.size(); i++)
|
||||
{
|
||||
foreach (QString icon, emoticons.at(i)) {
|
||||
{
|
||||
smiles.push_front(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int pixSize = 30;
|
||||
bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(pixSize, pixSize));
|
||||
bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(pixSize, pixSize));
|
||||
bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(pixSize, pixSize));
|
||||
bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(pixSize, pixSize));
|
||||
bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(pixSize, pixSize));
|
||||
|
||||
bodyUI->smile1->setToolTip(smiles[0]);
|
||||
bodyUI->smile2->setToolTip(smiles[1]);
|
||||
bodyUI->smile3->setToolTip(smiles[2]);
|
||||
bodyUI->smile4->setToolTip(smiles[3]);
|
||||
bodyUI->smile5->setToolTip(smiles[4]);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<height>397</height>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -80,7 +80,7 @@
|
||||
<string>:)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>:)</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -90,7 +90,7 @@
|
||||
<string>;)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>;)</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -100,7 +100,7 @@
|
||||
<string>:p</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>:p</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -110,7 +110,7 @@
|
||||
<string>:O</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>:O</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -120,7 +120,7 @@
|
||||
<string>:'(</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>:'(</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user