Small tweaks and improvements.

This commit is contained in:
Black Hat 2018-09-14 12:16:25 +08:00
parent 816380e9d0
commit 5e3570d210
5 changed files with 15 additions and 16 deletions

View File

@ -7,7 +7,7 @@ import Matrique.Settings 0.1
import "qrc:/js/util.js" as Util import "qrc:/js/util.js" as Util
RowLayout { RowLayout {
readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote") readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote" || aboveEventType === "other")
readonly property bool highlighted: !(sentByMe || eventType === "notice" ) readonly property bool highlighted: !(sentByMe || eventType === "notice" )
readonly property bool sentByMe: author === currentRoom.localUser readonly property bool sentByMe: author === currentRoom.localUser
readonly property bool isText: eventType === "notice" || eventType === "message" readonly property bool isText: eventType === "notice" || eventType === "message"

View File

@ -409,6 +409,8 @@ Item {
parent: ApplicationWindow.overlay parent: ApplicationWindow.overlay
Material.elevation: 2
textArea: inputField textArea: inputField
} }
} }

View File

@ -33,16 +33,12 @@ ApplicationWindow {
Controller { Controller {
id: matriqueController id: matriqueController
onToggleWindow: { onShowWindow: {
console.log("Activating window...")
if (window.visible) {
window.hide()
} else {
window.show() window.show()
window.raise() window.raise()
window.requestActivate() window.requestActivate()
} }
} onHideWindow: window.hide()
} }
AccountListModel { AccountListModel {

View File

@ -31,10 +31,10 @@ Controller::Controller(QObject* parent) : QObject(parent) {
tray->setToolTip("Matrique"); tray->setToolTip("Matrique");
connect(tray, &QSystemTrayIcon::activated, connect(tray, &QSystemTrayIcon::activated,
[this](QSystemTrayIcon::ActivationReason r) { [this](QSystemTrayIcon::ActivationReason r) {
if (r != QSystemTrayIcon::Context) emit toggleWindow(); if (r != QSystemTrayIcon::Context) emit showWindow();
}); });
connect(tray, &QSystemTrayIcon::messageClicked, [=] { emit toggleWindow(); }); connect(tray, &QSystemTrayIcon::messageClicked, [=] { emit showWindow(); });
trayMenu->addAction("Toggle Window", [=] { emit toggleWindow(); }); trayMenu->addAction("Hide Window", [=] { emit hideWindow(); });
trayMenu->addAction("Quit", [=] { QApplication::quit(); }); trayMenu->addAction("Quit", [=] { QApplication::quit(); });
tray->setContextMenu(trayMenu); tray->setContextMenu(trayMenu);
tray->show(); tray->show();
@ -168,7 +168,7 @@ bool Controller::saveAccessToken(const AccountSettings& account,
auto fileDir = QFileInfo(accountTokenFile).dir(); auto fileDir = QFileInfo(accountTokenFile).dir();
if (!((fileDir.exists() || fileDir.mkpath(".")) && if (!((fileDir.exists() || fileDir.mkpath(".")) &&
accountTokenFile.open(QFile::WriteOnly))) { accountTokenFile.open(QFile::WriteOnly))) {
emit errorOccured(); emit errorOccured("Cannot save access token.");
} else { } else {
// Try to restrict access rights to the file. The below is useless // Try to restrict access rights to the file. The below is useless
// on Windows: FAT doesn't control access at all and NTFS is // on Windows: FAT doesn't control access at all and NTFS is

View File

@ -66,8 +66,9 @@ class Controller : public QObject {
signals: signals:
void busyChanged(); void busyChanged();
void errorOccured(); void errorOccured(QString error);
void toggleWindow(); void showWindow();
void hideWindow();
void connectionAdded(Connection* conn); void connectionAdded(Connection* conn);
void connectionDropped(Connection* conn); void connectionDropped(Connection* conn);
void initiated(); void initiated();