summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtSwift.cpp20
-rw-r--r--Swift/QtUI/QtSwift.h2
-rw-r--r--Swift/QtUI/Swift.qrc9
-rw-r--r--Swift/resources/emoticons/emoticons.txt18
-rw-r--r--Swift/resources/emoticons/evilgrin.pngbin0 -> 727 bytes
-rw-r--r--Swift/resources/emoticons/grin.pngbin0 -> 714 bytes
-rw-r--r--Swift/resources/emoticons/happy.pngbin0 -> 731 bytes
-rw-r--r--Swift/resources/emoticons/smile.pngbin0 -> 725 bytes
-rw-r--r--Swift/resources/emoticons/surprised.pngbin0 -> 741 bytes
-rw-r--r--Swift/resources/emoticons/tongue.pngbin0 -> 727 bytes
-rw-r--r--Swift/resources/emoticons/unhappy.pngbin0 -> 723 bytes
-rw-r--r--Swift/resources/emoticons/wink.pngbin0 -> 712 bytes
12 files changed, 41 insertions, 8 deletions
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 57386d4..944656d 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -103,10 +103,11 @@ XMLSettingsProvider* QtSwift::loadSettingsFile(const QString& fileName) {
return new XMLSettingsProvider("");
}
-QMap<QString, QString> QtSwift::loadEmoticonsFile(const QString& fileName) {
- QMap<QString, QString> emoticons;
+void QtSwift::loadEmoticonsFile(const QString& fileName, QMap<QString, QString>& emoticons) {
+ qDebug() << "Trying to load " << fileName;
QFile file(fileName);
if (file.exists() && file.open(QIODevice::ReadOnly)) {
+ qDebug() << "Success";
while (!file.atEnd()) {
QString line = file.readLine();
line.replace("\n", "");
@@ -114,13 +115,16 @@ QMap<QString, QString> QtSwift::loadEmoticonsFile(const QString& fileName) {
qDebug() << "Parsing line : " << line;
QStringList tokens = line.split(" ");
if (tokens.size() == 2) {
- emoticons[tokens[0]] = "file://" + tokens[1];
- qDebug() << "Adding mapping from " << tokens[0] << " to " << tokens[1];
+ QString emoticonFile = tokens[1];
+ if (!emoticonFile.startsWith(":/") && !emoticonFile.startsWith("qrc:/")) {
+ emoticonFile = "file://" + emoticonFile;
+ }
+ emoticons[tokens[0]] = emoticonFile;
+ qDebug() << "Adding mapping from " << tokens[0] << " to " << emoticonFile;
}
}
}
-
- return emoticons;
+ qDebug() << "Done";
}
QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL), idleDetector_(&idleQuerier_, networkFactories_.getTimerFactory(), 1000) {
@@ -135,7 +139,9 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
settingsHierachy_->addProviderToTopOfStack(xmlSettings_);
settingsHierachy_->addProviderToTopOfStack(qtSettings_);
- QMap<QString, QString> emoticons = loadEmoticonsFile(P2QSTRING((Paths::getExecutablePath() / "emoticons.txt").string()));
+ QMap<QString, QString> emoticons;
+ loadEmoticonsFile(":/emoticons/emoticons.txt", emoticons);
+ loadEmoticonsFile(P2QSTRING((Paths::getExecutablePath() / "emoticons.txt").string()), emoticons);
if (options.count("netbook-mode")) {
splitter_ = new QtSingleWindow(qtSettings_);
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 94b0648..216527d 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -61,7 +61,7 @@ namespace Swift {
~QtSwift();
private:
XMLSettingsProvider* loadSettingsFile(const QString& fileName);
- QMap<QString, QString> loadEmoticonsFile(const QString& fileName);
+ void loadEmoticonsFile(const QString& fileName, QMap<QString, QString>& emoticons);
private:
QtEventLoop clientMainThreadCaller_;
PlatformTLSFactories tlsFactories_;
diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc
index eb4f7ee..39201da 100644
--- a/Swift/QtUI/Swift.qrc
+++ b/Swift/QtUI/Swift.qrc
@@ -29,5 +29,14 @@
<file alias="icons/polygon.png">../resources/icons/polygon.png</file>
<file alias="icons/cursor.png">../resources/icons/cursor.png</file>
<file alias="icons/eraser.png">../resources/icons/eraser.png</file>
+ <file alias="emoticons/emoticons.txt">../resources/emoticons/emoticons.txt</file>
+ <file alias="emoticons/evilgrin.png">../resources/emoticons/evilgrin.png</file>
+ <file alias="emoticons/grin.png">../resources/emoticons/grin.png</file>
+ <file alias="emoticons/happy.png">../resources/emoticons/happy.png</file>
+ <file alias="emoticons/smile.png">../resources/emoticons/smile.png</file>
+ <file alias="emoticons/surprised.png">../resources/emoticons/surprised.png</file>
+ <file alias="emoticons/tongue.png">../resources/emoticons/tongue.png</file>
+ <file alias="emoticons/unhappy.png">../resources/emoticons/unhappy.png</file>
+ <file alias="emoticons/wink.png">../resources/emoticons/wink.png</file>
</qresource>
</RCC>
diff --git a/Swift/resources/emoticons/emoticons.txt b/Swift/resources/emoticons/emoticons.txt
new file mode 100644
index 0000000..fdfa899
--- /dev/null
+++ b/Swift/resources/emoticons/emoticons.txt
@@ -0,0 +1,18 @@
+ignore >:) qrc:/emoticons/evilgrin.png
+ignore >:-) qrc:/emoticons/evilgrin.png
+:) qrc:/emoticons/smile.png
+:-) qrc:/emoticons/smile.png
+(: qrc:/emoticons/smile.png
+(-: qrc:/emoticons/smile.png
+:D qrc:/emoticons/happy.png
+:-D qrc:/emoticons/happy.png
+:o qrc:/emoticons/surprised.png
+:-o qrc:/emoticons/surprised.png
+:-O qrc:/emoticons/surprised.png
+:O qrc:/emoticons/surprised.png
+:p qrc:/emoticons/tongue.png
+:-p qrc:/emoticons/tongue.png
+:( qrc:/emoticons/unhappy.png
+:-( qrc:/emoticons/unhappy.png
+;) qrc:/emoticons/wink.png
+;-) qrc:/emoticons/wink.png
diff --git a/Swift/resources/emoticons/evilgrin.png b/Swift/resources/emoticons/evilgrin.png
new file mode 100644
index 0000000..817bd50
--- /dev/null
+++ b/Swift/resources/emoticons/evilgrin.png
Binary files differ
diff --git a/Swift/resources/emoticons/grin.png b/Swift/resources/emoticons/grin.png
new file mode 100644
index 0000000..fc60c5e
--- /dev/null
+++ b/Swift/resources/emoticons/grin.png
Binary files differ
diff --git a/Swift/resources/emoticons/happy.png b/Swift/resources/emoticons/happy.png
new file mode 100644
index 0000000..6b7336e
--- /dev/null
+++ b/Swift/resources/emoticons/happy.png
Binary files differ
diff --git a/Swift/resources/emoticons/smile.png b/Swift/resources/emoticons/smile.png
new file mode 100644
index 0000000..ade4318
--- /dev/null
+++ b/Swift/resources/emoticons/smile.png
Binary files differ
diff --git a/Swift/resources/emoticons/surprised.png b/Swift/resources/emoticons/surprised.png
new file mode 100644
index 0000000..4520cfc
--- /dev/null
+++ b/Swift/resources/emoticons/surprised.png
Binary files differ
diff --git a/Swift/resources/emoticons/tongue.png b/Swift/resources/emoticons/tongue.png
new file mode 100644
index 0000000..ecafd2f
--- /dev/null
+++ b/Swift/resources/emoticons/tongue.png
Binary files differ
diff --git a/Swift/resources/emoticons/unhappy.png b/Swift/resources/emoticons/unhappy.png
new file mode 100644
index 0000000..fd5d030
--- /dev/null
+++ b/Swift/resources/emoticons/unhappy.png
Binary files differ
diff --git a/Swift/resources/emoticons/wink.png b/Swift/resources/emoticons/wink.png
new file mode 100644
index 0000000..a631949
--- /dev/null
+++ b/Swift/resources/emoticons/wink.png
Binary files differ