mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr419'
This commit is contained in:
commit
d96ef1a970
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ GeneralForm::GeneralForm() :
|
|||
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
||||
}
|
||||
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
||||
reloadSmiles();
|
||||
|
||||
bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP());
|
||||
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
|
||||
|
@ -89,6 +90,7 @@ void GeneralForm::onSmileyBrowserIndexChanged(int index)
|
|||
{
|
||||
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
||||
Settings::getInstance().setSmileyPack(filename);
|
||||
reloadSmiles();
|
||||
}
|
||||
|
||||
void GeneralForm::onUDPUpdated()
|
||||
|
@ -119,3 +121,26 @@ void GeneralForm::onUseProxyUpdated()
|
|||
bodyUI->proxyPort->setEnabled(state);
|
||||
Settings::getInstance().setUseProxy(state);
|
||||
}
|
||||
|
||||
void GeneralForm::reloadSmiles()
|
||||
{
|
||||
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
|
||||
QStringList smiles;
|
||||
smiles << ":)" << ";)" << ":p" << ":O" << ":["; //just in case...
|
||||
|
||||
for(int i = 0; i < emoticons.size(); i++)
|
||||
smiles.push_front(emoticons.at(i).first());
|
||||
|
||||
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]);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ private slots:
|
|||
|
||||
private:
|
||||
Ui::GeneralSettings *bodyUI;
|
||||
void reloadSmiles();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<height>369</height>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -72,6 +72,60 @@
|
|||
<item>
|
||||
<widget class="QComboBox" name="smileyPackBrowser"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="smile1">
|
||||
<property name="toolTip">
|
||||
<string>:)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="smile2">
|
||||
<property name="toolTip">
|
||||
<string>;)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="smile3">
|
||||
<property name="toolTip">
|
||||
<string>:p</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="smile4">
|
||||
<property name="toolTip">
|
||||
<string>:O</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="smile5">
|
||||
<property name="toolTip">
|
||||
<string>:'(</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user