Skip to content

Commit 2bec997

Browse files
committed
Current version of Psi+ is 1.5.2029
It is based on: * psi: 21097d93 * plugins: 7a65467 * psimedia: 478567e * resources: e32ef4b
1 parent 317eb15 commit 2bec997

8 files changed

+49
-32
lines changed

src/chatviewcommon.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ QString ChatViewCommon::getMucNickColor(const QString &nick, bool isSelf)
8484
return nickColors[it.value() % (nickColors.size() - 1)];
8585
} while (false);
8686

87-
return QLatin1String("#000000"); // FIXME it's bad for fallback color
87+
return qApp->palette().color(QPalette::Inactive, QPalette::WindowText).name();
8888
}
8989

9090
void ChatViewCommon::addUser(const QString &nickname) { }

src/chatviewtheme.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,10 @@ QVariantMap ChatViewJSLoader::checkFilesExist(const QStringList &files, const QS
555555
QStringList ChatViewJSLoader::listFiles()
556556
{
557557
QScopedPointer<Theme::ResourceLoader> loader(Theme(theme).resourceLoader());
558-
return loader->listAll();
558+
if (loader) {
559+
return loader->listAll();
560+
}
561+
return {};
559562
}
560563

561564
QString ChatViewJSLoader::getFileContents(const QString &name) const { return QString(Theme(theme).loadData(name)); }

src/chatviewthemeprovider.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ const QStringList ChatViewThemeProvider::themeIds() const
6060
QString typeName = tDirInfo.fileName();
6161
foreach (QFileInfo themeInfo,
6262
QDir(tDirInfo.absoluteFilePath()).entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot)
63-
+ QDir(tDirInfo.absoluteFilePath()).entryInfoList(QStringList("*.theme"), QDir::Files)) {
63+
+ QDir(tDirInfo.absoluteFilePath())
64+
.entryInfoList(QStringList { { "*.theme", "*.zip" } }, QDir::Files)) {
6465
ret << (QString("%1/%2").arg(typeName, themeInfo.fileName()));
6566
// qDebug("found theme: %s", qPrintable(QString("%1/%2").arg(typeName).arg(themeInfo.fileName())));
6667
}

src/theme.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ QWidget *Theme::previewWidget() { return d->previewWidget(); }
8080
bool Theme::isCompressed(const QFileInfo &fi)
8181
{
8282
QString sfx = fi.suffix();
83-
return fi.isDir() && (sfx == QLatin1String("jisp") || sfx == QLatin1String("zip") || sfx == QLatin1String("theme"));
83+
return fi.isFile()
84+
&& (sfx == QLatin1String("jisp") || sfx == QLatin1String("zip") || sfx == QLatin1String("theme"));
8485
}
8586

8687
bool Theme::isCompressed() const { return isCompressed(QFileInfo(d->filepath)); }
@@ -144,9 +145,8 @@ QByteArray Theme::loadData(const QString &fileName, const QString &themePath, bo
144145
z.setCaseSensitivity(UnZip::CS_Insensitive);
145146
}
146147

147-
QString n = fi.completeBaseName() + '/' + fileName;
148-
if (!z.readFile(n, &ba)) {
149-
n = "/" + fileName;
148+
if (!z.readFile(fileName, &ba)) {
149+
auto n = "/" + fileName;
150150
if (loaded) {
151151
*loaded = z.readFile(n, &ba);
152152
} else {

src/theme_p.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Theme::ResourceLoader *ThemePrivate::resourceLoader() const
172172
}
173173
#ifdef Theme_ZIP
174174
else if (Theme::isCompressed(fi)) {
175-
UnZip z;
175+
UnZip z(fi.filePath());
176176
if (z.open()) {
177177
if (caseInsensitiveFS) {
178178
z.setCaseSensitivity(UnZip::CS_Insensitive);

themes/chatview/adium/adapter.js

+34-21
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,36 @@ var adapter = {
2525
loadTheme : function(style) {
2626
//var chat = chat;
2727
var loader = window.srvLoader;
28+
var baseDir = "";
2829
loader.toCache("variant", style);
2930
//chat.console("DEBUG: loading " );
3031
loader.setCaseInsensitiveFS(true);
3132
loader.setPrepareSessionHtml(true);
32-
loader.setHttpResourcePath("/Contents/Resources");
33-
//chat.console("DEBUG: loading " + loader.themeId);
34-
var resources = ["FileTransferRequest.html",
35-
"Footer.html", "Header.html", "Status.html", "Topic.html", "Content.html",
36-
"Incoming/Content.html", "Incoming/NextContent.html",
37-
"Incoming/Context.html", "Incoming/NextContext.html",
38-
"Outgoing/Content.html", "Outgoing/NextContent.html",
39-
"Outgoing/Context.html", "Outgoing/NextContext.html"];
40-
41-
var toCache = {};
42-
for (var i=0; i<resources.length; i++) {
43-
toCache[resources[i]] = "Contents/Resources/" + resources[i];
44-
}
45-
loader.saveFilesToCache(toCache);
4633

4734
function gotFilesList(filesList) {
48-
chat.console(filesList.join(","));
49-
chat.util.loadXML("Contents/Info.plist", plistLoaded);
35+
filesList = filesList.filter((path) => !(path.startsWith("__MACOSX") || path.startsWith(".") || path.endsWith("DS_Store")));
36+
const value = filesList.find((path)=>path.split("/")[0].toLowerCase().endsWith("adiummessagestyle"));
37+
if (value) {
38+
baseDir = value.split("/")[0] + "/";
39+
}
40+
loader.setHttpResourcePath("/" + baseDir + "Contents/Resources");
41+
42+
//chat.console("DEBUG: loading " + loader.themeId);
43+
var resources = ["FileTransferRequest.html",
44+
"Footer.html", "Header.html", "Status.html", "Topic.html", "Content.html",
45+
"Incoming/Content.html", "Incoming/NextContent.html",
46+
"Incoming/Context.html", "Incoming/NextContext.html",
47+
"Outgoing/Content.html", "Outgoing/NextContent.html",
48+
"Outgoing/Context.html", "Outgoing/NextContext.html"];
49+
50+
var toCache = {};
51+
for (var i=0; i<resources.length; i++) {
52+
toCache[resources[i]] = baseDir + "Contents/Resources/" + resources[i];
53+
}
54+
loader.saveFilesToCache(toCache);
55+
56+
chat.console("Found base dir: " + value);
57+
chat.util.loadXML(baseDir + "Contents/Info.plist", plistLoaded);
5058
}
5159

5260
function plistLoaded(ipDoc)
@@ -98,11 +106,16 @@ var adapter = {
98106
loader.setTransparent();
99107
}
100108

101-
var resources = ["Incoming/buddy_icon.png", "Outgoing/buddy_icon.png", "incoming_icon.png", "outgoing_icon.png"];
109+
var resources = [
110+
"Incoming/buddy_icon.png",
111+
"Outgoing/buddy_icon.png",
112+
"incoming_icon.png",
113+
"outgoing_icon.png"
114+
];
102115
if (chat.async) {
103-
loader.checkFilesExist(resources, "Contents/Resources", resourcesListReady);
116+
loader.checkFilesExist(resources, baseDir + "Contents/Resources", resourcesListReady);
104117
} else {
105-
resourcesListReady(loader.checkFilesExist(resources, "Contents/Resources"));
118+
resourcesListReady(loader.checkFilesExist(resources, baseDir + "Contents/Resources"));
106119
}
107120
}
108121

@@ -115,9 +128,9 @@ var adapter = {
115128
avatars.outgoingImage = rlist["outgoing_icon.png"]? "outgoing_icon.png" : chat.server.psiDefaultAvatarUrl;
116129
loader.toCache("avatars", avatars)
117130
if (chat.async) {
118-
loader.getFileContents("Contents/Resources/Template.html", baseHtmlLoaded);
131+
loader.getFileContents(baseDir + "Contents/Resources/Template.html", baseHtmlLoaded);
119132
} else {
120-
baseHtmlLoaded(loader.getFileContents("Contents/Resources/Template.html"));
133+
baseHtmlLoaded(loader.getFileContents(baseDir + "Contents/Resources/Template.html"));
121134
}
122135
}
123136

themes/chatview/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,11 @@ ${info}
837837
}
838838
},
839839

840-
listAllFiles : function(callback) {
840+
listAllFiles : function(callback) {
841841
if (chat.async) {
842842
loader.listFiles(callback);
843843
} else {
844-
callback(loader.listFiles(path));
844+
callback(loader.listFiles());
845845
}
846846
},
847847

version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.2027 (2024-07-07, f08f76fd)
1+
1.5.2029 (2024-07-07, 21097d93)

0 commit comments

Comments
 (0)