Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2025
Browse files Browse the repository at this point in the history
It is based on:
* psi: 27eb5bc2
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed Jul 5, 2024
1 parent 33f83a8 commit 54438d4
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 17 deletions.
5 changes: 5 additions & 0 deletions src/chatviewtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ void ChatViewJSLoader::setMetaData(const QVariantMap &map)
if (vl.count()) {
theme->features = vl;
}

vl = map["stylesList"].toStringList();
if (vl.count()) {
theme->stylesList = vl;
}
}

void ChatViewJSLoader::finishThemeLoading()
Expand Down
16 changes: 15 additions & 1 deletion src/options/opt_theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ QWidget *OptionsTabAppearanceTheme::widget()

void OptionsTabAppearanceTheme::themeSelected(const QModelIndex &current, const QModelIndex &previous)
{
Q_UNUSED(current);
updateStyles(current);
if (!previous.isValid()) {
return; // Psi won't start if it's impossible to load any theme. So we always have previous.
}
Expand All @@ -108,6 +108,7 @@ void OptionsTabAppearanceTheme::modelRowsInserted(const QModelIndex &parent, int
const QModelIndex index = themesModel->index(i, 0);
if (themesModel->data(index, PsiThemeModel::IsCurrent).toBool()) {
d->themeView->setCurrentIndex(index);
updateStyles(index);
}
#if 0
const QString id = themesModel->data(index, PsiThemeModel::IdRole).toString();
Expand Down Expand Up @@ -187,6 +188,19 @@ QString OptionsTabAppearanceTheme::getThemeId(const QString &objName) const
return (index > 0 ? objName.right(objName.length() - index - 1) : QString());
}

void OptionsTabAppearanceTheme::updateStyles(const QModelIndex &index)
{
auto styles = themesModel->data(index, PsiThemeModel::StylesListRole).toStringList();
OptAppearanceThemeUI *d = static_cast<OptAppearanceThemeUI *>(w);
d->cmb_style->blockSignals(true);
d->cmb_style->clear();
for (auto const &s : styles) {
d->cmb_style->addItem(s);
}
d->cmb_style->setCurrentIndex(0);
d->cmb_style->blockSignals(0);
}

void OptionsTabAppearanceTheme::applyOptions()
{
if (!w)
Expand Down
1 change: 1 addition & 0 deletions src/options/opt_theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private slots:

private:
QString getThemeId(const QString &objName) const;
void updateStyles(const QModelIndex &index);

private:
QWidget *w = nullptr;
Expand Down
16 changes: 13 additions & 3 deletions src/options/opt_theme.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<item>
<widget class="QTreeView" name="themeView">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
Expand All @@ -42,10 +42,20 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lbl_style">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmb_style"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -67,7 +77,7 @@
<string>&lt;a href=&quot;thememanager://showmore/&quot;&gt;More themes&lt;/a&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
Expand Down
5 changes: 5 additions & 0 deletions src/psithememodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct PsiThemeModel::Loader {
ti.creation = theme.creation();
ti.homeUrl = theme.homeUrl();
ti.features = theme.features();
ti.stylesList = theme.stylesList();

ti.hasPreview = theme.hasPreview();
ti.isValid = true;
Expand Down Expand Up @@ -196,6 +197,10 @@ QVariant PsiThemeModel::data(const QModelIndex &index, int role) const
}
case IsCurrent:
return themesInfo[index.row()].isCurrent;
case StylesListRole: {
const ThemeItemInfo &ti = themesInfo[index.row()];
return ti.stylesList;
}
}
return QVariant();
}
Expand Down
3 changes: 2 additions & 1 deletion src/psithememodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct ThemeItemInfo {
QString creation;
QString homeUrl;
QStringList features;
QStringList stylesList;

bool hasPreview;
bool isValid = false;
Expand All @@ -47,7 +48,7 @@ class PsiThemeModel : public QAbstractListModel {
Q_OBJECT

public:
enum ThemeRoles { IdRole = Qt::UserRole + 1, HasPreviewRole, TitleRole, IsCurrent };
enum ThemeRoles { IdRole = Qt::UserRole + 1, HasPreviewRole, TitleRole, IsCurrent, StylesListRole };

PsiThemeModel(PsiThemeProvider *provider, QObject *parent);
~PsiThemeModel();
Expand Down
2 changes: 2 additions & 0 deletions src/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ const QString &Theme::homeUrl() const { return d->homeUrl; }

const QStringList &Theme::features() const { return d->features; }

const QStringList &Theme::stylesList() const { return d->stylesList; }

PsiThemeProvider *Theme::themeProvider() const { return d->provider; }

/**
Expand Down
1 change: 1 addition & 0 deletions src/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Theme {
const QString &creation() const;
const QString &homeUrl() const;
const QStringList &features() const;
const QStringList &stylesList() const;

PsiThemeProvider *themeProvider() const;
const QString &filePath() const;
Expand Down
2 changes: 1 addition & 1 deletion src/theme_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ThemePrivate : public QSharedData {

// metadata
QString id, name, version, description, creation, homeUrl;
QStringList authors, features;
QStringList authors, features, stylesList;
QHash<QString, QString> info;

// runtime info
Expand Down
14 changes: 5 additions & 9 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@
padding: .5rem 0;
margin: 0;
box-sizing: border-box;
/*background: url(background.jpg);
background-attachment: fixed;
background-size: cover;*/
background-color: rgb(194, 181, 209);
background: linear-gradient(90deg, rgb(194, 181, 209) 0%, rgb(198, 198, 255) 37%, rgb(174, 241, 255) 100%);
background-color: #ccd;
color: black;
font-family: sans, times;
position: relative;
Expand All @@ -307,7 +303,7 @@
margin: 0 auto .5rem;
border-radius: 1rem;
text-align: center;
box-shadow: 0px 0px 0.5rem black;
box-shadow: 0px 0px 0.3rem black;
}

.sysmsg .usertext {
Expand All @@ -323,7 +319,7 @@
position: relative;
background-color: #f8f8f8;
border-radius: 0 .6rem .6rem .6rem;
box-shadow: 0px 0px 0.5rem black;
box-shadow: 0px 0px 0.3rem black;
clip-path: inset(-0.5rem -5rem -0.5rem -5rem);
word-wrap: break-word !important;
display: flex;
Expand Down Expand Up @@ -538,7 +534,7 @@
margin-top: 1rem;
border-radius: 0.2rem;
background-color: #fafafa;
box-shadow: 0px 0px 0.5rem black;
box-shadow: 0px 0px 0.3rem black;
flex-wrap: wrap;
z-index: 2;
}
Expand All @@ -553,7 +549,7 @@
position: absolute;
box-sizing: border-box;
flex-flow: column;
box-shadow: 0px 0px 0.5rem black;
box-shadow: 0px 0px 0.3rem black;
border-radius: .3rem;
background-color: white;
z-index: 3;
Expand Down
3 changes: 2 additions & 1 deletion themes/chatview/psi/bubble/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ srvLoader.setMetaData({
authors: ["Sergei Ilinykh <[email protected]>"],
description: "Bubble style.",
url: "https://psi-im.org",
features: ["reactions", "message-retract"]
features: ["reactions", "message-retract"],
stylesList: ["Light", "Dark"]
});
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2024 (2024-07-05, 5dbcee2e)
1.5.2025 (2024-07-06, 27eb5bc2)

0 comments on commit 54438d4

Please sign in to comment.