forked from blue/squawk
experimenting with qml
This commit is contained in:
parent
38159eafeb
commit
4e6bd04b02
13 changed files with 176 additions and 69 deletions
|
@ -7,7 +7,7 @@ set(CMAKE_AUTOMOC ON)
|
|||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets Quick Qml QuickControls2 Core)
|
||||
|
||||
add_subdirectory(vcard)
|
||||
|
||||
|
@ -21,9 +21,12 @@ set(squawkWidgets_SRC
|
|||
joinconference.cpp
|
||||
)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(squawkWidgets ${squawkWidgets_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(squawkWidgets vCardUI)
|
||||
target_link_libraries(squawkWidgets Qt5::Widgets)
|
||||
target_link_libraries(squawkWidgets Qt5::Qml)
|
||||
target_link_libraries(squawkWidgets Qt5::QuickControls2)
|
||||
|
||||
qt5_use_modules(squawkWidgets Quick Qml QuickControls2 Core Widgets)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "chat.h"
|
||||
|
||||
Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
||||
Conversation(false, acc, p_contact->getJid(), "", parent),
|
||||
Conversation(false, acc, p_contact, p_contact->getJid(), "", parent),
|
||||
contact(p_contact)
|
||||
{
|
||||
setName(p_contact->getContactName());
|
||||
|
@ -28,8 +28,6 @@ Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
|||
setAvatar(p_contact->getAvatarPath());
|
||||
|
||||
connect(contact, &Models::Contact::childChanged, this, &Chat::onContactChanged);
|
||||
|
||||
feed->setModel(p_contact->feed);
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QCoreApplication>
|
||||
|
||||
Conversation::Conversation(bool muc, Models::Account* acc, const QString pJid, const QString pRes, QWidget* parent):
|
||||
Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el, const QString pJid, const QString pRes, QWidget* parent):
|
||||
QWidget(parent),
|
||||
isMuc(muc),
|
||||
account(acc),
|
||||
|
@ -45,7 +45,7 @@ Conversation::Conversation(bool muc, Models::Account* acc, const QString pJid, c
|
|||
filesLayout(0),
|
||||
overlay(new QWidget()),
|
||||
filesToAttach(),
|
||||
feed(0),
|
||||
feed(new QQuickView()),
|
||||
scroll(down),
|
||||
manualSliderChange(false),
|
||||
requestingHistory(false),
|
||||
|
@ -53,7 +53,14 @@ Conversation::Conversation(bool muc, Models::Account* acc, const QString pJid, c
|
|||
tsb(QApplication::style()->styleHint(QStyle::SH_ScrollBar_Transient) == 1)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
feed = m_ui->feed;
|
||||
|
||||
feed->setColor(QWidget::palette().color(QPalette::Base));
|
||||
feed->setInitialProperties({{"model", QVariant::fromValue(el->feed)}});
|
||||
feed->setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
feed->setSource(QUrl("qrc:/qml/feed.qml"));
|
||||
QWidget *container = QWidget::createWindowContainer(feed, this);
|
||||
container->setAutoFillBackground(false);
|
||||
m_ui->widget->layout()->addWidget(container);
|
||||
|
||||
connect(acc, &Models::Account::childChanged, this, &Conversation::onAccountChanged);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QMap>
|
||||
#include <QMimeData>
|
||||
#include <QFileInfo>
|
||||
#include <QListView>
|
||||
#include <QQuickView>
|
||||
|
||||
#include "shared/message.h"
|
||||
#include "order.h"
|
||||
|
@ -72,7 +72,7 @@ class Conversation : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Conversation(bool muc, Models::Account* acc, const QString pJid, const QString pRes, QWidget* parent = 0);
|
||||
Conversation(bool muc, Models::Account* acc, Models::Element* el, const QString pJid, const QString pRes, QWidget* parent = 0);
|
||||
~Conversation();
|
||||
|
||||
QString getJid() const;
|
||||
|
@ -133,6 +133,7 @@ protected:
|
|||
down
|
||||
};
|
||||
Models::Account* account;
|
||||
Models::Element* element;
|
||||
QString palJid;
|
||||
QString activePalResource;
|
||||
QScopedPointer<Ui::Conversation> m_ui;
|
||||
|
@ -145,7 +146,7 @@ protected:
|
|||
FlowLayout* filesLayout;
|
||||
QWidget* overlay;
|
||||
W::Order<Badge*, Badge::Comparator> filesToAttach;
|
||||
QListView* feed;
|
||||
QQuickView* feed;
|
||||
Scroll scroll;
|
||||
bool manualSliderChange;
|
||||
bool requestingHistory;
|
||||
|
|
|
@ -214,37 +214,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="feed">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerItem</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "room.h"
|
||||
|
||||
Room::Room(Models::Account* acc, Models::Room* p_room, QWidget* parent):
|
||||
Conversation(true, acc, p_room->getJid(), "", parent),
|
||||
Conversation(true, acc, p_room, p_room->getJid(), "", parent),
|
||||
room(p_room)
|
||||
{
|
||||
setName(p_room->getName());
|
||||
|
@ -29,8 +29,6 @@ Room::Room(Models::Account* acc, Models::Room* p_room, QWidget* parent):
|
|||
connect(room, &Models::Room::childChanged, this, &Room::onRoomChanged);
|
||||
connect(room, &Models::Room::participantJoined, this, &Room::onParticipantJoined);
|
||||
connect(room, &Models::Room::participantLeft, this, &Room::onParticipantLeft);
|
||||
|
||||
feed->setModel(p_room->feed);
|
||||
}
|
||||
|
||||
Room::~Room()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue