parent
5dc0a776eb
commit
cc151341ed
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,125 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
visible: true
|
||||
color: "grey"
|
||||
property string chatBackgroundSelf: "#056162"
|
||||
property string chatBackgroundThem: "#262d31"
|
||||
property int itemHeightDefault: 68
|
||||
property int itemHeightSmall: 32
|
||||
|
||||
Image {
|
||||
source: "qrc:/uwot-bg.jpg"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: xxx
|
||||
ListElement {
|
||||
name: "Wizzup"
|
||||
datestr: "11:44 pm"
|
||||
message: "I made this thing"
|
||||
isHead: true
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
name: "Wizzup"
|
||||
datestr: "11:44 pm"
|
||||
message: "it kinda works"
|
||||
isHead: false
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
name: "Wizzup"
|
||||
datestr: "11:44 pm"
|
||||
message: "you should look at it"
|
||||
isHead: false
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
datestr: "11:32 pm"
|
||||
name: "dsc"
|
||||
message: "Yeah, that works pretty well!"
|
||||
isHead: true
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
datestr: "10:04 pm"
|
||||
name: "Wizzup"
|
||||
message: "Agree, but here is a long line, you should wrap this! Please fix this ASAP when you have time!"
|
||||
status: "sent"
|
||||
isHead: true
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
datestr: "10:02 pm"
|
||||
name: "dsc"
|
||||
message: "Bla bla bla :D"
|
||||
status: "read"
|
||||
isHead: true
|
||||
isLast: false
|
||||
}
|
||||
ListElement {
|
||||
datestr: "10:02 pm"
|
||||
name: "wtf"
|
||||
message: "Noooooooo"
|
||||
status: "read"
|
||||
isHead: true
|
||||
isLast: false
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: chatListView
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 10
|
||||
anchors.leftMargin: 20
|
||||
anchors.rightMargin: 20
|
||||
|
||||
model: xxx
|
||||
delegate: Rectangle {
|
||||
color: "transparent"
|
||||
height: 48
|
||||
width: parent.width
|
||||
|
||||
RowLayout {
|
||||
height: 32
|
||||
width: parent.width
|
||||
spacing: 0
|
||||
|
||||
Item {
|
||||
visible: name == "dsc"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 32
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.minimumHeight: 32
|
||||
Layout.fillWidth: true
|
||||
color: name == "dsc" ? root.chatBackgroundSelf : root.chatBackgroundThem
|
||||
|
||||
Text {
|
||||
text: message
|
||||
color: "white"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: 18
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: name != "dsc"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 48
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QCoreApplication>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QQmlContext>
|
||||
#include <QMessageBox>
|
||||
#include <QGroupBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "settings.h"
|
||||
#include "config-conversations.h"
|
||||
#include "lib/globals.h"
|
||||
|
||||
#include "ui_settings.h"
|
||||
|
||||
|
||||
Settings * Settings::pSettings = nullptr;
|
||||
|
||||
Settings::Settings(Conversations *ctx, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::Settings),
|
||||
m_ctx(ctx) {
|
||||
pSettings = this;
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef MAEMO
|
||||
setProperty("X-Maemo-StackedWindow", 1);
|
||||
#endif
|
||||
QPixmap p_theme_default(":theme_default.png");
|
||||
QPixmap p_theme_uwot(":theme_uwot.png");
|
||||
ui->label_default_img->setPixmap(p_theme_default);
|
||||
ui->label_uwot_img->setPixmap(p_theme_uwot);
|
||||
|
||||
auto theme = config()->get(ConfigKeys::ChatTheme).toString();
|
||||
if(theme == "uwot")
|
||||
ui->radio_theme_uwot->setChecked(true);
|
||||
else
|
||||
ui->radio_theme_default->setChecked(true);
|
||||
|
||||
connect(ui->themeRadioGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), [=](QAbstractButton *button) {
|
||||
auto name = button->objectName();
|
||||
if(name == "radio_theme_default") {
|
||||
config()->set(ConfigKeys::ChatTheme, "default");
|
||||
} else if(name == "radio_theme_uwot") {
|
||||
config()->set(ConfigKeys::ChatTheme, "uwot");
|
||||
}
|
||||
});
|
||||
|
||||
//connect(this->ui->btnSend, &QPushButton::clicked, this, &Settings::onGatherMessage);
|
||||
}
|
||||
|
||||
Conversations *Settings::getContext(){
|
||||
return pSettings->m_ctx;
|
||||
}
|
||||
|
||||
void Settings::closeEvent(QCloseEvent *event) {
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
Settings::~Settings() {
|
||||
delete ui;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
#ifndef SETTINGSWINDOW_H
|
||||
#define SETTINGSWINDOW_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QResource>
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QMainWindow>
|
||||
#include <QObject>
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "conversations.h"
|
||||
#include "lib/config.h"
|
||||
|
||||
namespace Ui {
|
||||
class Settings;
|
||||
}
|
||||
|
||||
class Settings : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Settings(Conversations *ctx, QWidget *parent = nullptr);
|
||||
static Conversations *getContext();
|
||||
~Settings() override;
|
||||
Ui::Settings *ui;
|
||||
|
||||
signals:
|
||||
void lol(const QString &message);
|
||||
|
||||
private:
|
||||
Conversations *m_ctx;
|
||||
static Settings *pSettings;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Settings</class>
|
||||
<widget class="QMainWindow" name="Settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>716</width>
|
||||
<height>654</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>:/assets/images/appicons/64x64.png</normaloff>:/assets/images/appicons/64x64.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Chat theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_default_img">
|
||||
<property name="text">
|
||||
<string>default_img</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radio_theme_default">
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">themeRadioGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_uwot_img">
|
||||
<property name="text">
|
||||
<string>uwot_img</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radio_theme_uwot">
|
||||
<property name="text">
|
||||
<string>uwot</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">themeRadioGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="assets.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="themeRadioGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
Loading…
Reference in new issue