Skip to content

Commit

Permalink
feat: nicer material style
Browse files Browse the repository at this point in the history
  • Loading branch information
pontaoski committed Jan 21, 2022
1 parent 446e15e commit ff138ca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
4 changes: 2 additions & 2 deletions app/Shared.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ StaticLibrary {
Depends { name: "vendored_kitemmodels"; condition: project.vendoredKItemModels }
Depends { name: "android_openssl"; condition: qbs.targetOS.contains("android") }
Depends { name: "vendored_qqc2_breeze_style"; condition: project.vendoredQQC2BreezeStyle }
Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "network", "concurrent", "widgets", "websockets", "quick", "quickcontrols2", "qml", "qml-private"].concat(qbs.targetOS.contains("android") ? ["androidextras"] : []) }
Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "network", "concurrent", "widgets", "svg", "websockets", "quick", "quickcontrols2", "qml", "qml-private"].concat(qbs.targetOS.contains("android") ? ["androidextras"] : []) }

cpp.defines: ["QT_NO_KEYWORDS"].concat(project.vendoredKirigami ? ["CHALLAH_VENDORED_KIRIGAMI"] : []).concat(project.vendoredQQC2BreezeStyle ? ["CHALLAH_VENDORED_QQC2_BREEZE_STYLE"] : [])
cpp.cppFlags: ['-Werror=return-type']
Expand Down Expand Up @@ -90,5 +90,5 @@ StaticLibrary {
Depends { name: "vendored_kirigami"; condition: project.vendoredKirigami }
Depends { name: "vendored_kitemmodels"; condition: project.vendoredKItemModels }
Depends { name: "vendored_qqc2_breeze_style"; condition: project.vendoredQQC2BreezeStyle }
Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "network", "concurrent", "widgets", "websockets", "quick", "quickcontrols2", "qml", "qml-private"].concat(qbs.targetOS.contains("android") ? ["androidextras"] : []) }
Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "network", "concurrent", "widgets", "svg", "websockets", "quick", "quickcontrols2", "qml", "qml-private"].concat(qbs.targetOS.contains("android") ? ["androidextras"] : []) }
}
10 changes: 0 additions & 10 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ int main(int argc, char *argv[])

#if defined(Q_OS_ANDROID)
QQuickStyle::setStyle(QStringLiteral("Material"));
#elif defined(Q_OS_LINUX) && !defined(CHALLAH_VENDORED_KIRIGAMI)
QApplication::setStyle("Breeze");
QIcon::setThemeName("breeze");
QQuickStyle::setStyle("org.kde.desktop");
#endif

#ifdef CHALLAH_VENDORED_QQC2_BREEZE_STYLE
// this works awfully
// QQuickStyle::setStyle("qrc:/org/kde/breeze");
QQuickStyle::setStyle("Material");
#endif

QQmlApplicationEngine engine;
Expand Down
6 changes: 6 additions & 0 deletions app/resources/routes/guild/ComposeBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import org.kde.kirigami 2.15 as Kirigami
import QtQuick.Controls 2.10 as QQC2
import QtQuick.Dialogs 1.3 as Dialogs
import com.github.HarmonyDevelopment.Challah 1.0
import QtQuick.Controls.Material 2.12

import "components" as Components
import "qrc:/components" as GlobalComponents

QQC2.ToolBar {
id: composeRow

Material.background: Kirigami.Theme.backgroundColor

function send() {
timelineView.model.send(txtField.text, overrideAvatar.overrideData, page.interactionID)
txtField.text = ""
Expand All @@ -29,6 +32,7 @@ QQC2.ToolBar {
onAccepted: timelineView.model.sendFiles(this.fileUrls)
}

padding: Kirigami.Units.smallSpacing
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentItem.implicitHeight + topPadding + bottomPadding)

Expand Down Expand Up @@ -156,6 +160,7 @@ QQC2.ToolBar {
}

QQC2.Button {
flat: tStyleName === "Material"
Accessible.name: qsTr("Upload files")
icon.name: "mail-attachment"
onClicked: fileDialog.open()
Expand Down Expand Up @@ -200,6 +205,7 @@ QQC2.ToolBar {
Layout.fillWidth: true
}
QQC2.Button {
flat: tStyleName === "Material"
Accessible.name: qsTr("Send message")
icon.name: "document-send"
onClicked: composeRow.send()
Expand Down
24 changes: 10 additions & 14 deletions app/resources/routes/guild/components/MessageDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,24 @@ QQC2.Control {
readonly property bool separateFromPrevious: del.previousMessageID == "" || (previousData.data.author != messageData.data.author) || (previousData.data.overrideAvatar != messageData.data.overrideAvatar) || (previousData.data.overrideName != messageData.data.overrideName)
// readonly property bool canDeleteMessage: isOwnMessage

// topPadding: del.separateFromPrevious ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing
topPadding: del.separateFromPrevious ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing
bottomPadding: 0

Accessible.role: Accessible.ListItem
Accessible.name: "mu"

// Kirigami.Theme.backgroundColor: {
// if (isOwnMessage)
// return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.focusColor, 0.1)
Kirigami.Theme.backgroundColor: {
if (isOwnMessage)
return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.focusColor, 0.1)

// if (Kirigami.ColorUtils.brightnessForColor(messagesViewRoot.Kirigami.Theme.backgroundColor) == Kirigami.ColorUtils.Light)
// return Qt.darker(messagesViewRoot.Kirigami.Theme.backgroundColor, 1.1)
// else
// return Qt.lighter(messagesViewRoot.Kirigami.Theme.backgroundColor, 1.3)
// }
if (Kirigami.ColorUtils.brightnessForColor(page.Kirigami.Theme.backgroundColor) == Kirigami.ColorUtils.Light)
return Qt.darker(page.Kirigami.Theme.backgroundColor, 1.1)
else
return Qt.lighter(page.Kirigami.Theme.backgroundColor, 1.3)
}

Kirigami.Theme.colorSet: {
return Kirigami.Theme.Button
// if (Array.from(messagesSelectionModel.selectedIndexes).includes(modelIndex)) {
// return Kirigami.Theme.Selection
// }
// return messagesRoute.model.userID() == authorID ? Kirigami.Theme.Button : Kirigami.Theme.Window
return isOwnMessage ? Kirigami.Theme.Button : Kirigami.Theme.Window
}
Kirigami.Theme.inherit: false

Expand Down
3 changes: 3 additions & 0 deletions app/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "conditional.h"
#include "utils.h"

#include <QQuickStyle>
#include "qquickrelationallistener.h"
#include "setup.h"
#undef signal
Expand Down Expand Up @@ -100,6 +101,8 @@ void setupQML(QQmlEngine* engine)
qRegisterMetaType<voiceCall*>();
#endif

engine->rootContext()->setContextProperty("tStyleName", QQuickStyle::name());

qRegisterMetaType<Future<ChannelsModel*>>();
qRegisterMetaType<Future<MembersModel*>>();
qRegisterMetaType<Future<MessagesModel*>>();
Expand Down

0 comments on commit ff138ca

Please sign in to comment.