mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-02 20:29:23 +00:00
Colors/Images rework
Remove Call and notices logs from db Delete empty chat rooms after requesting it Option of showing/hidding empty chat rooms Many fixes on notifications count, imdn states, synchronizations behaviors, mouse cursor, etc. Fix crashes Fix timeline times
This commit is contained in:
parent
466b199023
commit
1cbdc96b30
149 changed files with 2814 additions and 2173 deletions
|
|
@ -155,7 +155,12 @@ set(SOURCES
|
|||
src/components/ldap/LdapProxyModel.cpp
|
||||
src/components/notifier/Notifier.cpp
|
||||
src/components/other/clipboard/Clipboard.cpp
|
||||
src/components/other/colors/Colors.cpp
|
||||
src/components/other/colors/ColorModel.cpp
|
||||
src/components/other/colors/ColorListModel.cpp
|
||||
src/components/other/colors/ColorProxyModel.cpp
|
||||
src/components/other/images/ImageModel.cpp
|
||||
src/components/other/images/ImageListModel.cpp
|
||||
src/components/other/images/ImageProxyModel.cpp
|
||||
src/components/other/text-to-speech/TextToSpeech.cpp
|
||||
src/components/other/units/Units.cpp
|
||||
src/components/participant/ParticipantModel.cpp
|
||||
|
|
@ -250,7 +255,12 @@ set(HEADERS
|
|||
src/components/ldap/LdapProxyModel.hpp
|
||||
src/components/notifier/Notifier.hpp
|
||||
src/components/other/clipboard/Clipboard.hpp
|
||||
src/components/other/colors/Colors.hpp
|
||||
src/components/other/colors/ColorModel.hpp
|
||||
src/components/other/colors/ColorListModel.hpp
|
||||
src/components/other/colors/ColorProxyModel.hpp
|
||||
src/components/other/images/ImageModel.hpp
|
||||
src/components/other/images/ImageListModel.hpp
|
||||
src/components/other/images/ImageProxyModel.hpp
|
||||
src/components/other/desktop-tools/DesktopTools.hpp
|
||||
src/components/other/text-to-speech/TextToSpeech.hpp
|
||||
src/components/other/units/Units.hpp
|
||||
|
|
|
|||
|
|
@ -359,12 +359,13 @@ void App::initContentApp () {
|
|||
#ifndef Q_OS_MACOS
|
||||
mustBeIconified = mParser->isSet("iconified");
|
||||
#endif // ifndef Q_OS_MACOS
|
||||
|
||||
mColors = new Colors(this);
|
||||
mColorListModel = new ColorListModel();
|
||||
mImageListModel = new ImageListModel();
|
||||
}
|
||||
|
||||
// Change colors if necessary.
|
||||
mColors->useConfig(config);
|
||||
mColorListModel->useConfig(config);
|
||||
mImageListModel->useConfig(config);
|
||||
|
||||
// Init core.
|
||||
CoreManager::init(this, Utils::coreStringToAppString(configPath));
|
||||
|
|
@ -395,6 +396,8 @@ void App::initContentApp () {
|
|||
mEngine->addImageProvider(ThumbnailProvider::ProviderId, new ThumbnailProvider());
|
||||
|
||||
mEngine->rootContext()->setContextProperty("applicationUrl", APPLICATION_URL);
|
||||
mEngine->rootContext()->setContextProperty("Colors", mColorListModel->getQmlData());
|
||||
mEngine->rootContext()->setContextProperty("Images", mImageListModel->getQmlData());
|
||||
|
||||
registerTypes();
|
||||
registerSharedTypes();
|
||||
|
|
@ -619,6 +622,8 @@ void App::registerTypes () {
|
|||
registerType<SearchSipAddressesProxyModel>("SearchSipAddressesProxyModel");
|
||||
|
||||
|
||||
registerType<ColorProxyModel>("ColorProxyModel");
|
||||
registerType<ImageProxyModel>("ImageProxyModel");
|
||||
registerType<TimelineProxyModel>("TimelineProxyModel");
|
||||
registerType<ParticipantProxyModel>("ParticipantProxyModel");
|
||||
registerType<SoundPlayer>("SoundPlayer");
|
||||
|
|
@ -636,6 +641,8 @@ void App::registerTypes () {
|
|||
registerUncreatableType<ChatMessageModel>("ChatMessageModel");
|
||||
registerUncreatableType<ChatNoticeModel>("ChatNoticeModel");
|
||||
registerUncreatableType<ChatRoomModel>("ChatRoomModel");
|
||||
registerUncreatableType<ColorModel>("ColorModel");
|
||||
registerUncreatableType<ImageModel>("ImageModel");
|
||||
registerUncreatableType<ConferenceHelperModel::ConferenceAddModel>("ConferenceAddModel");
|
||||
registerUncreatableType<ContactModel>("ContactModel");
|
||||
registerUncreatableType<ContactsImporterModel>("ContactsImporterModel");
|
||||
|
|
@ -673,6 +680,7 @@ void App::registerSharedTypes () {
|
|||
registerSharedSingletonType<ContactsImporterListModel, &CoreManager::getContactsImporterListModel>("ContactsImporterListModel");
|
||||
registerSharedSingletonType<LdapListModel, &CoreManager::getLdapListModel>("LdapListModel");
|
||||
registerSharedSingletonType<TimelineListModel, &CoreManager::getTimelineListModel>("TimelineListModel");
|
||||
// registerSharedSingletonType<ColorListModel, &App::getColorListModel>("ColorCpp");
|
||||
}
|
||||
|
||||
void App::registerToolTypes () {
|
||||
|
|
@ -684,12 +692,14 @@ void App::registerToolTypes () {
|
|||
registerToolType<Units>("Units");
|
||||
registerToolType<ContactsImporterPluginsManager>("ContactsImporterPluginsManager");
|
||||
registerToolType<Utils>("UtilsCpp");
|
||||
//registerToolType<Colors>("ColorsCpp");
|
||||
}
|
||||
|
||||
void App::registerSharedToolTypes () {
|
||||
qInfo() << QStringLiteral("Registering shared tool types...");
|
||||
|
||||
registerSharedToolType<Colors, App, &App::getColors>("Colors");
|
||||
//registerSharedToolType<Colors, App, &App::getColors>("Colors");
|
||||
//registerSharedToolType<ColorListModel,App, &App::getColorListModel>("ColorsCpp");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ namespace linphone {
|
|||
class Config;
|
||||
}
|
||||
|
||||
class Colors;
|
||||
class ColorListModel;
|
||||
class DefaultTranslator;
|
||||
class ImageListModel;
|
||||
class Notifier;
|
||||
|
||||
|
||||
class App : public SingleApplication {
|
||||
Q_OBJECT;
|
||||
|
||||
|
|
@ -74,9 +76,16 @@ public:
|
|||
return mNotifier;
|
||||
}
|
||||
|
||||
Colors *getColors () const {
|
||||
return mColors;
|
||||
}
|
||||
ColorListModel *getColorListModel () const {
|
||||
return mColorListModel;
|
||||
}
|
||||
ImageListModel *getImageListModel () const {
|
||||
return mImageListModel;
|
||||
}
|
||||
|
||||
//static ColorListModel *getColorListModel () const {
|
||||
//return App::getInstance()-getColorListModel();
|
||||
//}
|
||||
|
||||
QSystemTrayIcon *getSystemTrayIcon () const {
|
||||
return mSystemTrayIcon;
|
||||
|
|
@ -174,7 +183,8 @@ private:
|
|||
QQuickWindow *mCallsWindow = nullptr;
|
||||
QQuickWindow *mSettingsWindow = nullptr;
|
||||
|
||||
Colors *mColors = nullptr;
|
||||
ColorListModel * mColorListModel;
|
||||
ImageListModel * mImageListModel;
|
||||
|
||||
QSystemTrayIcon *mSystemTrayIcon = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,213 +23,217 @@
|
|||
#include <QPainter>
|
||||
#include <QScreen>
|
||||
#include <QSvgRenderer>
|
||||
#include <QQmlPropertyMap>
|
||||
|
||||
#include "app/App.hpp"
|
||||
#include "components/other/colors/Colors.hpp"
|
||||
|
||||
#include "ImageProvider.hpp"
|
||||
#include "components/other/colors/ColorListModel.hpp"
|
||||
#include "components/other/colors/ColorModel.hpp"
|
||||
#include "components/other/images/ImageListModel.hpp"
|
||||
#include "components/other/images/ImageModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
// Max image size in bytes. (100Kb)
|
||||
constexpr qint64 MaxImageSize = 102400;
|
||||
// Max image size in bytes. (100Kb)
|
||||
constexpr qint64 MaxImageSize = 102400;
|
||||
}
|
||||
|
||||
static void removeAttribute (QXmlStreamAttributes &readerAttributes, const QString &name) {
|
||||
auto it = find_if(readerAttributes.cbegin(), readerAttributes.cend(), [&name](const QXmlStreamAttribute &attribute) {
|
||||
return name == attribute.name() && !attribute.prefix().length();
|
||||
});
|
||||
if (it != readerAttributes.cend())
|
||||
readerAttributes.remove(int(distance(readerAttributes.cbegin(), it)));
|
||||
auto it = find_if(readerAttributes.cbegin(), readerAttributes.cend(), [&name](const QXmlStreamAttribute &attribute) {
|
||||
return name == attribute.name() && !attribute.prefix().length();
|
||||
});
|
||||
if (it != readerAttributes.cend())
|
||||
readerAttributes.remove(int(distance(readerAttributes.cbegin(), it)));
|
||||
}
|
||||
|
||||
static QByteArray buildByteArrayAttribute (const QByteArray &name, const QByteArray &value) {
|
||||
QByteArray attribute = name;
|
||||
attribute.append("=\"");
|
||||
attribute.append(value);
|
||||
attribute.append("\" ");
|
||||
return attribute;
|
||||
QByteArray attribute = name;
|
||||
attribute.append("=\"");
|
||||
attribute.append(value);
|
||||
attribute.append("\" ");
|
||||
return attribute;
|
||||
}
|
||||
|
||||
static QByteArray parseFillAndStroke (QXmlStreamAttributes &readerAttributes, const Colors &colors) {
|
||||
static QRegExp regex("^color-([^-]+)-(fill|stroke)$");
|
||||
|
||||
QByteArray attributes;
|
||||
|
||||
for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) {
|
||||
regex.indexIn(classValue.trimmed());
|
||||
if (Q_LIKELY(regex.pos() == -1))
|
||||
continue;
|
||||
|
||||
const QStringList list = regex.capturedTexts();
|
||||
|
||||
const QVariant colorValue = colors.property(list[1].toStdString().c_str());
|
||||
if (Q_UNLIKELY(!colorValue.isValid())) {
|
||||
qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
removeAttribute(readerAttributes, list[2]);
|
||||
attributes.append(buildByteArrayAttribute(list[2].toLatin1(), colorValue.value<QColor>().name().toLatin1()));
|
||||
}
|
||||
|
||||
return attributes;
|
||||
static QByteArray parseFillAndStroke (QXmlStreamAttributes &readerAttributes, const ColorListModel *colors) {
|
||||
static QRegExp regex("^color-([^-]+)-(fill|stroke)$");
|
||||
|
||||
QByteArray attributes;
|
||||
|
||||
for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) {
|
||||
regex.indexIn(classValue.trimmed());
|
||||
if (Q_LIKELY(regex.pos() == -1))
|
||||
continue;
|
||||
|
||||
const QStringList list = regex.capturedTexts();
|
||||
|
||||
const QVariant colorValue = colors->getQmlData()->value(list[1]);
|
||||
if (Q_UNLIKELY(!colorValue.isValid())) {
|
||||
qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
removeAttribute(readerAttributes, list[2]);
|
||||
attributes.append(buildByteArrayAttribute(list[2].toLatin1(), colorValue.value<ColorModel*>()->getColor().name().toLatin1()));
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const Colors &colors) {
|
||||
static QRegExp regex("^color-([^-]+)-style-(fill|stroke)$");
|
||||
|
||||
QByteArray attribute;
|
||||
|
||||
QSet<QString> overrode;
|
||||
for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) {
|
||||
regex.indexIn(classValue.trimmed());
|
||||
if (Q_LIKELY(regex.pos() == -1))
|
||||
continue;
|
||||
|
||||
const QStringList list = regex.capturedTexts();
|
||||
|
||||
overrode.insert(list[2]);
|
||||
|
||||
const QVariant colorValue = colors.property(list[1].toStdString().c_str());
|
||||
if (Q_UNLIKELY(!colorValue.isValid())) {
|
||||
qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
attribute.append(list[2].toLatin1());
|
||||
attribute.append(":");
|
||||
attribute.append(colorValue.value<QColor>().name().toLatin1());
|
||||
attribute.append(";");
|
||||
}
|
||||
|
||||
const QByteArrayList styleValues = readerAttributes.value("style").toLatin1().split(';');
|
||||
for (const auto &styleValue : styleValues) {
|
||||
const QByteArrayList list = styleValue.split(':');
|
||||
if (Q_UNLIKELY(list.length() > 0 && !overrode.contains(list[0]))) {
|
||||
attribute.append(styleValue);
|
||||
attribute.append(";");
|
||||
}
|
||||
}
|
||||
|
||||
removeAttribute(readerAttributes, "style");
|
||||
|
||||
if (attribute.length() > 0) {
|
||||
attribute.prepend("style=\"");
|
||||
attribute.append("\" ");
|
||||
}
|
||||
|
||||
return attribute;
|
||||
static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const ColorListModel *colors) {
|
||||
static QRegExp regex("^color-([^-]+)-style-(fill|stroke)$");
|
||||
|
||||
QByteArray attribute;
|
||||
|
||||
QSet<QString> overrode;
|
||||
for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) {
|
||||
regex.indexIn(classValue.trimmed());
|
||||
if (Q_LIKELY(regex.pos() == -1))
|
||||
continue;
|
||||
|
||||
const QStringList list = regex.capturedTexts();
|
||||
|
||||
overrode.insert(list[2]);
|
||||
|
||||
const QVariant colorValue = colors->getQmlData()->value(list[1]);
|
||||
if (Q_UNLIKELY(!colorValue.isValid())) {
|
||||
qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
attribute.append(list[2].toLatin1());
|
||||
attribute.append(":");
|
||||
attribute.append(colorValue.value<ColorModel*>()->getColor().name().toLatin1());
|
||||
attribute.append(";");
|
||||
}
|
||||
|
||||
const QByteArrayList styleValues = readerAttributes.value("style").toLatin1().split(';');
|
||||
for (const auto &styleValue : styleValues) {
|
||||
const QByteArrayList list = styleValue.split(':');
|
||||
if (Q_UNLIKELY(list.length() > 0 && !overrode.contains(list[0]))) {
|
||||
attribute.append(styleValue);
|
||||
attribute.append(";");
|
||||
}
|
||||
}
|
||||
|
||||
removeAttribute(readerAttributes, "style");
|
||||
|
||||
if (attribute.length() > 0) {
|
||||
attribute.prepend("style=\"");
|
||||
attribute.append("\" ");
|
||||
}
|
||||
|
||||
return attribute;
|
||||
}
|
||||
|
||||
static QByteArray parseAttributes (const QXmlStreamReader &reader, const Colors &colors) {
|
||||
QXmlStreamAttributes readerAttributes = reader.attributes();
|
||||
|
||||
QByteArray attributes = parseFillAndStroke(readerAttributes, colors);
|
||||
attributes.append(parseStyle(readerAttributes, colors));
|
||||
|
||||
for (const auto &attribute : readerAttributes) {
|
||||
const QByteArray prefix = attribute.prefix().toLatin1();
|
||||
if (Q_UNLIKELY(prefix.length() > 0)) {
|
||||
attributes.append(prefix);
|
||||
attributes.append(":");
|
||||
}
|
||||
|
||||
attributes.append(
|
||||
buildByteArrayAttribute(attribute.name().toLatin1(), attribute.value().toLatin1())
|
||||
);
|
||||
}
|
||||
|
||||
return attributes;
|
||||
static QByteArray parseAttributes (const QXmlStreamReader &reader, const ColorListModel *colors) {
|
||||
QXmlStreamAttributes readerAttributes = reader.attributes();
|
||||
|
||||
QByteArray attributes = parseFillAndStroke(readerAttributes, colors);
|
||||
attributes.append(parseStyle(readerAttributes, colors));
|
||||
|
||||
for (const auto &attribute : readerAttributes) {
|
||||
const QByteArray prefix = attribute.prefix().toLatin1();
|
||||
if (Q_UNLIKELY(prefix.length() > 0)) {
|
||||
attributes.append(prefix);
|
||||
attributes.append(":");
|
||||
}
|
||||
|
||||
attributes.append(
|
||||
buildByteArrayAttribute(attribute.name().toLatin1(), attribute.value().toLatin1())
|
||||
);
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
static QByteArray parseDeclarations (const QXmlStreamReader &reader) {
|
||||
QByteArray declarations;
|
||||
for (const auto &declaration : reader.namespaceDeclarations()) {
|
||||
const QByteArray prefix = declaration.prefix().toLatin1();
|
||||
if (Q_UNLIKELY(prefix.length() > 0)) {
|
||||
declarations.append("xmlns:");
|
||||
declarations.append(prefix);
|
||||
} else
|
||||
declarations.append("xmlns");
|
||||
|
||||
declarations.append("=\"");
|
||||
declarations.append(declaration.namespaceUri().toLatin1());
|
||||
declarations.append("\" ");
|
||||
}
|
||||
|
||||
return declarations;
|
||||
QByteArray declarations;
|
||||
for (const auto &declaration : reader.namespaceDeclarations()) {
|
||||
const QByteArray prefix = declaration.prefix().toLatin1();
|
||||
if (Q_UNLIKELY(prefix.length() > 0)) {
|
||||
declarations.append("xmlns:");
|
||||
declarations.append(prefix);
|
||||
} else
|
||||
declarations.append("xmlns");
|
||||
|
||||
declarations.append("=\"");
|
||||
declarations.append(declaration.namespaceUri().toLatin1());
|
||||
declarations.append("\" ");
|
||||
}
|
||||
|
||||
return declarations;
|
||||
}
|
||||
|
||||
static QByteArray parseStartDocument (const QXmlStreamReader &reader) {
|
||||
QByteArray startDocument = "<?xml version=\"";
|
||||
startDocument.append(reader.documentVersion().toLatin1());
|
||||
startDocument.append("\" encoding=\"");
|
||||
startDocument.append(reader.documentEncoding().toLatin1());
|
||||
startDocument.append("\"?>");
|
||||
return startDocument;
|
||||
QByteArray startDocument = "<?xml version=\"";
|
||||
startDocument.append(reader.documentVersion().toLatin1());
|
||||
startDocument.append("\" encoding=\"");
|
||||
startDocument.append(reader.documentEncoding().toLatin1());
|
||||
startDocument.append("\"?>");
|
||||
return startDocument;
|
||||
}
|
||||
|
||||
static QByteArray parseStartElement (const QXmlStreamReader &reader, const Colors &colors) {
|
||||
QByteArray startElement = "<";
|
||||
startElement.append(reader.name().toLatin1());
|
||||
startElement.append(" ");
|
||||
startElement.append(parseAttributes(reader, colors));
|
||||
startElement.append(" ");
|
||||
startElement.append(parseDeclarations(reader));
|
||||
startElement.append(">");
|
||||
return startElement;
|
||||
static QByteArray parseStartElement (const QXmlStreamReader &reader, const ColorListModel *colors) {
|
||||
QByteArray startElement = "<";
|
||||
startElement.append(reader.name().toLatin1());
|
||||
startElement.append(" ");
|
||||
startElement.append(parseAttributes(reader, colors));
|
||||
startElement.append(" ");
|
||||
startElement.append(parseDeclarations(reader));
|
||||
startElement.append(">");
|
||||
return startElement;
|
||||
}
|
||||
|
||||
static QByteArray parseEndElement (const QXmlStreamReader &reader) {
|
||||
QByteArray endElement = "</";
|
||||
endElement.append(reader.name().toLatin1());
|
||||
endElement.append(">");
|
||||
return endElement;
|
||||
QByteArray endElement = "</";
|
||||
endElement.append(reader.name().toLatin1());
|
||||
endElement.append(">");
|
||||
return endElement;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static QByteArray computeContent (QFile &file) {
|
||||
const Colors *colors = App::getInstance()->getColors();
|
||||
|
||||
QByteArray content;
|
||||
QXmlStreamReader reader(&file);
|
||||
while (!reader.atEnd())
|
||||
switch (reader.readNext()) {
|
||||
case QXmlStreamReader::Comment:
|
||||
case QXmlStreamReader::DTD:
|
||||
case QXmlStreamReader::EndDocument:
|
||||
case QXmlStreamReader::Invalid:
|
||||
case QXmlStreamReader::NoToken:
|
||||
case QXmlStreamReader::ProcessingInstruction:
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::StartDocument:
|
||||
content.append(parseStartDocument(reader));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::StartElement:
|
||||
content.append(parseStartElement(reader, *colors));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::EndElement:
|
||||
content.append(parseEndElement(reader));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::Characters:
|
||||
content.append(reader.text().toLatin1());
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::EntityReference:
|
||||
content.append(reader.name().toLatin1());
|
||||
break;
|
||||
}
|
||||
|
||||
return reader.hasError() ? QByteArray() : content;
|
||||
const ColorListModel *colors = App::getInstance()->getColorListModel();
|
||||
|
||||
QByteArray content;
|
||||
QXmlStreamReader reader(&file);
|
||||
while (!reader.atEnd())
|
||||
switch (reader.readNext()) {
|
||||
case QXmlStreamReader::Comment:
|
||||
case QXmlStreamReader::DTD:
|
||||
case QXmlStreamReader::EndDocument:
|
||||
case QXmlStreamReader::Invalid:
|
||||
case QXmlStreamReader::NoToken:
|
||||
case QXmlStreamReader::ProcessingInstruction:
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::StartDocument:
|
||||
content.append(parseStartDocument(reader));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::StartElement:
|
||||
content.append(parseStartElement(reader, colors));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::EndElement:
|
||||
content.append(parseEndElement(reader));
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::Characters:
|
||||
content.append(reader.text().toLatin1());
|
||||
break;
|
||||
|
||||
case QXmlStreamReader::EntityReference:
|
||||
content.append(reader.name().toLatin1());
|
||||
break;
|
||||
}
|
||||
|
||||
return reader.hasError() ? QByteArray() : content;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -237,70 +241,79 @@ static QByteArray computeContent (QFile &file) {
|
|||
const QString ImageProvider::ProviderId = "internal";
|
||||
|
||||
ImageProvider::ImageProvider () : QQuickImageProvider(
|
||||
QQmlImageProviderBase::Image,
|
||||
QQmlImageProviderBase::ForceAsynchronousImageLoading
|
||||
) {}
|
||||
QQmlImageProviderBase::Image,
|
||||
QQmlImageProviderBase::ForceAsynchronousImageLoading
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize &requestedSize) {
|
||||
const QString path = QStringLiteral(":%1").arg(id);
|
||||
// qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).")
|
||||
// .arg(path).arg(requestedSize.width()).arg(requestedSize.height());
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
// 1. Read and update XML content.
|
||||
*size = QSize();
|
||||
QFile file(path);
|
||||
if (Q_UNLIKELY(QFileInfo(file).size() > MaxImageSize)) {
|
||||
qWarning() << QStringLiteral("Unable to open large file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
if (Q_UNLIKELY(!file.open(QIODevice::ReadOnly))) {
|
||||
qWarning() << QStringLiteral("Unable to open file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
const QByteArray content = computeContent(file);
|
||||
if (Q_UNLIKELY(!content.length())) {
|
||||
qWarning() << QStringLiteral("Unable to parse file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// 2. Build svg renderer.
|
||||
QSvgRenderer renderer(content);
|
||||
if (Q_UNLIKELY(!renderer.isValid())) {
|
||||
qWarning() << QStringLiteral("Invalid svg file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QSize askedSize = !requestedSize.isEmpty()
|
||||
? requestedSize
|
||||
: renderer.defaultSize() * QGuiApplication::primaryScreen()->devicePixelRatio();
|
||||
|
||||
// 3. Create image.
|
||||
QImage image(askedSize, QImage::Format_ARGB32_Premultiplied);
|
||||
if (Q_UNLIKELY(image.isNull())) {
|
||||
qWarning() << QStringLiteral("Unable to create image from path: `%1`.")
|
||||
.arg(path);
|
||||
return QImage(); // Memory cannot be allocated.
|
||||
}
|
||||
image.fill(Qt::transparent);// Fill with transparent to set alpha channel
|
||||
|
||||
*size = image.size();
|
||||
|
||||
// 4. Paint!
|
||||
QPainter painter(&image);
|
||||
renderer.render(&painter);
|
||||
|
||||
// qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed());
|
||||
|
||||
return image;
|
||||
ImageModel * model = App::getInstance()->getImageListModel()->getImageModel(id);
|
||||
if(!model)
|
||||
return QImage();
|
||||
const QString path = model->getPath();
|
||||
//qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).")
|
||||
// .arg(path).arg(requestedSize.width()).arg(requestedSize.height());
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
// 1. Read and update XML content.
|
||||
*size = QSize();
|
||||
QFile file(path);
|
||||
|
||||
if(!file.exists()){
|
||||
qWarning() << QStringLiteral("File doesn't exist: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
if (Q_UNLIKELY(QFileInfo(file).size() > MaxImageSize)) {
|
||||
qWarning() << QStringLiteral("Unable to open large file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
if (Q_UNLIKELY(!file.open(QIODevice::ReadOnly))) {
|
||||
qWarning() << QStringLiteral("Unable to open file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
const QByteArray content = computeContent(file);
|
||||
if (Q_UNLIKELY(!content.length())) {
|
||||
qWarning() << QStringLiteral("Unable to parse file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// 2. Build svg renderer.
|
||||
QSvgRenderer renderer(content);
|
||||
if (Q_UNLIKELY(!renderer.isValid())) {
|
||||
qWarning() << QStringLiteral("Invalid svg file: `%1`.").arg(path);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QSize askedSize = !requestedSize.isEmpty()
|
||||
? requestedSize
|
||||
: renderer.defaultSize() * QGuiApplication::primaryScreen()->devicePixelRatio();
|
||||
|
||||
// 3. Create image.
|
||||
QImage image(askedSize, QImage::Format_ARGB32_Premultiplied);
|
||||
if (Q_UNLIKELY(image.isNull())) {
|
||||
qWarning() << QStringLiteral("Unable to create image from path: `%1`.")
|
||||
.arg(path);
|
||||
return QImage(); // Memory cannot be allocated.
|
||||
}
|
||||
image.fill(Qt::transparent);// Fill with transparent to set alpha channel
|
||||
|
||||
*size = image.size();
|
||||
|
||||
// 4. Paint!
|
||||
QPainter painter(&image);
|
||||
renderer.render(&painter);
|
||||
|
||||
// qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed());
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
QPixmap ImageProvider::requestPixmap (const QString &id, QSize *size, const QSize &requestedSize) {
|
||||
return QPixmap::fromImage(requestImage(id, size, requestedSize));
|
||||
return QPixmap::fromImage(requestImage(id, size, requestedSize));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,9 +77,14 @@
|
|||
#include "timeline/TimelineListModel.hpp"
|
||||
#include "url-handlers/UrlHandlers.hpp"
|
||||
|
||||
#include "other/colors/Colors.hpp"
|
||||
#include "other/colors/ColorModel.hpp"
|
||||
#include "other/colors/ColorListModel.hpp"
|
||||
#include "other/colors/ColorProxyModel.hpp"
|
||||
#include "other/clipboard/Clipboard.hpp"
|
||||
#include "other/desktop-tools/DesktopTools.hpp"
|
||||
#include "other/images/ImageModel.hpp"
|
||||
#include "other/images/ImageListModel.hpp"
|
||||
#include "other/images/ImageProxyModel.hpp"
|
||||
#include "other/text-to-speech/TextToSpeech.hpp"
|
||||
#include "other/units/Units.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <QQmlApplicationEngine>
|
||||
|
||||
#include "app/App.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
|
||||
#include "ChatCallModel.hpp"
|
||||
|
||||
|
|
@ -78,4 +79,7 @@ void ChatCallModel::setIsOutgoing(const bool& data){
|
|||
bool ChatCallModel::update(){
|
||||
setIsOutgoing(mCallLog->getDir() == linphone::Call::Dir::Outgoing);
|
||||
setStatus(LinphoneEnums::fromLinphone(mCallLog->getStatus()));
|
||||
}
|
||||
void ChatCallModel::deleteEvent(){
|
||||
CoreManager::getInstance()->getCore()->removeCallLog(mCallLog);
|
||||
}
|
||||
|
|
@ -50,6 +50,8 @@ public:
|
|||
|
||||
bool update();
|
||||
|
||||
virtual void deleteEvent() override;
|
||||
|
||||
bool mIsStart;
|
||||
LinphoneEnums::CallStatus mStatus;
|
||||
bool mIsOutgoing;
|
||||
|
|
|
|||
|
|
@ -147,13 +147,7 @@ void ContentModel::createThumbnail () {
|
|||
auto chatMessageFileContentModel = mChatMessageModel->getFileContentModel();
|
||||
if( chatMessageFileContentModel && chatMessageFileContentModel->getContent() == mContent){
|
||||
QString id;
|
||||
auto a = chatMessageFileContentModel->getContent();
|
||||
auto b = mChatMessageModel->getChatMessage()->getFileTransferInformation();
|
||||
if( a == b)
|
||||
qWarning() << "OK";
|
||||
else
|
||||
qWarning() << "NOOOOOOOOOO";
|
||||
QString path = Utils::coreStringToAppString(b->getFilePath());
|
||||
QString path = Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getFileTransferInformation()->getFilePath());
|
||||
|
||||
auto appdata = ChatMessageModel::AppDataManager(Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getAppdata()));
|
||||
|
||||
|
|
|
|||
|
|
@ -137,4 +137,8 @@ void ChatNoticeModel::setEventLogType(const LinphoneEnums::EventLogType& data){
|
|||
mEventLogType = data;
|
||||
emit eventLogTypeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatNoticeModel::deleteEvent(){
|
||||
mEventLog->deleteFromDatabase();
|
||||
}
|
||||
|
|
@ -55,6 +55,7 @@ public:
|
|||
void setEventLogType(const LinphoneEnums::EventLogType& data);
|
||||
|
||||
bool update(); // Update data from eventLog
|
||||
virtual void deleteEvent() override;
|
||||
|
||||
QString mName;
|
||||
NoticeType mStatus;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "components/core/CoreHandlers.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/notifier/Notifier.hpp"
|
||||
#include "components/settings/AccountSettingsModel.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
#include "components/participant/ParticipantModel.hpp"
|
||||
#include "components/participant/ParticipantListModel.hpp"
|
||||
|
|
@ -95,21 +96,19 @@ ChatRoomModel::ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom){
|
|||
setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount());
|
||||
setMissedCallsCount(0);
|
||||
|
||||
qWarning() << "Creation ChatRoom with unreadmessages: " << mChatRoom->getUnreadMessagesCount();
|
||||
|
||||
// Get messages.
|
||||
mEntries.clear();
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
{
|
||||
CoreHandlers *coreHandlers = mCoreHandlers.get();
|
||||
//QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &ChatRoomModel::handleMessageReceived);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::callCreated, this, &ChatRoomModel::handleCallCreated);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &ChatRoomModel::handleCallStateChanged);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::presenceStatusReceived, this, &ChatRoomModel::handlePresenceStatusReceived);
|
||||
CoreHandlers *coreHandlers = mCoreHandlers.get();
|
||||
//QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &ChatRoomModel::handleMessageReceived);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::callCreated, this, &ChatRoomModel::handleCallCreated);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &ChatRoomModel::handleCallStateChanged);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::presenceStatusReceived, this, &ChatRoomModel::handlePresenceStatusReceived);
|
||||
//QObject::connect(coreHandlers, &CoreHandlers::isComposingChanged, this, &ChatRoomModel::handleIsComposingChanged);
|
||||
}
|
||||
|
||||
//QObject::connect(this, &ChatRoomModel::messageCountReset, coreManager, &CoreManager::eventCountChanged );
|
||||
if(mChatRoom){
|
||||
mParticipantListModel = std::make_shared<ParticipantListModel>(this);
|
||||
connect(mParticipantListModel.get(), &ParticipantListModel::participantsChanged, this, &ChatRoomModel::fullPeerAddressChanged);
|
||||
|
|
@ -197,14 +196,13 @@ bool ChatRoomModel::removeRows (int row, int count, const QModelIndex &parent) {
|
|||
}
|
||||
|
||||
void ChatRoomModel::removeAllEntries () {
|
||||
qInfo() << QStringLiteral("Removing all chat entries of: (%1, %2).")
|
||||
qInfo() << QStringLiteral("Removing all entries of: (%1, %2).")
|
||||
.arg(getPeerAddress()).arg(getLocalAddress());
|
||||
|
||||
beginResetModel();
|
||||
for (auto &entry : mEntries)
|
||||
entry->deleteEvent();
|
||||
mEntries.clear();
|
||||
|
||||
endResetModel();
|
||||
emit allEntriesRemoved(mSelf.lock());
|
||||
emit focused();// Removing all entries is like having focus. Don't wait asynchronous events.
|
||||
|
|
@ -356,6 +354,10 @@ bool ChatRoomModel::isMeAdmin() const{
|
|||
return mChatRoom->getMe()->isAdmin();
|
||||
}
|
||||
|
||||
bool ChatRoomModel::isCurrentProxy() const{
|
||||
return mChatRoom->getLocalAddress()->weakEqual(CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddress());
|
||||
}
|
||||
|
||||
bool ChatRoomModel::canHandleParticipants() const{
|
||||
return mChatRoom->canHandleParticipants();
|
||||
}
|
||||
|
|
@ -501,6 +503,7 @@ void ChatRoomModel::resetMessageCount () {
|
|||
}
|
||||
setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount());
|
||||
setMissedCallsCount(0);
|
||||
CoreManager::getInstance()->updateUnreadMessageCount();
|
||||
emit messageCountReset();
|
||||
}
|
||||
}
|
||||
|
|
@ -566,6 +569,7 @@ void ChatRoomModel::insertMessageAtEnd (const shared_ptr<linphone::ChatMessage>
|
|||
if(mIsInitialized){
|
||||
std::shared_ptr<ChatMessageModel> model = ChatMessageModel::create(message, this);
|
||||
if(model){
|
||||
setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount());
|
||||
int row = mEntries.count();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
mEntries << model;
|
||||
|
|
@ -618,13 +622,15 @@ void ChatRoomModel::handlePresenceStatusReceived(std::shared_ptr<linphone::Frien
|
|||
if(!canUpdatePresence && !isGroupEnabled() && mChatRoom->getNbParticipants() == 1){
|
||||
auto participants = mChatRoom->getParticipants();
|
||||
auto contact = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(QString::fromStdString((*participants.begin())->getAddress()->asString()));
|
||||
auto friendsAddresses = contact->getVcardModel()->getSipAddresses();
|
||||
for(auto friendAddress = friendsAddresses.begin() ; !canUpdatePresence && friendAddress != friendsAddresses.end() ; ++friendAddress){
|
||||
shared_ptr<linphone::Address> lAddress = CoreManager::getInstance()->getCore()->interpretUrl(
|
||||
Utils::appStringToCoreString(friendAddress->toString())
|
||||
);
|
||||
canUpdatePresence = lAddress->weakEqual(*itContactAddress);
|
||||
}
|
||||
if(contact){
|
||||
auto friendsAddresses = contact->getVcardModel()->getSipAddresses();
|
||||
for(auto friendAddress = friendsAddresses.begin() ; !canUpdatePresence && friendAddress != friendsAddresses.end() ; ++friendAddress){
|
||||
shared_ptr<linphone::Address> lAddress = CoreManager::getInstance()->getCore()->interpretUrl(
|
||||
Utils::appStringToCoreString(friendAddress->toString())
|
||||
);
|
||||
canUpdatePresence = lAddress->weakEqual(*itContactAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(canUpdatePresence) {
|
||||
|
|
@ -639,7 +645,6 @@ void ChatRoomModel::handlePresenceStatusReceived(std::shared_ptr<linphone::Frien
|
|||
//----------------------------------------------------------
|
||||
|
||||
void ChatRoomModel::onIsComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing){
|
||||
//ContactModel * model = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString(remoteAddress->asString()));
|
||||
if(!isComposing) {
|
||||
auto it = mComposers.begin();
|
||||
while(it != mComposers.end() && !it.key()->weakEqual(remoteAddress))
|
||||
|
|
@ -648,26 +653,23 @@ void ChatRoomModel::onIsComposingReceived(const std::shared_ptr<linphone::ChatRo
|
|||
mComposers.erase(it);
|
||||
}else
|
||||
mComposers[remoteAddress] = Utils::getDisplayName(remoteAddress);
|
||||
qWarning() << "Composing : " << isComposing << mComposers.values();
|
||||
emit isRemoteComposingChanged();
|
||||
}
|
||||
|
||||
void ChatRoomModel::onMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message){
|
||||
qWarning() << "M1";
|
||||
setUnreadMessagesCount(chatRoom->getUnreadMessagesCount());
|
||||
}
|
||||
|
||||
void ChatRoomModel::onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "New Event" <<(int) eventLog->getType();
|
||||
if( eventLog->getType() == linphone::EventLog::Type::ConferenceCallEnd ){
|
||||
setMissedCallsCount(mMissedCallsCount+1);
|
||||
setLastUpdateTime(QDateTime::fromMSecsSinceEpoch(chatRoom->getLastUpdateTime()));
|
||||
}else if( eventLog->getType() == linphone::EventLog::Type::ConferenceCreated ){
|
||||
emit fullPeerAddressChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatRoomModel::onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) {
|
||||
qWarning() << "M2";
|
||||
auto message = eventLog->getChatMessage();
|
||||
if(message){
|
||||
insertMessageAtEnd(message);
|
||||
|
|
@ -677,7 +679,6 @@ void ChatRoomModel::onChatMessageReceived(const std::shared_ptr<linphone::ChatRo
|
|||
}
|
||||
|
||||
void ChatRoomModel::onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "S1";
|
||||
auto message = eventLog->getChatMessage();
|
||||
if(message){
|
||||
insertMessageAtEnd(message);
|
||||
|
|
@ -687,7 +688,6 @@ void ChatRoomModel::onChatMessageSending(const std::shared_ptr<linphone::ChatRoo
|
|||
}
|
||||
|
||||
void ChatRoomModel::onChatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "S2";
|
||||
}
|
||||
|
||||
void ChatRoomModel::onParticipantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
|
|
@ -723,7 +723,6 @@ void ChatRoomModel::onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> &
|
|||
if( e != events.end() )
|
||||
insertNotice(*e);
|
||||
emit securityLevelChanged((int)chatRoom->getSecurityLevel());
|
||||
//emit securityEvent(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModel::onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) {
|
||||
emit subjectChanged(getSubject());
|
||||
|
|
@ -742,7 +741,6 @@ void ChatRoomModel::onParticipantDeviceRemoved(const std::shared_ptr<linphone::C
|
|||
}
|
||||
|
||||
void ChatRoomModel::onConferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "onConferenceJoined";
|
||||
auto events = chatRoom->getHistoryEvents(0);
|
||||
auto e = std::find(events.begin(), events.end(), eventLog);
|
||||
if(e != events.end() )
|
||||
|
|
@ -760,7 +758,6 @@ void ChatRoomModel::onConferenceJoined(const std::shared_ptr<linphone::ChatRoom>
|
|||
}
|
||||
|
||||
void ChatRoomModel::onConferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "onConferenceLeft";
|
||||
if( chatRoom->getState() != linphone::ChatRoom::State::Deleted) {
|
||||
auto events = chatRoom->getHistoryEvents(0);
|
||||
auto e = std::find(events.begin(), events.end(), eventLog);
|
||||
|
|
@ -785,15 +782,12 @@ void ChatRoomModel::onEphemeralEvent(const std::shared_ptr<linphone::ChatRoom> &
|
|||
}
|
||||
|
||||
void ChatRoomModel::onEphemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "onEphemeralMessageTimerStarted";
|
||||
}
|
||||
|
||||
void ChatRoomModel::onEphemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
qWarning() << "onEphemeralMessageDeleted";
|
||||
}
|
||||
|
||||
void ChatRoomModel::onConferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom){
|
||||
qWarning() << "onConferenceAddressGeneration";
|
||||
}
|
||||
|
||||
void ChatRoomModel::onParticipantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress){
|
||||
|
|
@ -805,7 +799,7 @@ void ChatRoomModel::onParticipantRegistrationUnsubscriptionRequested(const std::
|
|||
}
|
||||
|
||||
void ChatRoomModel::onChatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message){
|
||||
qWarning() << "onChatMessageShouldBeStored";
|
||||
|
||||
}
|
||||
|
||||
void ChatRoomModel::onChatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state){
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ public:
|
|||
int getSecurityLevel() const;
|
||||
bool isGroupEnabled() const;
|
||||
bool isMeAdmin() const;
|
||||
bool isCurrentProxy() const; // Return true if this chat room is Me() is the current proxy
|
||||
bool canHandleParticipants() const;
|
||||
bool getIsRemoteComposing () const;
|
||||
ParticipantListModel* getParticipants() const;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ void CoreHandlers::onChatRoomStateChanged(
|
|||
const std::shared_ptr<linphone::ChatRoom> & chatRoom,
|
||||
linphone::ChatRoom::State state
|
||||
) {
|
||||
qWarning() << "ChatRoomState : " << (int)state;
|
||||
emit chatRoomStateChanged(chatRoom, state);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,9 @@ void CoreManager::forceRefreshRegisters () {
|
|||
qInfo() << QStringLiteral("Refresh registers.");
|
||||
mCore->refreshRegisters();
|
||||
}
|
||||
|
||||
void CoreManager::updateUnreadMessageCount(){
|
||||
mEventCountNotifier->updateUnreadMessageCount();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CoreManager::sendLogs () const {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ public:
|
|||
Q_INVOKABLE VcardModel *createDetachedVcardModel () const;
|
||||
|
||||
Q_INVOKABLE void forceRefreshRegisters ();
|
||||
void updateUnreadMessageCount();
|
||||
|
||||
Q_INVOKABLE void sendLogs () const;
|
||||
Q_INVOKABLE void cleanLogs () const;
|
||||
|
|
@ -176,7 +177,7 @@ signals:
|
|||
|
||||
void logsUploaded (const QString &url);
|
||||
|
||||
void eventCountChanged (int count);
|
||||
void eventCountChanged ();
|
||||
|
||||
private:
|
||||
CoreManager (QObject *parent, const QString &configPath);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void AbstractEventCountNotifier::internalnotifyEventCount () {
|
|||
n = n > 99 ? 99 : n;
|
||||
|
||||
notifyEventCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() ? n : 0);
|
||||
emit eventCountChanged(n);
|
||||
emit eventCountChanged();
|
||||
}
|
||||
|
||||
// Get missed call from a chat (useful for showing bubbles on Timelines)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
int getMissedCallCountFromLocal(const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines)
|
||||
|
||||
signals:
|
||||
void eventCountChanged (int count);
|
||||
void eventCountChanged ();
|
||||
|
||||
protected:
|
||||
virtual void notifyEventCount (int n) = 0;
|
||||
|
|
|
|||
|
|
@ -286,6 +286,8 @@ void Notifier::notifyReceivedMessage (const shared_ptr<linphone::ChatMessage> &m
|
|||
|
||||
void Notifier::notifyReceivedFileMessage (const shared_ptr<linphone::ChatMessage> &message) {
|
||||
QVariantMap map;
|
||||
shared_ptr<linphone::ChatRoom> chatRoom(message->getChatRoom());
|
||||
map["timelineModel"].setValue(CoreManager::getInstance()->getTimelineListModel()->getTimeline(chatRoom, true).get());
|
||||
map["fileUri"] = Utils::coreStringToAppString(message->getFileTransferInformation()->getFilePath());
|
||||
if( Utils::getImage(map["fileUri"].toString()).isNull())
|
||||
map["imageUri"] = "";
|
||||
|
|
|
|||
158
linphone-app/src/components/other/colors/ColorListModel.cpp
Normal file
158
linphone-app/src/components/other/colors/ColorListModel.cpp
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ColorListModel.hpp"
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QJsonValue>
|
||||
#if LINPHONE_FRIDAY
|
||||
#include <QDate>
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
|
||||
|
||||
#include "app/App.hpp"
|
||||
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
|
||||
namespace {
|
||||
constexpr char ColorsSection[] = "ui_colors";
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ColorListModel::ColorListModel ( QObject *parent) : QAbstractListModel(parent) {
|
||||
init();
|
||||
}
|
||||
|
||||
int ColorListModel::rowCount (const QModelIndex &index) const{
|
||||
return mList.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ColorListModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$color";
|
||||
return roles;
|
||||
}
|
||||
|
||||
QVariant ColorListModel::data (const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
if (!index.isValid() || row < 0 || row >= mList.count())
|
||||
return QVariant();
|
||||
|
||||
//if (role == Qt::DisplayRole)
|
||||
return QVariant::fromValue(mList[row].get());
|
||||
|
||||
//return QVariant();
|
||||
}
|
||||
|
||||
void ColorListModel::add(std::shared_ptr<ColorModel> color){
|
||||
int row = mList.count();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
setProperty(color->getName().toStdString().c_str(), QVariant::fromValue(color.get()));
|
||||
|
||||
mData.insert(color->getName(), QVariant::fromValue(color.get()));
|
||||
mList << color;
|
||||
|
||||
endInsertRows();
|
||||
resetInternalData();
|
||||
}
|
||||
|
||||
bool ColorListModel::removeRow (int row, const QModelIndex &parent){
|
||||
return removeRows(row, 1, parent);
|
||||
}
|
||||
|
||||
bool ColorListModel::removeRows (int row, int count, const QModelIndex &parent) {
|
||||
int limit = row + count - 1;
|
||||
if (row < 0 || count < 0 || limit >= mList.count())
|
||||
return false;
|
||||
beginRemoveRows(parent, row, limit);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
mList.takeAt(row);
|
||||
|
||||
endRemoveRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorListModel::useConfig (const std::shared_ptr<linphone::Config> &config) {
|
||||
#if LINPHONE_FRIDAY
|
||||
if (!isLinphoneFriday())
|
||||
overrideColors(config);
|
||||
#else
|
||||
overrideColors(config);
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
}
|
||||
|
||||
QString ColorListModel::getNames(){
|
||||
QStringList names;
|
||||
qWarning() << "A";
|
||||
const QMetaObject *info = metaObject();
|
||||
|
||||
for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) {
|
||||
const QMetaProperty metaProperty = info->property(i);
|
||||
const std::string colorName = metaProperty.name();
|
||||
names << QString::fromStdString(colorName);
|
||||
}
|
||||
return names.join(", ");
|
||||
}
|
||||
|
||||
QQmlPropertyMap * ColorListModel::getQmlData() {
|
||||
return &mData;
|
||||
}
|
||||
|
||||
const QQmlPropertyMap * ColorListModel::getQmlData() const{
|
||||
return &mData;
|
||||
}
|
||||
|
||||
void ColorListModel::overrideColors (const std::shared_ptr<linphone::Config> &config) {
|
||||
if (!config)
|
||||
return;
|
||||
for(auto color : mList){
|
||||
QString name = color->getName();
|
||||
const std::string colorValue = config->getString(ColorsSection, name.toStdString(), "");
|
||||
if(!colorValue.empty()){
|
||||
color->setColor(QColor(QString::fromStdString(colorValue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
/*
|
||||
std::shared_ptr<ColorModel> ColorListModel::getImdnState(const std::shared_ptr<const linphone::Color> & state){
|
||||
std::shared_ptr<ColorModel> imdn;
|
||||
auto imdnAddress = state->getParticipant()->getAddress();
|
||||
auto it = mList.begin();
|
||||
while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress))
|
||||
++it;
|
||||
if(it != mList.end())
|
||||
imdn = *it;
|
||||
else{// Create the new one
|
||||
imdn = std::make_shared<ColorModel>(state);
|
||||
add(imdn);
|
||||
}
|
||||
return imdn;
|
||||
}
|
||||
*/
|
||||
//--------------------------------------------------------------------------------
|
||||
139
linphone-app/src/components/other/colors/ColorListModel.hpp
Normal file
139
linphone-app/src/components/other/colors/ColorListModel.hpp
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef COLOR_LIST_MODEL_H_
|
||||
#define COLOR_LIST_MODEL_H_
|
||||
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QAbstractListModel>
|
||||
#include <memory>
|
||||
#include <QQmlPropertyMap>
|
||||
|
||||
#include "ColorModel.hpp"
|
||||
|
||||
#define ADD_COLOR(COLOR, VALUE, DESCRIPTION) \
|
||||
color = std::make_shared<ColorModel>(COLOR, VALUE, DESCRIPTION); \
|
||||
add(color);
|
||||
|
||||
// Alpha is in percent.
|
||||
#define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA, DESCRIPTION) \
|
||||
color = std::make_shared<ColorModel>(COLOR + QString::number(ALPHA), mData[COLOR].value<ColorModel*>()->getColor().name(), DESCRIPTION); \
|
||||
color->setAlpha(ALPHA * 255 / 100); \
|
||||
add(color);
|
||||
|
||||
|
||||
class ColorModel;
|
||||
|
||||
class ColorListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
void init() {
|
||||
std::shared_ptr<ColorModel> color;
|
||||
ADD_COLOR("a", "transparent", "Generic transparent color.")
|
||||
// Primary color for hovered items.
|
||||
ADD_COLOR("b", "#D64D00", "Primary color for hovered items.")
|
||||
|
||||
ADD_COLOR("c", "#CBCBCB", "Button pressed, separatos, fields.")
|
||||
ADD_COLOR("d", "#5A585B", "")
|
||||
ADD_COLOR("e", "#F3F3F3", "")
|
||||
ADD_COLOR("f", "#E8E8E8", "")
|
||||
ADD_COLOR("g", "#6B7A86", "SIP Address, Contact Text.")
|
||||
ADD_COLOR("h", "#687680", "")
|
||||
|
||||
// Primary color.
|
||||
ADD_COLOR("i", "#FE5E00", "Primary color.")
|
||||
|
||||
ADD_COLOR("j", "#4B5964", "Username, Background cancel button hovered.")
|
||||
|
||||
// Popups, home, call, assistant and settings background.
|
||||
ADD_COLOR("k", "#FFFFFF", "Popups, home, call, assistant and settings background.")
|
||||
|
||||
ADD_COLOR("l", "#000000", "Generic Black color")
|
||||
|
||||
// Primary color for clicked items.
|
||||
ADD_COLOR("m", "#FF8600", "Primary color for clicked items.")
|
||||
|
||||
ADD_COLOR("n", "#A1A1A1", "")
|
||||
ADD_COLOR("o", "#D0D8DE", "Disabled button")
|
||||
|
||||
ADD_COLOR("p", "#17A81A", "Progress bar.")
|
||||
|
||||
ADD_COLOR("q", "#FFFFFF", "Fields, backgrounds and text color on some items")
|
||||
|
||||
ADD_COLOR("r", "#909fab", "Background button normal.")
|
||||
|
||||
ADD_COLOR("s", "#96be64", "Security")
|
||||
|
||||
ADD_COLOR("t", "#C2C2C2", "Title Header")
|
||||
ADD_COLOR("u", "#D2D2D2", "Menu border (message)")
|
||||
ADD_COLOR("v", "#E7E7E7", "Menu pressed (message)")
|
||||
ADD_COLOR("w", "#EDEDED", "Menu background (conversation)")
|
||||
|
||||
// Field error.
|
||||
ADD_COLOR("error", "#FF0000", "Error Generic button.")
|
||||
|
||||
ADD_COLOR_WITH_ALPHA("g", 10, "")
|
||||
ADD_COLOR_WITH_ALPHA("g", 20, "")
|
||||
ADD_COLOR_WITH_ALPHA("g", 90, "")
|
||||
ADD_COLOR_WITH_ALPHA("i", 30, "")
|
||||
ADD_COLOR_WITH_ALPHA("l", 50, "")
|
||||
ADD_COLOR_WITH_ALPHA("l", 80, "")
|
||||
ADD_COLOR_WITH_ALPHA("q", 50, "")
|
||||
}
|
||||
public:
|
||||
|
||||
ColorListModel (QObject *parent = nullptr);
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const override;
|
||||
|
||||
virtual QHash<int, QByteArray> roleNames () const override;
|
||||
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void useConfig (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
Q_INVOKABLE QString getNames();
|
||||
|
||||
QQmlPropertyMap * getQmlData();
|
||||
const QQmlPropertyMap * getQmlData() const;
|
||||
|
||||
|
||||
signals:
|
||||
void colorChanged();
|
||||
|
||||
private:
|
||||
void add(std::shared_ptr<ColorModel> imdn);
|
||||
bool removeRow (int row, const QModelIndex &parent = QModelIndex());
|
||||
virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
QList<std::shared_ptr<ColorModel>> mList;
|
||||
|
||||
void overrideColors (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
QStringList getColorNames () const;
|
||||
|
||||
QQmlPropertyMap mData;
|
||||
|
||||
};
|
||||
#undef ADD_COLOR
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<ColorListModel>)
|
||||
|
||||
#endif
|
||||
70
linphone-app/src/components/other/colors/ColorModel.cpp
Normal file
70
linphone-app/src/components/other/colors/ColorModel.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ColorModel.hpp"
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include "app/App.hpp"
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ColorModel::ColorModel (const QString& name, const QColor& color, const QString& description, QObject * parent) : QObject(parent) {
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
|
||||
mName = name;
|
||||
setColor(color);
|
||||
setDescription(description) ;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString ColorModel::getName() const{
|
||||
return mName;
|
||||
}
|
||||
|
||||
QColor ColorModel::getColor() const{
|
||||
return mColor;
|
||||
}
|
||||
QString ColorModel::getDescription() const{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
|
||||
void ColorModel::setColor(const QColor& color){
|
||||
if(color != mColor){
|
||||
mColor = color;
|
||||
emit colorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ColorModel::setAlpha(const int& alpha){
|
||||
mColor.setAlpha(alpha);
|
||||
emit colorChanged();
|
||||
}
|
||||
|
||||
void ColorModel::setDescription(const QString& description){
|
||||
if(description != mDescription){
|
||||
mDescription = description;
|
||||
emit descriptionChanged();
|
||||
}
|
||||
}
|
||||
63
linphone-app/src/components/other/colors/ColorModel.hpp
Normal file
63
linphone-app/src/components/other/colors/ColorModel.hpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef COLOR_MODEL_H
|
||||
#define COLOR_MODEL_H
|
||||
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
|
||||
#include "utils/LinphoneEnums.hpp"
|
||||
|
||||
class ColorModel : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ColorModel (const QString& name, const QColor& color, const QString& description, QObject * parent = nullptr);
|
||||
|
||||
Q_PROPERTY(QColor color MEMBER mColor WRITE setColor NOTIFY colorChanged)
|
||||
Q_PROPERTY(QString description MEMBER mDescription WRITE setDescription NOTIFY descriptionChanged)
|
||||
Q_PROPERTY(QString name MEMBER mName CONSTANT)
|
||||
|
||||
QColor getColor() const;
|
||||
QString getDescription() const;
|
||||
QString getName() const;
|
||||
|
||||
|
||||
void setColor(const QColor& color);
|
||||
void setAlpha(const int& alpha);
|
||||
void setDescription(const QString& description);
|
||||
|
||||
signals:
|
||||
void colorChanged();
|
||||
void descriptionChanged();
|
||||
|
||||
private:
|
||||
QString mName;
|
||||
QColor mColor;
|
||||
QString mDescription;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<ColorModel>);
|
||||
|
||||
#endif
|
||||
54
linphone-app/src/components/other/colors/ColorProxyModel.cpp
Normal file
54
linphone-app/src/components/other/colors/ColorProxyModel.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ColorProxyModel.hpp"
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
#include "app/App.hpp"
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
#include "ColorListModel.hpp"
|
||||
#include "ColorModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ColorProxyModel::ColorProxyModel (QObject *parent) : QSortFilterProxyModel(parent){
|
||||
setSourceModel(App::getInstance()->getColorListModel());
|
||||
}
|
||||
|
||||
bool ColorProxyModel::filterAcceptsRow (
|
||||
int sourceRow,
|
||||
const QModelIndex &sourceParent
|
||||
) const {
|
||||
Q_UNUSED(sourceRow)
|
||||
Q_UNUSED(sourceParent)
|
||||
//const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
//const ParticipantDeviceModel *device = index.data().value<ParticipantDeviceModel *>();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
|
||||
const ColorModel *a = sourceModel()->data(left).value<ColorModel *>();
|
||||
const ColorModel *b = sourceModel()->data(right).value<ColorModel *>();
|
||||
|
||||
return a->getName() < b->getName() ;
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
|
|
@ -18,37 +18,31 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CHAT_MESSAGE_MODEL_H
|
||||
#define CHAT_MESSAGE_MODEL_H
|
||||
#ifndef COLOR_PROXY_MODEL_H_
|
||||
#define COLOR_PROXY_MODEL_H_
|
||||
|
||||
#include "utils/LinphoneEnums.hpp"
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class ColorListModel;
|
||||
class ChatMessageModel;
|
||||
|
||||
class ChatMessageModel : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
class ColorProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatMessageModel (std::shared_ptr<linphone::ChatMessage> chatMessage, QObject * parent = nullptr);
|
||||
|
||||
Q_PROPERTY(bool isEphemeral READ isEphemeral NOTIFY isEphemeralChanged)
|
||||
Q_PROPERTY(qint64 ephemeralExpireTime READ getEphemeralExpireTime NOTIFY ephemeralExpireTimeChanged)
|
||||
|
||||
std::shared_ptr<linphone::ChatMessage> getChatMessage();
|
||||
|
||||
bool isEphemeral() const;
|
||||
qint64 getEphemeralExpireTime() const;
|
||||
|
||||
signals:
|
||||
void isEphemeralChanged();
|
||||
void ephemeralExpireTimeChanged();
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<linphone::ChatMessage> mChatMessage;
|
||||
ColorProxyModel (QObject *parent = nullptr);
|
||||
|
||||
|
||||
protected:
|
||||
virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<ChatMessageModel>)
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QMetaProperty>
|
||||
|
||||
#if LINPHONE_FRIDAY
|
||||
#include <QDate>
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "Colors.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
constexpr char ColorsSection[] = "ui_colors";
|
||||
}
|
||||
|
||||
#if LINPHONE_FRIDAY
|
||||
static inline bool isLinphoneFriday () {
|
||||
return QDate::currentDate().dayOfWeek() == 5;
|
||||
}
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
|
||||
Colors::Colors (QObject *parent) : QObject(parent) {
|
||||
#if LINPHONE_FRIDAY
|
||||
if (isLinphoneFriday()) {
|
||||
setProperty("i", QColor("#F48D8D"));
|
||||
setProperty("b", QColor("#F58585"));
|
||||
setProperty("m", QColor("#FFC5C5"));
|
||||
}
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
}
|
||||
|
||||
void Colors::useConfig (const shared_ptr<linphone::Config> &config) {
|
||||
#if LINPHONE_FRIDAY
|
||||
if (!isLinphoneFriday())
|
||||
overrideColors(config);
|
||||
#else
|
||||
overrideColors(config);
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Colors::overrideColors (const shared_ptr<linphone::Config> &config) {
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
const QMetaObject *info = metaObject();
|
||||
|
||||
for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) {
|
||||
const QMetaProperty metaProperty = info->property(i);
|
||||
const string colorName = metaProperty.name();
|
||||
const string colorValue = config->getString(ColorsSection, colorName, "");
|
||||
|
||||
if (!colorValue.empty())
|
||||
setProperty(colorName.c_str(), QColor(Utils::coreStringToAppString(colorValue)));
|
||||
}
|
||||
}
|
||||
|
||||
QStringList Colors::getColorNames () const {
|
||||
static QStringList colorNames;
|
||||
if (!colorNames.isEmpty())
|
||||
return colorNames;
|
||||
|
||||
const QMetaObject *info = metaObject();
|
||||
for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) {
|
||||
const QMetaProperty metaProperty = info->property(i);
|
||||
if (metaProperty.isWritable())
|
||||
colorNames << QString::fromLatin1(metaProperty.name());
|
||||
}
|
||||
|
||||
return colorNames;
|
||||
}
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef COLORS_H_
|
||||
#define COLORS_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
#define ADD_COLOR(COLOR, VALUE) \
|
||||
Q_PROPERTY(QColor COLOR MEMBER m ## COLOR WRITE set ## COLOR NOTIFY colorT ## COLOR ## Changed); \
|
||||
void set ## COLOR(const QColor &color) { \
|
||||
m ## COLOR = color; \
|
||||
emit colorT ## COLOR ## Changed(m ## COLOR); \
|
||||
} \
|
||||
QColor m ## COLOR = VALUE;
|
||||
|
||||
// Alpha is in percent.
|
||||
#define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA) \
|
||||
Q_PROPERTY(QColor COLOR ## ALPHA READ get ## COLOR ## ALPHA NOTIFY colorT ## COLOR ## Changed); \
|
||||
QColor get ## COLOR ## ALPHA() { \
|
||||
QColor color = m ## COLOR; \
|
||||
color.setAlpha(ALPHA * 255 / 100); \
|
||||
return color; \
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace linphone {
|
||||
class Config;
|
||||
}
|
||||
|
||||
class Colors : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QStringList colorNames READ getColorNames CONSTANT)
|
||||
|
||||
ADD_COLOR(a, "transparent")
|
||||
|
||||
// Primary color for hovered items.
|
||||
ADD_COLOR(b, "#D64D00")
|
||||
|
||||
ADD_COLOR(c, "#CBCBCB") // Button pressed / separators / fields
|
||||
ADD_COLOR(d, "#5A585B")
|
||||
ADD_COLOR(e, "#F3F3F3")
|
||||
ADD_COLOR(f, "#E8E8E8")
|
||||
ADD_COLOR(g, "#6B7A86")// SipAddress / Contact Text
|
||||
ADD_COLOR(h, "#687680")
|
||||
|
||||
// Primary color.
|
||||
ADD_COLOR(i, "#FE5E00")
|
||||
|
||||
ADD_COLOR(j, "#4B5964")// Username, Background cancel button hovered
|
||||
|
||||
// Popups, home, call, assistant and settings background.
|
||||
ADD_COLOR(k, "#FFFFFF")
|
||||
|
||||
ADD_COLOR(l, "#000000")
|
||||
|
||||
// Primary color for clicked items.
|
||||
ADD_COLOR(m, "#FF8600")
|
||||
|
||||
ADD_COLOR(n, "#A1A1A1")
|
||||
ADD_COLOR(o, "#D0D8DE")// Disabled button
|
||||
|
||||
// Progress bar.
|
||||
ADD_COLOR(p, "#17A81A")
|
||||
|
||||
// Fields, backgrounds and text color on some items.
|
||||
ADD_COLOR(q, "#FFFFFF")
|
||||
|
||||
ADD_COLOR(r, "#909fab")//Background button normal
|
||||
|
||||
ADD_COLOR(s, "#96be64")// Security
|
||||
|
||||
ADD_COLOR(t, "#C2C2C2")// Title Header
|
||||
ADD_COLOR(u, "#D2D2D2")// Menu border (message)
|
||||
ADD_COLOR(v, "#E7E7E7")// Menu pressed (message)
|
||||
ADD_COLOR(w, "#EDEDED")// Menu background (conversation)
|
||||
|
||||
// Field error.
|
||||
ADD_COLOR(error, "#FF0000")
|
||||
|
||||
ADD_COLOR_WITH_ALPHA(g, 10)
|
||||
ADD_COLOR_WITH_ALPHA(g, 20)
|
||||
ADD_COLOR_WITH_ALPHA(g, 90)
|
||||
ADD_COLOR_WITH_ALPHA(i, 30)
|
||||
ADD_COLOR_WITH_ALPHA(l, 50)
|
||||
ADD_COLOR_WITH_ALPHA(l, 80)
|
||||
ADD_COLOR_WITH_ALPHA(q, 50)
|
||||
|
||||
public:
|
||||
Colors (QObject *parent = Q_NULLPTR);
|
||||
|
||||
void useConfig (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
signals:
|
||||
void colorTaChanged (const QColor &color);
|
||||
void colorTbChanged (const QColor &color);
|
||||
void colorTcChanged (const QColor &color);
|
||||
void colorTdChanged (const QColor &color);
|
||||
void colorTeChanged (const QColor &color);
|
||||
void colorTfChanged (const QColor &color);
|
||||
void colorTgChanged (const QColor &color);
|
||||
void colorThChanged (const QColor &color);
|
||||
void colorTiChanged (const QColor &color);
|
||||
void colorTjChanged (const QColor &color);
|
||||
void colorTkChanged (const QColor &color);
|
||||
void colorTlChanged (const QColor &color);
|
||||
void colorTmChanged (const QColor &color);
|
||||
void colorTnChanged (const QColor &color);
|
||||
void colorToChanged (const QColor &color);
|
||||
void colorTpChanged (const QColor &color);
|
||||
void colorTqChanged (const QColor &color);
|
||||
void colorTrChanged (const QColor &color);
|
||||
void colorTsChanged (const QColor &color);
|
||||
void colorTtChanged (const QColor &color);
|
||||
void colorTuChanged (const QColor &color);
|
||||
void colorTvChanged (const QColor &color);
|
||||
void colorTwChanged (const QColor &color);
|
||||
|
||||
void colorTerrorChanged (const QColor &color);
|
||||
|
||||
private:
|
||||
void overrideColors (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
QStringList getColorNames () const;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#undef ADD_COLOR_WITH_ALPHA
|
||||
#undef ADD_COLOR
|
||||
|
||||
#endif // COLORS_H_
|
||||
154
linphone-app/src/components/other/images/ImageListModel.cpp
Normal file
154
linphone-app/src/components/other/images/ImageListModel.cpp
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ImageListModel.hpp"
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QJsonValue>
|
||||
#include <QDir>
|
||||
#if LINPHONE_FRIDAY
|
||||
#include <QDate>
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
|
||||
|
||||
#include "app/App.hpp"
|
||||
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
#include "ImageModel.hpp"
|
||||
|
||||
namespace {
|
||||
constexpr char ImagesSection[] = "ui_images";
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ImageListModel::ImageListModel ( QObject *parent) : QAbstractListModel(parent), mData(this) {
|
||||
// Get all internals
|
||||
QString path = ":/assets/images/";
|
||||
QStringList filters;
|
||||
filters << "*.svg";
|
||||
|
||||
QFileInfoList files = QDir(path).entryInfoList(filters, QDir::Files , QDir::Name);
|
||||
for(QFileInfo file : files){
|
||||
std::shared_ptr<ImageModel> model = std::make_shared<ImageModel>(file.completeBaseName(), path+file.fileName(), "");
|
||||
add(model);
|
||||
}
|
||||
mData.insert("areReadOnlyImages", QVariant::fromValue(true));
|
||||
}
|
||||
|
||||
int ImageListModel::rowCount (const QModelIndex &index) const{
|
||||
return mList.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ImageListModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$image";
|
||||
return roles;
|
||||
}
|
||||
|
||||
QVariant ImageListModel::data (const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
if (!index.isValid() || row < 0 || row >= mList.count())
|
||||
return QVariant();
|
||||
return QVariant::fromValue(mList[row].get());
|
||||
}
|
||||
|
||||
void ImageListModel::add(std::shared_ptr<ImageModel> image){
|
||||
int row = mList.count();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
setProperty(image->getId().toStdString().c_str(), QVariant::fromValue(image.get()));
|
||||
|
||||
mData.insert(image->getId(), QVariant::fromValue(image.get()));
|
||||
mList << image;
|
||||
|
||||
endInsertRows();
|
||||
resetInternalData();
|
||||
}
|
||||
|
||||
bool ImageListModel::removeRow (int row, const QModelIndex &parent){
|
||||
return removeRows(row, 1, parent);
|
||||
}
|
||||
|
||||
bool ImageListModel::removeRows (int row, int count, const QModelIndex &parent) {
|
||||
int limit = row + count - 1;
|
||||
if (row < 0 || count < 0 || limit >= mList.count())
|
||||
return false;
|
||||
beginRemoveRows(parent, row, limit);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
mList.takeAt(row);
|
||||
|
||||
endRemoveRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImageListModel::useConfig (const std::shared_ptr<linphone::Config> &config) {
|
||||
#if LINPHONE_FRIDAY
|
||||
if (!isLinphoneFriday())
|
||||
overrideImages(config);
|
||||
#else
|
||||
overrideImages(config);
|
||||
#endif // if LINPHONE_FRIDAY
|
||||
}
|
||||
|
||||
QString ImageListModel::getIds(){
|
||||
QStringList ids;
|
||||
const QMetaObject *info = metaObject();
|
||||
|
||||
for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) {
|
||||
const QMetaProperty metaProperty = info->property(i);
|
||||
const std::string id = metaProperty.name();
|
||||
ids << QString::fromStdString(id);
|
||||
}
|
||||
return ids.join(", ");
|
||||
}
|
||||
|
||||
QQmlPropertyMap * ImageListModel::getQmlData() {
|
||||
return &mData;
|
||||
}
|
||||
|
||||
const QQmlPropertyMap * ImageListModel::getQmlData() const{
|
||||
return &mData;
|
||||
}
|
||||
|
||||
ImageModel * ImageListModel::getImageModel(const QString& id){
|
||||
for(auto image : mList)
|
||||
if(image->getId() == id)
|
||||
return image.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void ImageListModel::overrideImages (const std::shared_ptr<linphone::Config> &config) {
|
||||
if (!config)
|
||||
return;
|
||||
for(auto image : mList){
|
||||
QString id = image->getId();
|
||||
const std::string pathValue = config->getString(ImagesSection, id.toStdString(), "");
|
||||
if(!pathValue.empty()){
|
||||
image->setPath(QString::fromStdString(pathValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
73
linphone-app/src/components/other/images/ImageListModel.hpp
Normal file
73
linphone-app/src/components/other/images/ImageListModel.hpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_LIST_MODEL_H_
|
||||
#define IMAGE_LIST_MODEL_H_
|
||||
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QAbstractListModel>
|
||||
#include <memory>
|
||||
#include <QQmlPropertyMap>
|
||||
|
||||
#include "ImageModel.hpp"
|
||||
|
||||
class ImageModel;
|
||||
|
||||
class ImageListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
ImageListModel (QObject *parent = nullptr);
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const override;
|
||||
|
||||
virtual QHash<int, QByteArray> roleNames () const override;
|
||||
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void useConfig (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
Q_INVOKABLE QString getIds();
|
||||
|
||||
QQmlPropertyMap * getQmlData();
|
||||
const QQmlPropertyMap * getQmlData() const;
|
||||
|
||||
ImageModel * getImageModel(const QString& id);
|
||||
|
||||
private:
|
||||
void add(std::shared_ptr<ImageModel> imdn);
|
||||
bool removeRow (int row, const QModelIndex &parent = QModelIndex());
|
||||
virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
QList<std::shared_ptr<ImageModel>> mList;
|
||||
|
||||
void overrideImages (const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
QStringList getImagesIds () const;
|
||||
|
||||
QQmlPropertyMap mData;
|
||||
bool mAreReadOnlyImages = true;
|
||||
|
||||
};
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<ImageListModel>)
|
||||
|
||||
#endif
|
||||
75
linphone-app/src/components/other/images/ImageModel.cpp
Normal file
75
linphone-app/src/components/other/images/ImageModel.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ImageModel.hpp"
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include "app/App.hpp"
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ImageModel::ImageModel (const QString& id, const QString& path, const QString& description, QObject * parent) : QObject(parent) {
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
|
||||
mId = id;
|
||||
//setPath(path);
|
||||
mPath = path;
|
||||
setDescription(description) ;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString ImageModel::getId() const{
|
||||
return mId;
|
||||
}
|
||||
|
||||
QString ImageModel::getPath() const{
|
||||
return mPath;
|
||||
}
|
||||
QString ImageModel::getDescription() const{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
|
||||
void ImageModel::setPath(const QString& data){
|
||||
if(data != mPath){
|
||||
mPath = data;
|
||||
emit pathChanged();
|
||||
QString old = mId;
|
||||
mId="";// Force change
|
||||
emit idChanged();
|
||||
mId=old;
|
||||
emit idChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageModel::setDescription(const QString& data){
|
||||
if(data != mDescription){
|
||||
mDescription = data;
|
||||
emit descriptionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageModel::setUrl(const QUrl& url){
|
||||
setPath(url.toString(QUrl::RemoveScheme));
|
||||
}
|
||||
64
linphone-app/src/components/other/images/ImageModel.hpp
Normal file
64
linphone-app/src/components/other/images/ImageModel.hpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_MODEL_H
|
||||
#define IMAGE_MODEL_H
|
||||
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
|
||||
#include "utils/LinphoneEnums.hpp"
|
||||
|
||||
class ImageModel : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImageModel (const QString& id, const QString& path, const QString& description, QObject * parent = nullptr);
|
||||
|
||||
Q_PROPERTY(QString path MEMBER mPath WRITE setPath NOTIFY pathChanged)
|
||||
Q_PROPERTY(QString description MEMBER mDescription WRITE setDescription NOTIFY descriptionChanged)
|
||||
Q_PROPERTY(QString id MEMBER mId NOTIFY idChanged)
|
||||
|
||||
QString getPath() const;
|
||||
QString getDescription() const;
|
||||
QString getId() const;
|
||||
|
||||
|
||||
void setPath(const QString& path);
|
||||
void setDescription(const QString& description);
|
||||
Q_INVOKABLE void setUrl(const QUrl& url);
|
||||
|
||||
signals:
|
||||
void pathChanged();
|
||||
void descriptionChanged();
|
||||
void idChanged();
|
||||
|
||||
private:
|
||||
QString mId;
|
||||
QString mPath;
|
||||
QString mDescription;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<ImageModel>);
|
||||
|
||||
#endif
|
||||
54
linphone-app/src/components/other/images/ImageProxyModel.cpp
Normal file
54
linphone-app/src/components/other/images/ImageProxyModel.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ImageProxyModel.hpp"
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
#include "app/App.hpp"
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "components/Components.hpp"
|
||||
#include "ImageListModel.hpp"
|
||||
#include "ImageModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ImageProxyModel::ImageProxyModel (QObject *parent) : QSortFilterProxyModel(parent){
|
||||
setSourceModel(App::getInstance()->getImageListModel());
|
||||
}
|
||||
|
||||
bool ImageProxyModel::filterAcceptsRow (
|
||||
int sourceRow,
|
||||
const QModelIndex &sourceParent
|
||||
) const {
|
||||
Q_UNUSED(sourceRow)
|
||||
Q_UNUSED(sourceParent)
|
||||
//const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
//const ParticipantDeviceModel *device = index.data().value<ParticipantDeviceModel *>();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImageProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
|
||||
const ImageModel *a = sourceModel()->data(left).value<ImageModel *>();
|
||||
const ImageModel *b = sourceModel()->data(right).value<ImageModel *>();
|
||||
|
||||
return a->getId() < b->getId() ;
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
|
|
@ -18,26 +18,30 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#ifndef IMAGE_PROXY_MODEL_H_
|
||||
#define IMAGE_PROXY_MODEL_H_
|
||||
|
||||
#include "app/App.hpp"
|
||||
|
||||
#include "ChatMessageModel.hpp"
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
// =============================================================================
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
ChatMessageModel::ChatMessageModel ( std::shared_ptr<linphone::ChatMessage> chatMessage, QObject * parent) : QObject(parent) {
|
||||
mChatMessage = chatMessage;
|
||||
}
|
||||
class ImageListModel;
|
||||
|
||||
std::shared_ptr<linphone::ChatMessage> ChatMessageModel::getChatMessage(){
|
||||
return mChatMessage;
|
||||
}
|
||||
class ImageProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImageProxyModel (QObject *parent = nullptr);
|
||||
|
||||
|
||||
protected:
|
||||
virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
};
|
||||
|
||||
bool ChatMessageModel::isEphemeral() const{
|
||||
return mChatMessage->isEphemeral();
|
||||
}
|
||||
|
||||
qint64 ChatMessageModel::getEphemeralExpireTime() const{
|
||||
return mChatMessage->getEphemeralExpireTime();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -98,10 +98,14 @@ bool ParticipantImdnStateListModel::removeRows (int row, int count, const QModel
|
|||
|
||||
std::shared_ptr<ParticipantImdnStateModel> ParticipantImdnStateListModel::getImdnState(const std::shared_ptr<const linphone::ParticipantImdnState> & state){
|
||||
std::shared_ptr<ParticipantImdnStateModel> imdn;
|
||||
auto imdnAddress = state->getParticipant()->getAddress();
|
||||
auto participant = state->getParticipant();
|
||||
auto it = mList.begin();
|
||||
while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress))
|
||||
++it;
|
||||
if( participant){
|
||||
auto imdnAddress = state->getParticipant()->getAddress();
|
||||
while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress))
|
||||
++it;
|
||||
}else
|
||||
it = mList.end();
|
||||
if(it != mList.end())
|
||||
imdn = *it;
|
||||
else{// Create the new one
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ int ParticipantModel::getDeviceCount() const{
|
|||
}
|
||||
|
||||
bool ParticipantModel::getInviting() const{
|
||||
bool is = !mParticipant;
|
||||
return is;
|
||||
return !mParticipant;
|
||||
}
|
||||
|
||||
QString ParticipantModel::getSipAddress() const{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,10 @@ void ParticipantProxyModel::add(const QString& address){
|
|||
|
||||
void ParticipantProxyModel::remove(ParticipantModel * participant){
|
||||
if(participant) {
|
||||
if(mChatRoomModel && mChatRoomModel->getChatRoom() && participant->getParticipant() )
|
||||
if( !mChatRoomModel){
|
||||
ParticipantListModel * participantsModel = dynamic_cast<ParticipantListModel*>(sourceModel());
|
||||
participantsModel->remove(participant);
|
||||
}else if(mChatRoomModel->getChatRoom() && participant->getParticipant() )
|
||||
mChatRoomModel->getChatRoom()->removeParticipant(participant->getParticipant());
|
||||
//dynamic_cast<ParticipantListModel*>(sourceModel())->remove(participant);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,47 +36,47 @@
|
|||
using namespace std;
|
||||
|
||||
static inline AccountSettingsModel::RegistrationState mapLinphoneRegistrationStateToUi (linphone::RegistrationState state) {
|
||||
switch (state) {
|
||||
case linphone::RegistrationState::None:
|
||||
case linphone::RegistrationState::Cleared:
|
||||
case linphone::RegistrationState::Failed:
|
||||
return AccountSettingsModel::RegistrationStateNotRegistered;
|
||||
|
||||
case linphone::RegistrationState::Progress:
|
||||
return AccountSettingsModel::RegistrationStateInProgress;
|
||||
|
||||
case linphone::RegistrationState::Ok:
|
||||
break;
|
||||
}
|
||||
|
||||
return AccountSettingsModel::RegistrationStateRegistered;
|
||||
switch (state) {
|
||||
case linphone::RegistrationState::None:
|
||||
case linphone::RegistrationState::Cleared:
|
||||
case linphone::RegistrationState::Failed:
|
||||
return AccountSettingsModel::RegistrationStateNotRegistered;
|
||||
|
||||
case linphone::RegistrationState::Progress:
|
||||
return AccountSettingsModel::RegistrationStateInProgress;
|
||||
|
||||
case linphone::RegistrationState::Ok:
|
||||
break;
|
||||
}
|
||||
|
||||
return AccountSettingsModel::RegistrationStateRegistered;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) {
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
QObject::connect(
|
||||
coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged,
|
||||
this, &AccountSettingsModel::handleRegistrationStateChanged
|
||||
);
|
||||
QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
QObject::connect(
|
||||
coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged,
|
||||
this, &AccountSettingsModel::handleRegistrationStateChanged
|
||||
);
|
||||
QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<const linphone::Address> AccountSettingsModel::getUsedSipAddress () const {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = core->getDefaultProxyConfig();
|
||||
|
||||
return proxyConfig?proxyConfig->getIdentityAddress():core->createPrimaryContactParsed();
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = core->getDefaultProxyConfig();
|
||||
|
||||
return proxyConfig?proxyConfig->getIdentityAddress():core->createPrimaryContactParsed();
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setUsedSipAddress (const shared_ptr<const linphone::Address> &address) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = core->getDefaultProxyConfig();
|
||||
|
||||
proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString());
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = core->getDefaultProxyConfig();
|
||||
|
||||
proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString());
|
||||
}
|
||||
|
||||
QString AccountSettingsModel::getUsedSipAddressAsStringUriOnly () const {
|
||||
|
|
@ -89,250 +89,251 @@ QString AccountSettingsModel::getUsedSipAddressAsString () const {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool AccountSettingsModel::addOrUpdateProxyConfig (const shared_ptr<linphone::ProxyConfig> &proxyConfig) {
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
shared_ptr<linphone::Core> core = coreManager->getCore();
|
||||
|
||||
list<shared_ptr<linphone::ProxyConfig>> proxyConfigs = core->getProxyConfigList();
|
||||
if (find(proxyConfigs.cbegin(), proxyConfigs.cend(), proxyConfig) != proxyConfigs.cend()) {
|
||||
if (proxyConfig->done() == -1) {
|
||||
qWarning() << QStringLiteral("Unable to update proxy config: `%1`.")
|
||||
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
|
||||
return false;
|
||||
}
|
||||
coreManager->getSettingsModel()->configureRlsUri();
|
||||
} else {
|
||||
if (core->addProxyConfig(proxyConfig) == -1) {
|
||||
qWarning() << QStringLiteral("Unable to add proxy config: `%1`.")
|
||||
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
|
||||
return false;
|
||||
}
|
||||
coreManager->getSettingsModel()->configureRlsUri(proxyConfig);
|
||||
}
|
||||
emit accountSettingsUpdated();
|
||||
|
||||
return true;
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
shared_ptr<linphone::Core> core = coreManager->getCore();
|
||||
|
||||
list<shared_ptr<linphone::ProxyConfig>> proxyConfigs = core->getProxyConfigList();
|
||||
if (find(proxyConfigs.cbegin(), proxyConfigs.cend(), proxyConfig) != proxyConfigs.cend()) {
|
||||
if (proxyConfig->done() == -1) {
|
||||
qWarning() << QStringLiteral("Unable to update proxy config: `%1`.")
|
||||
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
|
||||
return false;
|
||||
}
|
||||
coreManager->getSettingsModel()->configureRlsUri();
|
||||
} else {
|
||||
if (core->addProxyConfig(proxyConfig) == -1) {
|
||||
qWarning() << QStringLiteral("Unable to add proxy config: `%1`.")
|
||||
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
|
||||
return false;
|
||||
}
|
||||
coreManager->getSettingsModel()->configureRlsUri(proxyConfig);
|
||||
}
|
||||
emit accountSettingsUpdated();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr<linphone::ProxyConfig> &proxyConfig) {
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
QVariantMap map;
|
||||
|
||||
{
|
||||
const shared_ptr<const linphone::Address> address = proxyConfig->getIdentityAddress();
|
||||
map["sipAddress"] = address
|
||||
? QString::fromStdString(proxyConfig->getIdentityAddress()->asString())
|
||||
: QString("");
|
||||
}
|
||||
map["serverAddress"] = Utils::coreStringToAppString(proxyConfig->getServerAddr());
|
||||
map["registrationDuration"] = proxyConfig->getPublishExpires();
|
||||
|
||||
if( map["serverAddress"].toString().toUpper().contains("TRANSPORT="))// transport has been specified : let the RFC select the transport
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
QVariantMap map;
|
||||
|
||||
{
|
||||
const shared_ptr<const linphone::Address> address = proxyConfig->getIdentityAddress();
|
||||
map["sipAddress"] = address
|
||||
? QString::fromStdString(proxyConfig->getIdentityAddress()->asString())
|
||||
: QString("");
|
||||
}
|
||||
map["serverAddress"] = Utils::coreStringToAppString(proxyConfig->getServerAddr());
|
||||
map["registrationDuration"] = proxyConfig->getPublishExpires();
|
||||
|
||||
if( map["serverAddress"].toString().toUpper().contains("TRANSPORT="))// transport has been specified : let the RFC select the transport
|
||||
map["transport"] = Utils::coreStringToAppString(proxyConfig->getTransport());
|
||||
else// Set to TLS as default
|
||||
map["transport"] = "tls";
|
||||
if( proxyConfig->getRoutes().size() > 0)
|
||||
map["route"] = Utils::coreStringToAppString(proxyConfig->getRoutes().front());
|
||||
else
|
||||
map["route"] = "";
|
||||
map["conferenceUri"] = Utils::coreStringToAppString(proxyConfig->getConferenceFactoryUri());
|
||||
map["contactParams"] = Utils::coreStringToAppString(proxyConfig->getContactParameters());
|
||||
map["avpfInterval"] = proxyConfig->getAvpfRrInterval();
|
||||
map["registerEnabled"] = proxyConfig->registerEnabled();
|
||||
map["publishPresence"] = proxyConfig->publishEnabled();
|
||||
map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::Enabled;
|
||||
map["registrationState"] = mapLinphoneRegistrationStateToUi(proxyConfig->getState());
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
bool createdNat = !natPolicy;
|
||||
if (createdNat)
|
||||
natPolicy = proxyConfig->getCore()->createNatPolicy();
|
||||
map["iceEnabled"] = natPolicy->iceEnabled();
|
||||
map["turnEnabled"] = natPolicy->turnEnabled();
|
||||
|
||||
const string &turnUser(natPolicy->getStunServerUsername());
|
||||
const string &stunServer(natPolicy->getStunServer());
|
||||
|
||||
map["turnUser"] = Utils::coreStringToAppString(turnUser);
|
||||
map["stunServer"] = Utils::coreStringToAppString(stunServer);
|
||||
|
||||
if (createdNat)
|
||||
proxyConfig->setNatPolicy(natPolicy);
|
||||
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = CoreManager::getInstance()->getCore()->findAuthInfo(
|
||||
"", turnUser, stunServer
|
||||
);
|
||||
map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString("");
|
||||
|
||||
return map;
|
||||
else// Set to TLS as default
|
||||
map["transport"] = "tls";
|
||||
if( proxyConfig->getRoutes().size() > 0)
|
||||
map["route"] = Utils::coreStringToAppString(proxyConfig->getRoutes().front());
|
||||
else
|
||||
map["route"] = "";
|
||||
map["conferenceUri"] = Utils::coreStringToAppString(proxyConfig->getConferenceFactoryUri());
|
||||
map["contactParams"] = Utils::coreStringToAppString(proxyConfig->getContactParameters());
|
||||
map["avpfInterval"] = proxyConfig->getAvpfRrInterval();
|
||||
map["registerEnabled"] = proxyConfig->registerEnabled();
|
||||
map["publishPresence"] = proxyConfig->publishEnabled();
|
||||
map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::Enabled;
|
||||
map["registrationState"] = mapLinphoneRegistrationStateToUi(proxyConfig->getState());
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
bool createdNat = !natPolicy;
|
||||
if (createdNat)
|
||||
natPolicy = proxyConfig->getCore()->createNatPolicy();
|
||||
map["iceEnabled"] = natPolicy->iceEnabled();
|
||||
map["turnEnabled"] = natPolicy->turnEnabled();
|
||||
|
||||
const string &turnUser(natPolicy->getStunServerUsername());
|
||||
const string &stunServer(natPolicy->getStunServer());
|
||||
|
||||
map["turnUser"] = Utils::coreStringToAppString(turnUser);
|
||||
map["stunServer"] = Utils::coreStringToAppString(stunServer);
|
||||
|
||||
if (createdNat)
|
||||
proxyConfig->setNatPolicy(natPolicy);
|
||||
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = CoreManager::getInstance()->getCore()->findAuthInfo(
|
||||
"", turnUser, stunServer
|
||||
);
|
||||
map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString("");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setDefaultProxyConfig (const shared_ptr<linphone::ProxyConfig> &proxyConfig) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
if (core->getDefaultProxyConfig() != proxyConfig) {
|
||||
core->setDefaultProxyConfig(proxyConfig);
|
||||
emit accountSettingsUpdated();
|
||||
emit defaultProxyChanged();
|
||||
}
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
if (core->getDefaultProxyConfig() != proxyConfig) {
|
||||
core->setDefaultProxyConfig(proxyConfig);
|
||||
emit accountSettingsUpdated();
|
||||
emit defaultProxyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setDefaultProxyConfigFromSipAddress (const QString &sipAddress) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
if (Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly()) == sipAddress) {
|
||||
setDefaultProxyConfig(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &proxyConfig : core->getProxyConfigList())
|
||||
if (Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly()) == sipAddress) {
|
||||
setDefaultProxyConfig(proxyConfig);
|
||||
return;
|
||||
}
|
||||
|
||||
qWarning() << "Unable to set default proxy config from:" << sipAddress;
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
auto address = Utils::interpretUrl(sipAddress);
|
||||
if ( core->createPrimaryContactParsed()->weakEqual(address)) {
|
||||
setDefaultProxyConfig(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &proxyConfig : core->getProxyConfigList())
|
||||
if (proxyConfig->getIdentityAddress()->weakEqual(address)) {
|
||||
setDefaultProxyConfig(proxyConfig);
|
||||
return;
|
||||
}
|
||||
|
||||
qWarning() << "Unable to set default proxy config from:" << sipAddress;
|
||||
}
|
||||
void AccountSettingsModel::removeProxyConfig (const shared_ptr<linphone::ProxyConfig> &proxyConfig) {
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
std::list<std::shared_ptr<linphone::ProxyConfig>> allProxies = coreManager->getCore()->getProxyConfigList();
|
||||
std::shared_ptr<const linphone::Address> proxyAddress = proxyConfig->getIdentityAddress();
|
||||
|
||||
coreManager->getCore()->removeProxyConfig(proxyConfig);// Remove first to avoid requesting password when deleting it
|
||||
if(proxyConfig->findAuthInfo())
|
||||
coreManager->getCore()->removeAuthInfo(proxyConfig->findAuthInfo());// Remove passwords
|
||||
|
||||
coreManager->getSettingsModel()->configureRlsUri();
|
||||
|
||||
emit accountSettingsUpdated();
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
std::list<std::shared_ptr<linphone::ProxyConfig>> allProxies = coreManager->getCore()->getProxyConfigList();
|
||||
std::shared_ptr<const linphone::Address> proxyAddress = proxyConfig->getIdentityAddress();
|
||||
|
||||
coreManager->getCore()->removeProxyConfig(proxyConfig);// Remove first to avoid requesting password when deleting it
|
||||
if(proxyConfig->findAuthInfo())
|
||||
coreManager->getCore()->removeAuthInfo(proxyConfig->findAuthInfo());// Remove passwords
|
||||
|
||||
coreManager->getSettingsModel()->configureRlsUri();
|
||||
|
||||
emit accountSettingsUpdated();
|
||||
}
|
||||
|
||||
bool AccountSettingsModel::addOrUpdateProxyConfig (
|
||||
const shared_ptr<linphone::ProxyConfig> &proxyConfig,
|
||||
const QVariantMap &data
|
||||
) {
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
bool newPublishPresence = false;
|
||||
|
||||
proxyConfig->edit();
|
||||
|
||||
QString literal = data["sipAddress"].toString();
|
||||
|
||||
// Sip address.
|
||||
{
|
||||
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(literal.toStdString());
|
||||
if (!address) {
|
||||
qWarning() << QStringLiteral("Unable to create sip address object from: `%1`.").arg(literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (proxyConfig->setIdentityAddress(address)) {
|
||||
qWarning() << QStringLiteral("Unable to set identity address: `%1`.")
|
||||
.arg(Utils::coreStringToAppString(address->asStringUriOnly()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Server address.
|
||||
{
|
||||
QString serverAddress = data["serverAddress"].toString();
|
||||
|
||||
if (proxyConfig->setServerAddr(Utils::appStringToCoreString(serverAddress))) {
|
||||
qWarning() << QStringLiteral("Unable to add server address: `%1`.").arg(serverAddress);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
proxyConfig->setPublishExpires(data["registrationDuration"].toInt());
|
||||
proxyConfig->setRoute(Utils::appStringToCoreString(data["route"].toString()));
|
||||
proxyConfig->setConferenceFactoryUri(Utils::appStringToCoreString(data["conferenceUri"].toString()));
|
||||
proxyConfig->setContactParameters(Utils::appStringToCoreString(data["contactParams"].toString()));
|
||||
proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt()));
|
||||
proxyConfig->enableRegister(data["registerEnabled"].toBool());
|
||||
newPublishPresence = proxyConfig->publishEnabled() != data["publishPresence"].toBool();
|
||||
proxyConfig->enablePublish(data["publishPresence"].toBool());
|
||||
proxyConfig->setAvpfMode(data["avpfEnabled"].toBool()
|
||||
? linphone::AVPFMode::Enabled
|
||||
: linphone::AVPFMode::Default
|
||||
);
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
bool createdNat = !natPolicy;
|
||||
if (createdNat)
|
||||
natPolicy = proxyConfig->getCore()->createNatPolicy();
|
||||
natPolicy->enableIce(data["iceEnabled"].toBool());
|
||||
natPolicy->enableStun(data["iceEnabled"].toBool());
|
||||
|
||||
const string turnUser(Utils::appStringToCoreString(data["turnUser"].toString()));
|
||||
const string stunServer(Utils::appStringToCoreString(data["stunServer"].toString()));
|
||||
|
||||
natPolicy->enableTurn(data["turnEnabled"].toBool());
|
||||
natPolicy->setStunServerUsername(turnUser);
|
||||
natPolicy->setStunServer(stunServer);
|
||||
|
||||
if( createdNat)
|
||||
proxyConfig->setNatPolicy(natPolicy);
|
||||
|
||||
shared_ptr<linphone::Core> core(proxyConfig->getCore());
|
||||
shared_ptr<const linphone::AuthInfo> authInfo(core->findAuthInfo("", turnUser, stunServer));
|
||||
if (authInfo) {
|
||||
shared_ptr<linphone::AuthInfo> clonedAuthInfo(authInfo->clone());
|
||||
clonedAuthInfo->setUserid(turnUser);
|
||||
clonedAuthInfo->setUsername(turnUser);
|
||||
clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString()));
|
||||
|
||||
core->addAuthInfo(clonedAuthInfo);
|
||||
core->removeAuthInfo(authInfo);
|
||||
} else
|
||||
core->addAuthInfo(linphone::Factory::get()->createAuthInfo(
|
||||
turnUser,
|
||||
turnUser,
|
||||
Utils::appStringToCoreString(data["turnPassword"].toString()),
|
||||
"",
|
||||
stunServer,
|
||||
""
|
||||
const shared_ptr<linphone::ProxyConfig> &proxyConfig,
|
||||
const QVariantMap &data
|
||||
) {
|
||||
Q_CHECK_PTR(proxyConfig);
|
||||
bool newPublishPresence = false;
|
||||
|
||||
proxyConfig->edit();
|
||||
|
||||
QString literal = data["sipAddress"].toString();
|
||||
|
||||
// Sip address.
|
||||
{
|
||||
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(literal.toStdString());
|
||||
if (!address) {
|
||||
qWarning() << QStringLiteral("Unable to create sip address object from: `%1`.").arg(literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (proxyConfig->setIdentityAddress(address)) {
|
||||
qWarning() << QStringLiteral("Unable to set identity address: `%1`.")
|
||||
.arg(Utils::coreStringToAppString(address->asStringUriOnly()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Server address.
|
||||
{
|
||||
QString serverAddress = data["serverAddress"].toString();
|
||||
|
||||
if (proxyConfig->setServerAddr(Utils::appStringToCoreString(serverAddress))) {
|
||||
qWarning() << QStringLiteral("Unable to add server address: `%1`.").arg(serverAddress);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
proxyConfig->setPublishExpires(data["registrationDuration"].toInt());
|
||||
proxyConfig->setRoute(Utils::appStringToCoreString(data["route"].toString()));
|
||||
proxyConfig->setConferenceFactoryUri(Utils::appStringToCoreString(data["conferenceUri"].toString()));
|
||||
proxyConfig->setContactParameters(Utils::appStringToCoreString(data["contactParams"].toString()));
|
||||
proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt()));
|
||||
proxyConfig->enableRegister(data["registerEnabled"].toBool());
|
||||
newPublishPresence = proxyConfig->publishEnabled() != data["publishPresence"].toBool();
|
||||
proxyConfig->enablePublish(data["publishPresence"].toBool());
|
||||
proxyConfig->setAvpfMode(data["avpfEnabled"].toBool()
|
||||
? linphone::AVPFMode::Enabled
|
||||
: linphone::AVPFMode::Default
|
||||
);
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
bool createdNat = !natPolicy;
|
||||
if (createdNat)
|
||||
natPolicy = proxyConfig->getCore()->createNatPolicy();
|
||||
natPolicy->enableIce(data["iceEnabled"].toBool());
|
||||
natPolicy->enableStun(data["iceEnabled"].toBool());
|
||||
|
||||
const string turnUser(Utils::appStringToCoreString(data["turnUser"].toString()));
|
||||
const string stunServer(Utils::appStringToCoreString(data["stunServer"].toString()));
|
||||
|
||||
natPolicy->enableTurn(data["turnEnabled"].toBool());
|
||||
natPolicy->setStunServerUsername(turnUser);
|
||||
natPolicy->setStunServer(stunServer);
|
||||
|
||||
if( createdNat)
|
||||
proxyConfig->setNatPolicy(natPolicy);
|
||||
|
||||
shared_ptr<linphone::Core> core(proxyConfig->getCore());
|
||||
shared_ptr<const linphone::AuthInfo> authInfo(core->findAuthInfo("", turnUser, stunServer));
|
||||
if (authInfo) {
|
||||
shared_ptr<linphone::AuthInfo> clonedAuthInfo(authInfo->clone());
|
||||
clonedAuthInfo->setUserid(turnUser);
|
||||
clonedAuthInfo->setUsername(turnUser);
|
||||
clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString()));
|
||||
|
||||
core->addAuthInfo(clonedAuthInfo);
|
||||
core->removeAuthInfo(authInfo);
|
||||
} else
|
||||
core->addAuthInfo(linphone::Factory::get()->createAuthInfo(
|
||||
turnUser,
|
||||
turnUser,
|
||||
Utils::appStringToCoreString(data["turnPassword"].toString()),
|
||||
"",
|
||||
stunServer,
|
||||
""
|
||||
));
|
||||
if( newPublishPresence)
|
||||
emit publishPresenceChanged();
|
||||
return addOrUpdateProxyConfig(proxyConfig);
|
||||
if( newPublishPresence)
|
||||
emit publishPresenceChanged();
|
||||
return addOrUpdateProxyConfig(proxyConfig);
|
||||
}
|
||||
|
||||
shared_ptr<linphone::ProxyConfig> AccountSettingsModel::createProxyConfig () {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
core->getConfig()->loadFromXmlFile(
|
||||
Paths::getAssistantConfigDirPath() + "create-app-sip-account.rc"
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
core->getConfig()->loadFromXmlFile(
|
||||
Paths::getAssistantConfigDirPath() + "create-app-sip-account.rc"
|
||||
);
|
||||
|
||||
return core->createProxyConfig();
|
||||
|
||||
return core->createProxyConfig();
|
||||
}
|
||||
|
||||
void AccountSettingsModel::addAuthInfo (
|
||||
const shared_ptr<linphone::AuthInfo> &authInfo,
|
||||
const QString &password,
|
||||
const QString &userId
|
||||
) {
|
||||
authInfo->setPassword(Utils::appStringToCoreString(password));
|
||||
authInfo->setUserid(Utils::appStringToCoreString(userId));
|
||||
|
||||
CoreManager::getInstance()->getCore()->addAuthInfo(authInfo);
|
||||
const shared_ptr<linphone::AuthInfo> &authInfo,
|
||||
const QString &password,
|
||||
const QString &userId
|
||||
) {
|
||||
authInfo->setPassword(Utils::appStringToCoreString(password));
|
||||
authInfo->setUserid(Utils::appStringToCoreString(userId));
|
||||
|
||||
CoreManager::getInstance()->getCore()->addAuthInfo(authInfo);
|
||||
}
|
||||
|
||||
void AccountSettingsModel::eraseAllPasswords () {
|
||||
CoreManager::getInstance()->getCore()->clearAllAuthInfo();
|
||||
CoreManager::getInstance()->getCore()->clearAllAuthInfo();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AccountSettingsModel::getUsername () const {
|
||||
shared_ptr<const linphone::Address> address = getUsedSipAddress();
|
||||
const string displayName = address->getDisplayName();
|
||||
|
||||
return QString::fromStdString(
|
||||
displayName.empty() ? address->getUsername() : displayName
|
||||
);
|
||||
shared_ptr<const linphone::Address> address = getUsedSipAddress();
|
||||
const string displayName = address->getDisplayName();
|
||||
|
||||
return QString::fromStdString(
|
||||
displayName.empty() ? address->getUsername() : displayName
|
||||
);
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setUsername (const QString &username) {
|
||||
|
|
@ -342,7 +343,7 @@ void AccountSettingsModel::setUsername (const QString &username) {
|
|||
if( oldUsername != username) {
|
||||
if (newAddress->setDisplayName(username.toStdString())) {
|
||||
qWarning() << QStringLiteral("Unable to set displayName on sip address: `%1`.")
|
||||
.arg(Utils::coreStringToAppString(newAddress->asStringUriOnly()));
|
||||
.arg(Utils::coreStringToAppString(newAddress->asStringUriOnly()));
|
||||
} else {
|
||||
setUsedSipAddress(newAddress);
|
||||
emit accountSettingsUpdated();
|
||||
|
|
@ -351,40 +352,40 @@ void AccountSettingsModel::setUsername (const QString &username) {
|
|||
}
|
||||
|
||||
AccountSettingsModel::RegistrationState AccountSettingsModel::getRegistrationState () const {
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = CoreManager::getInstance()->getCore()->getDefaultProxyConfig();
|
||||
return proxyConfig ? mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNoProxy;
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = CoreManager::getInstance()->getCore()->getDefaultProxyConfig();
|
||||
return proxyConfig ? mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNoProxy;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AccountSettingsModel::getPrimaryUsername () const {
|
||||
return QString::fromStdString(
|
||||
CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getUsername()
|
||||
);
|
||||
return QString::fromStdString(
|
||||
CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getUsername()
|
||||
);
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setPrimaryUsername (const QString &username) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::Address> primary = core->createPrimaryContactParsed();
|
||||
|
||||
|
||||
QString oldUsername = Utils::coreStringToAppString(primary->getUsername());
|
||||
if(oldUsername != username){
|
||||
primary->setUsername(Utils::appStringToCoreString(
|
||||
username.isEmpty() ? APPLICATION_NAME : username
|
||||
));
|
||||
username.isEmpty() ? APPLICATION_NAME : username
|
||||
));
|
||||
core->setPrimaryContact(primary->asString());
|
||||
emit accountSettingsUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
QString AccountSettingsModel::getPrimaryDisplayName () const {
|
||||
return QString::fromStdString(CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getDisplayName());
|
||||
return QString::fromStdString(CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getDisplayName());
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::Address> primary = core->createPrimaryContactParsed();
|
||||
|
||||
|
||||
QString oldDisplayName = Utils::coreStringToAppString(primary->getDisplayName());
|
||||
if(oldDisplayName != displayName){
|
||||
primary->setDisplayName(displayName.toStdString());
|
||||
|
|
@ -394,47 +395,51 @@ void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) {
|
|||
}
|
||||
|
||||
QString AccountSettingsModel::getPrimarySipAddress () const {
|
||||
return QString::fromStdString(
|
||||
CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->asString()
|
||||
);
|
||||
return QString::fromStdString(
|
||||
CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->asString()
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QVariantList AccountSettingsModel::getAccounts () const {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
QVariantList accounts;
|
||||
|
||||
if(CoreManager::getInstance()->getSettingsModel()->getShowLocalSipAccount()) {
|
||||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly());
|
||||
account["fullSipAddress"] = QString::fromStdString(core->createPrimaryContactParsed()->asString());
|
||||
account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->createPrimaryContactParsed());
|
||||
account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString());
|
||||
account["proxyConfig"].setValue(nullptr);
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
for (const auto &proxyConfig : core->getProxyConfigList()) {
|
||||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly());
|
||||
account["fullSipAddress"] = QString::fromStdString(proxyConfig->getIdentityAddress()->asString());
|
||||
account["proxyConfig"].setValue(proxyConfig);
|
||||
account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount();
|
||||
account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString());
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
return accounts;
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
QVariantList accounts;
|
||||
|
||||
if(CoreManager::getInstance()->getSettingsModel()->getShowLocalSipAccount()) {
|
||||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly());
|
||||
account["fullSipAddress"] = QString::fromStdString(core->createPrimaryContactParsed()->asString());
|
||||
account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->createPrimaryContactParsed());
|
||||
account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString());
|
||||
account["proxyConfig"].setValue(nullptr);
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
for (const auto &proxyConfig : core->getProxyConfigList()) {
|
||||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly());
|
||||
account["fullSipAddress"] = QString::fromStdString(proxyConfig->getIdentityAddress()->asString());
|
||||
account["proxyConfig"].setValue(proxyConfig);
|
||||
account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount();
|
||||
account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString());
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void AccountSettingsModel::handleRegistrationStateChanged (
|
||||
const shared_ptr<linphone::ProxyConfig> & proxy,
|
||||
linphone::RegistrationState core
|
||||
) {
|
||||
Q_UNUSED(proxy)
|
||||
Q_UNUSED(core)
|
||||
emit accountSettingsUpdated();
|
||||
const shared_ptr<linphone::ProxyConfig> & proxy,
|
||||
linphone::RegistrationState state
|
||||
) {
|
||||
Q_UNUSED(proxy)
|
||||
Q_UNUSED(state)
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::ProxyConfig> defaultProxyConfig = core->getDefaultProxyConfig();
|
||||
if(defaultProxyConfig == proxy)
|
||||
emit defaultRegistrationChanged();
|
||||
emit accountSettingsUpdated();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ signals:
|
|||
void accountSettingsUpdated ();
|
||||
void defaultProxyChanged();
|
||||
void publishPresenceChanged();
|
||||
void defaultRegistrationChanged();
|
||||
|
||||
private:
|
||||
QString getUsername () const;
|
||||
|
|
|
|||
|
|
@ -614,6 +614,17 @@ void SettingsModel::setChatEnabled (bool status) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SettingsModel::getHideEmptyChatRooms() const{
|
||||
return !!mConfig->getInt("misc", "hide_empty_chat_rooms", 1);
|
||||
}
|
||||
|
||||
void SettingsModel::setHideEmptyChatRooms(const bool& status){
|
||||
mConfig->setInt("misc", "hide_empty_chat_rooms", status);
|
||||
emit hideEmptyChatRoomsChanged(status);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SettingsModel::getConferenceEnabled () const {
|
||||
return !!mConfig->getInt(UiSection, "conference_enabled", 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ class SettingsModel : public QObject {
|
|||
Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged)
|
||||
|
||||
Q_PROPERTY(bool chatEnabled READ getChatEnabled WRITE setChatEnabled NOTIFY chatEnabledChanged)
|
||||
Q_PROPERTY(bool hideEmptyChatRooms READ getHideEmptyChatRooms WRITE setHideEmptyChatRooms NOTIFY hideEmptyChatRoomsChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(bool conferenceEnabled READ getConferenceEnabled WRITE setConferenceEnabled NOTIFY conferenceEnabledChanged)
|
||||
|
||||
|
|
@ -320,6 +322,9 @@ public:
|
|||
|
||||
bool getChatEnabled () const;
|
||||
void setChatEnabled (bool status);
|
||||
|
||||
bool getHideEmptyChatRooms() const;
|
||||
void setHideEmptyChatRooms(const bool& data);
|
||||
|
||||
bool getConferenceEnabled () const;
|
||||
void setConferenceEnabled (bool status);
|
||||
|
|
@ -536,6 +541,7 @@ signals:
|
|||
void muteMicrophoneEnabledChanged (bool status);
|
||||
|
||||
void chatEnabledChanged (bool status);
|
||||
void hideEmptyChatRoomsChanged (bool status);
|
||||
|
||||
void conferenceEnabledChanged (bool status);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/core/CoreHandlers.hpp"
|
||||
#include "components/settings/AccountSettingsModel.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
#include "components/sip-addresses/SipAddressesModel.hpp"
|
||||
#include "components/contacts/ContactsListModel.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
|
@ -43,6 +44,8 @@ TimelineListModel::TimelineListModel (QObject *parent) : QAbstractListModel(pare
|
|||
connect(coreHandlers, &CoreHandlers::messageReceived, this, &TimelineListModel::update);
|
||||
connect(coreHandlers, &CoreHandlers::messageReceived, this, &TimelineListModel::updated);
|
||||
|
||||
connect(CoreManager::getInstance()->getSettingsModel(), &SettingsModel::hideEmptyChatRoomsChanged, this, &TimelineListModel::update);
|
||||
connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultRegistrationChanged, this, &TimelineListModel::update);
|
||||
updateTimelines ();
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +156,7 @@ QVariantList TimelineListModel::getLastChatRooms(const int& maxCount) const{
|
|||
|
||||
for(auto timeline : mTimelines){
|
||||
auto chatRoom = timeline->getChatRoomModel();
|
||||
if(chatRoom && !chatRoom->isGroupEnabled() && !chatRoom->haveEncryption()) {
|
||||
if(chatRoom && chatRoom->isCurrentProxy() && !chatRoom->isGroupEnabled() && !chatRoom->haveEncryption()) {
|
||||
sortedData.insert(chatRoom->mLastUpdateTime.secsTo(currentDateTime),chatRoom);
|
||||
}
|
||||
}
|
||||
|
|
@ -223,6 +226,7 @@ void TimelineListModel::selectedHasChanged(bool selected){
|
|||
void TimelineListModel::updateTimelines () {
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
std::list<std::shared_ptr<linphone::ChatRoom>> allChatRooms = coreManager->getCore()->getChatRooms();
|
||||
|
||||
|
||||
//Remove no more chat rooms
|
||||
auto itTimeline = mTimelines.begin();
|
||||
|
|
@ -287,7 +291,7 @@ void TimelineListModel::remove(std::shared_ptr<TimelineModel> model){
|
|||
}
|
||||
}
|
||||
void TimelineListModel::removeChatRoomModel(std::shared_ptr<ChatRoomModel> model){
|
||||
if(model->getChatRoom()->isEmpty() && model->hasBeenLeft()){
|
||||
if(model->getChatRoom()->isEmpty() && (model->hasBeenLeft() || !model->isGroupEnabled())){
|
||||
auto itTimeline = mTimelines.begin();
|
||||
while(itTimeline != mTimelines.end()) {
|
||||
if((*itTimeline)->mChatRoomModel == model){
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ TimelineModel::TimelineModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObj
|
|||
if( mChatRoomModel ){
|
||||
QObject::connect(mChatRoomModel.get(), &ChatRoomModel::unreadMessagesCountChanged, this, &TimelineModel::updateUnreadCount);
|
||||
QObject::connect(mChatRoomModel.get(), &ChatRoomModel::missedCallsCountChanged, this, &TimelineModel::updateUnreadCount);
|
||||
QObject::connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultProxyChanged, this, &TimelineModel::onDefaultProxyChanged);
|
||||
}
|
||||
|
||||
//QObject::connect(mChatRoomModel.get(), &ChatRoomModel::conferenceLeft, this, &TimelineModel::onConferenceLeft);
|
||||
|
|
@ -62,7 +63,6 @@ TimelineModel::TimelineModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObj
|
|||
|
||||
TimelineModel::~TimelineModel(){
|
||||
mChatRoomModel->getChatRoom()->removeListener(mChatRoomModel);
|
||||
qWarning() << "Destroying Timeline";
|
||||
}
|
||||
|
||||
QString TimelineModel::getFullPeerAddress() const{
|
||||
|
|
@ -103,6 +103,10 @@ void TimelineModel::updateUnreadCount(){
|
|||
mChatRoomModel->resetMessageCount();
|
||||
}
|
||||
}
|
||||
void TimelineModel::onDefaultProxyChanged(){
|
||||
if( mSelected && !mChatRoomModel->isCurrentProxy())
|
||||
setSelected(false);
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
//------ CHAT ROOM HANDLERS
|
||||
//----------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void updateUnreadCount();
|
||||
void onDefaultProxyChanged();
|
||||
//void chatRoomDeleted();
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sou
|
|||
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
auto timeline = sourceModel()->data(index).value<TimelineModel*>();
|
||||
bool show = (mFilterFlags==0);// Show all at 0 (no hide all)
|
||||
auto currentAddress = Utils::interpretUrl(CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddressAsStringUriOnly());
|
||||
|
||||
if( !show && ( (mFilterFlags & TimelineFilter::SimpleChatRoom) == TimelineFilter::SimpleChatRoom))
|
||||
show = !timeline->getChatRoomModel()->isGroupEnabled() && !timeline->getChatRoomModel()->haveEncryption();
|
||||
if( !show && ( (mFilterFlags & TimelineFilter::SecureChatRoom) == TimelineFilter::SecureChatRoom))
|
||||
|
|
@ -119,6 +121,8 @@ bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sou
|
|||
|| timeline->getChatRoomModel()->getUsername().contains(search);
|
||||
//|| timeline->getChatRoomModel()->getFullPeerAddress().contains(search); not enough significant?
|
||||
}
|
||||
if(show)
|
||||
show = timeline->getChatRoomModel()->isCurrentProxy();
|
||||
return show;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color a: '#000000'
|
||||
property color b: '#000000'
|
||||
property color c: '#000000'
|
||||
property color d: '#000000'
|
||||
property color e: '#000000'
|
||||
property color f: '#000000'
|
||||
property color g: '#000000'
|
||||
property color g10: '#000000'
|
||||
property color g20: '#000000'
|
||||
property color g90: '#000000'
|
||||
property color h: '#000000'
|
||||
property color i: '#000000'
|
||||
property color i30: '#000000'
|
||||
property color j: '#000000'
|
||||
property color j75: '#000000'
|
||||
property color k: '#000000'
|
||||
property color l: '#000000'
|
||||
property color l50: '#000000'
|
||||
property color l80: '#000000'
|
||||
property color m: '#000000'
|
||||
property color n: '#000000'
|
||||
property color o: '#000000'
|
||||
property color p: '#000000'
|
||||
property color q: '#000000'
|
||||
property color r: '#000000'
|
||||
property color s: '#000000'
|
||||
property color t: '#000000'
|
||||
property color u: '#000000'
|
||||
property color v: '#000000'
|
||||
property color w: '#000000'
|
||||
property color x: '#000000'
|
||||
property color y: '#000000'
|
||||
property color z: '#000000'
|
||||
|
||||
property color error: '#000000'
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# ==============================================================================
|
||||
# Colors component to export.
|
||||
# ==============================================================================
|
||||
|
||||
module Colors
|
||||
|
||||
singleton Colors 1.0 Colors.qml
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property real dp: 1.0
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# ==============================================================================
|
||||
# Tools component to export.
|
||||
# ==============================================================================
|
||||
|
||||
module Tools
|
||||
|
||||
singleton Tools 1.0 Tools.qml
|
||||
|
|
@ -33,6 +33,8 @@ Item {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
function _getIcon () {
|
||||
if(wrappedButton.icon == '')
|
||||
return wrappedButton.icon;
|
||||
if (wrappedButton.updating) {
|
||||
return wrappedButton.icon + '_updating'
|
||||
}
|
||||
|
|
@ -74,7 +76,7 @@ Item {
|
|||
id: icon
|
||||
|
||||
anchors.centerIn: parent
|
||||
icon: _getIcon()
|
||||
icon: Images[_getIcon()].id
|
||||
iconSize: wrappedButton.iconSize || (
|
||||
parent.width > parent.height ? parent.height : parent.width
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ AbstractTextButton {
|
|||
textColorNormal: textButtonStyle.textColor.normal
|
||||
textColorPressed: textButtonStyle.textColor.pressed
|
||||
|
||||
borderColorDisabled: textButtonStyle.borderColor.disabled
|
||||
borderColorHovered: textButtonStyle.borderColor.hovered
|
||||
borderColorNormal: textButtonStyle.borderColor.normal
|
||||
borderColorPressed: textButtonStyle.borderColor.pressed
|
||||
borderColorDisabled: (textButtonStyle.borderColor?textButtonStyle.borderColor.disabled:colorDisabled)
|
||||
borderColorHovered: (textButtonStyle.borderColor?textButtonStyle.borderColor.hovered:colorHovered)
|
||||
borderColorNormal: (textButtonStyle.borderColor?textButtonStyle.borderColor.normal:colorNormal)
|
||||
borderColorPressed: (textButtonStyle.borderColor?textButtonStyle.borderColor.pressed:colorPressed)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ Item {
|
|||
width: iconSize
|
||||
|
||||
Image {
|
||||
id:image
|
||||
mipmap: Qt.platform.os === 'osx'
|
||||
cache: Images.areReadOnlyImages
|
||||
function getIconSize () {
|
||||
Utils.assert(
|
||||
(icon == null || icon == '' || iconSize != null && iconSize >= 0),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int duration: 1250
|
||||
property int nSpheres: 6
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.k
|
||||
property color color: Colors.k.color
|
||||
|
||||
property QtObject buttons: QtObject {
|
||||
property int bottomMargin: 30
|
||||
|
|
@ -28,7 +27,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject description: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int leftMargin: 50
|
||||
property int pointSize: Units.dp * 11
|
||||
property int rightMargin: 50
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -10,10 +9,10 @@ QtObject {
|
|||
|
||||
property QtObject button: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.n
|
||||
property color normal: Colors.c
|
||||
property color pressed: Colors.i
|
||||
property color selected: Colors.g
|
||||
property color hovered: Colors.n.color
|
||||
property color normal: Colors.c.color
|
||||
property color pressed: Colors.i.color
|
||||
property color selected: Colors.g.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
|
|
@ -13,9 +11,9 @@ QtObject {
|
|||
property int iconSize: 16
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.c
|
||||
property color normal: Colors.f
|
||||
property color pressed: Colors.c
|
||||
property color hovered: Colors.c.color
|
||||
property color normal: Colors.f.color
|
||||
property color pressed: Colors.c.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -15,14 +14,14 @@ QtObject {
|
|||
property int radius: 10
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.c
|
||||
property color normal: Colors.f
|
||||
property color pressed: Colors.i
|
||||
property color hovered: Colors.c.color
|
||||
property color normal: Colors.f.color
|
||||
property color pressed: Colors.i.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int pointSize: Units.dp * 8
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject backgroundColor: QtObject {
|
||||
property color disabled: Colors.o
|
||||
property color hovered: Colors.j
|
||||
property color normal: Colors.r
|
||||
property color pressed: Colors.i
|
||||
property color disabled: Colors.o.color
|
||||
property color hovered: Colors.j.color
|
||||
property color normal: Colors.r.color
|
||||
property color pressed: Colors.i.color
|
||||
}
|
||||
|
||||
property QtObject textColor: QtObject {
|
||||
property color disabled: Colors.q
|
||||
property color hovered: Colors.q
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.q
|
||||
property color disabled: Colors.q.color
|
||||
property color hovered: Colors.q.color
|
||||
property color normal: Colors.q.color
|
||||
property color pressed: Colors.q.color
|
||||
}
|
||||
property QtObject borderColor : backgroundColor
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,23 +2,21 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject backgroundColor: QtObject {
|
||||
property color disabled: Colors.i30
|
||||
property color hovered: Colors.b
|
||||
property color normal: Colors.i
|
||||
property color pressed: Colors.m
|
||||
property color disabled: Colors.i30.color
|
||||
property color hovered: Colors.b.color
|
||||
property color normal: Colors.i.color
|
||||
property color pressed: Colors.m.color
|
||||
}
|
||||
|
||||
property QtObject textColor: QtObject {
|
||||
property color disabled: Colors.q
|
||||
property color hovered: Colors.q
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.q
|
||||
property color disabled: Colors.q.color
|
||||
property color hovered: Colors.q.color
|
||||
property color normal: Colors.q.color
|
||||
property color pressed: Colors.q.color
|
||||
}
|
||||
property QtObject borderColor : backgroundColor
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -12,8 +11,8 @@ QtObject {
|
|||
property int size: 18
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color pressed: Colors.i
|
||||
property color hovered: Colors.h
|
||||
property color normal: Colors.g
|
||||
property color pressed: Colors.i.color
|
||||
property color hovered: Colors.h.color
|
||||
property color normal: Colors.g.color
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,13 +13,13 @@ QtObject {
|
|||
property int width: 200
|
||||
|
||||
property QtObject border: QtObject {
|
||||
property color color: Colors.c
|
||||
property color color: Colors.c.color
|
||||
property int width: 1
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.q
|
||||
property color readOnly: Colors.e
|
||||
property color normal: Colors.q.color
|
||||
property color readOnly: Colors.e.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ QtObject {
|
|||
property int spacing: 5
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.o
|
||||
property color normal: Colors.q
|
||||
property color hovered: Colors.o.color
|
||||
property color normal: Colors.q.color
|
||||
}
|
||||
|
||||
property QtObject contentItem: QtObject {
|
||||
|
|
@ -17,18 +16,18 @@ QtObject {
|
|||
property int spacing: 5
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject indicator: QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int width: 5
|
||||
}
|
||||
|
||||
property QtObject separator: QtObject {
|
||||
property color color: Colors.c
|
||||
property color color: Colors.c.color
|
||||
property int height: 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color backgroundColor: Colors.q
|
||||
property color backgroundColor: Colors.q.color
|
||||
|
||||
property QtObject fileChooserButton: QtObject {
|
||||
property int margins: 6
|
||||
|
|
@ -15,16 +14,16 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject hoverContent: QtObject {
|
||||
property color backgroundColor: Colors.q
|
||||
property color backgroundColor: Colors.q.color
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int pointSize: Units.dp * 11
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -12,12 +11,12 @@ QtObject {
|
|||
|
||||
property QtObject button: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.f
|
||||
property color pressed: Colors.c
|
||||
property color normal: Colors.f.color
|
||||
property color pressed: Colors.c.color
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 9
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,18 +13,18 @@ QtObject {
|
|||
property int radius: 4
|
||||
|
||||
property QtObject border: QtObject {
|
||||
property color color: Colors.c
|
||||
property color color: Colors.c.color
|
||||
property int width: 1
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.q
|
||||
property color readOnly: Colors.e
|
||||
property color normal: Colors.q.color
|
||||
property color readOnly: Colors.e.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int padding: 8
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -15,22 +14,22 @@ QtObject {
|
|||
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color error: Colors.error
|
||||
property color normal: Colors.c
|
||||
property color selected: Colors.i
|
||||
property color error: Colors.error.color
|
||||
property color normal: Colors.c.color
|
||||
property color selected: Colors.i.color
|
||||
}
|
||||
|
||||
property int width: 1
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.q
|
||||
property color readOnly: Colors.e
|
||||
property color normal: Colors.q.color
|
||||
property color readOnly: Colors.e.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int rightPadding: 10
|
||||
}
|
||||
|
|
@ -44,22 +43,22 @@ QtObject {
|
|||
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color error: Colors.error
|
||||
property color normal: Colors.c
|
||||
property color selected: Colors.i
|
||||
property color error: Colors.error.color
|
||||
property color normal: Colors.c.color
|
||||
property color selected: Colors.i.color
|
||||
}
|
||||
|
||||
property int width: 0
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.q
|
||||
property color readOnly: Colors.e
|
||||
property color normal: Colors.q.color
|
||||
property color readOnly: Colors.e.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int rightPadding: 10
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -11,7 +10,7 @@ QtObject {
|
|||
|
||||
property QtObject value: QtObject {
|
||||
property QtObject placeholder: QtObject {
|
||||
property color color: Colors.n
|
||||
property color color: Colors.n.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +24,7 @@ QtObject {
|
|||
property int iconSize: 18
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 9
|
||||
property int width: 130
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,7 +13,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject legend: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int height: 36
|
||||
property int width: 200
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,12 +13,12 @@ QtObject {
|
|||
property int spacing: 5
|
||||
|
||||
property QtObject separator: QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int height: 2
|
||||
}
|
||||
|
||||
property QtObject title: QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int pointSize: Units.dp * 12
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -15,7 +14,7 @@ QtObject {
|
|||
property int maxWidth: 400
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,13 +13,13 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject error: QtObject {
|
||||
property color color: Colors.error
|
||||
property color color: Colors.error.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int height: 11
|
||||
}
|
||||
|
||||
property QtObject legend: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color shadowColor: Colors.l
|
||||
property color shadowColor: Colors.l.color
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject background: QtObject {
|
||||
property color color: Colors.c
|
||||
property color color: Colors.c.color
|
||||
property int height: 4
|
||||
property int radius: 2
|
||||
property int width: 200
|
||||
|
||||
property QtObject content: QtObject {
|
||||
property color color: Colors.m
|
||||
property color color: Colors.m.color
|
||||
property int radius: 2
|
||||
}
|
||||
}
|
||||
|
|
@ -25,14 +24,14 @@ QtObject {
|
|||
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.c
|
||||
property color pressed: Colors.c
|
||||
property color normal: Colors.c.color
|
||||
property color pressed: Colors.c.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.e
|
||||
property color pressed: Colors.f
|
||||
property color normal: Colors.e.color
|
||||
property color pressed: Colors.f.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
QtObject{
|
||||
property QtObject normal :QtObject {
|
||||
|
|
@ -16,16 +14,16 @@ QtObject{
|
|||
property int width: 48
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.i
|
||||
property color disabled: Colors.c
|
||||
property color normal: Colors.c
|
||||
property color checked: Colors.i.color
|
||||
property color disabled: Colors.c.color
|
||||
property color normal: Colors.c.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.i
|
||||
property color disabled: Colors.e
|
||||
property color normal: Colors.q
|
||||
property color checked: Colors.i.color
|
||||
property color disabled: Colors.e.color
|
||||
property color normal: Colors.q.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -34,17 +32,17 @@ QtObject{
|
|||
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.i
|
||||
property color disabled: Colors.c
|
||||
property color normal: Colors.n
|
||||
property color pressed: Colors.n
|
||||
property color checked: Colors.i.color
|
||||
property color disabled: Colors.c.color
|
||||
property color normal: Colors.n.color
|
||||
property color pressed: Colors.n.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color pressed: Colors.c
|
||||
property color disabled: Colors.e
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.c.color
|
||||
property color disabled: Colors.e.color
|
||||
property color normal: Colors.q.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,16 +57,16 @@ QtObject{
|
|||
property int width: 48
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.s
|
||||
property color disabled: Colors.c
|
||||
property color normal: Colors.c
|
||||
property color checked: Colors.s.color
|
||||
property color disabled: Colors.c.color
|
||||
property color normal: Colors.c.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.s
|
||||
property color disabled: Colors.e
|
||||
property color normal: Colors.q
|
||||
property color checked: Colors.s.color
|
||||
property color disabled: Colors.e.color
|
||||
property color normal: Colors.q.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,17 +75,17 @@ QtObject{
|
|||
|
||||
property QtObject border: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color checked: Colors.s
|
||||
property color disabled: Colors.c
|
||||
property color normal: Colors.n
|
||||
property color pressed: Colors.n
|
||||
property color checked: Colors.s.color
|
||||
property color disabled: Colors.c.color
|
||||
property color normal: Colors.n.color
|
||||
property color pressed: Colors.n.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color pressed: Colors.c
|
||||
property color disabled: Colors.e
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.c.color
|
||||
property color disabled: Colors.e.color
|
||||
property color normal: Colors.q.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -10,11 +9,11 @@ QtObject {
|
|||
property int spacing: 8
|
||||
|
||||
property QtObject backgroundColor: QtObject {
|
||||
property color disabled: Colors.i30
|
||||
property color hovered: Colors.b
|
||||
property color normal: Colors.i
|
||||
property color pressed: Colors.m
|
||||
property color selected: Colors.k
|
||||
property color disabled: Colors.i30.color
|
||||
property color hovered: Colors.b.color
|
||||
property color normal: Colors.i.color
|
||||
property color pressed: Colors.m.color
|
||||
property color selected: Colors.k.color
|
||||
}
|
||||
|
||||
property QtObject icon: QtObject {
|
||||
|
|
@ -28,11 +27,11 @@ QtObject {
|
|||
property int rightPadding: 10
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color disabled: Colors.q
|
||||
property color hovered: Colors.q
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.q
|
||||
property color selected: Colors.i
|
||||
property color disabled: Colors.q.color
|
||||
property color hovered: Colors.q.color
|
||||
property color normal: Colors.q.color
|
||||
property color pressed: Colors.q.color
|
||||
property color selected: Colors.i.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.k
|
||||
property color color: Colors.k.color
|
||||
property int bottomMargin: 30
|
||||
property int leftMargin: 30
|
||||
property int rightMargin: 40
|
||||
|
|
@ -14,6 +12,6 @@ QtObject {
|
|||
|
||||
property QtObject separator: QtObject {
|
||||
property int height: 2
|
||||
property color color: Colors.f
|
||||
property color color: Colors.f.color
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color backgroundColor: Colors.f
|
||||
property color backgroundColor: Colors.f.color
|
||||
property int iconSize: 12
|
||||
property int padding: 10
|
||||
|
||||
property QtObject placeholder: QtObject {
|
||||
property color color: Colors.n
|
||||
property color color: Colors.n.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
|
||||
|
|
@ -20,8 +19,8 @@ QtObject {
|
|||
property int pointSize: Units.dp * 10
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color focused: Colors.l
|
||||
property color normal: Colors.d
|
||||
property color focused: Colors.l.color
|
||||
property color normal: Colors.d.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
|
|
@ -12,26 +10,26 @@ QtObject {
|
|||
property QtObject high: QtObject {
|
||||
property QtObject background: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color disabled: Colors.o
|
||||
property color enabled: Colors.n
|
||||
property color disabled: Colors.o.color
|
||||
property color enabled: Colors.n.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject contentItem: QtObject {
|
||||
property color color: Colors.b
|
||||
property color color: Colors.b.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject low: QtObject {
|
||||
property QtObject background: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color disabled: Colors.o
|
||||
property color enabled: Colors.n
|
||||
property color disabled: Colors.o.color
|
||||
property color enabled: Colors.n.color
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject contentItem: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property int spacing: 1
|
||||
property color backgroundColor: Colors.n
|
||||
property color backgroundColor: Colors.n.color
|
||||
|
||||
property QtObject entry: QtObject {
|
||||
property int iconSize: 24
|
||||
|
|
@ -17,14 +16,14 @@ QtObject {
|
|||
property int spacing: 18
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.h
|
||||
property color normal: Colors.g
|
||||
property color pressed: Colors.i
|
||||
property color selected: Colors.j
|
||||
property color hovered: Colors.h.color
|
||||
property color normal: Colors.g.color
|
||||
property color pressed: Colors.i.color
|
||||
property color selected: Colors.j.color
|
||||
}
|
||||
|
||||
property QtObject indicator: QtObject {
|
||||
property color color: Colors.i
|
||||
property color color: Colors.i.color
|
||||
property int width: 5
|
||||
}
|
||||
|
||||
|
|
@ -32,8 +31,8 @@ QtObject {
|
|||
property int pointSize: Units.dp * 10
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.q //q50
|
||||
property color selected: Colors.q
|
||||
property color normal: Colors.q.color //q50
|
||||
property color selected: Colors.q.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,13 +13,13 @@ QtObject {
|
|||
property int rightMargin: 8
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.j
|
||||
property color normal: Colors.g
|
||||
property color pressed: Colors.i
|
||||
property color hovered: Colors.j.color
|
||||
property color normal: Colors.g.color
|
||||
property color pressed: Colors.i.color
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int pointSize: Units.dp * 9
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ pragma Singleton
|
|||
import QtQml 2.2
|
||||
import QtQuick 2.3
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -16,9 +15,9 @@ QtObject {
|
|||
property int height: 30
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.o
|
||||
property color normal: Colors.q
|
||||
property color pressed: Colors.o
|
||||
property color hovered: Colors.o.color
|
||||
property color normal: Colors.q.color
|
||||
property color pressed: Colors.o.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,10 +26,10 @@ QtObject {
|
|||
property int weight : Font.Bold
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.j
|
||||
property color normal: Colors.j
|
||||
property color pressed: Colors.j
|
||||
property color disabled: Colors.l50
|
||||
property color hovered: Colors.j.color
|
||||
property color normal: Colors.j.color
|
||||
property color pressed: Colors.j.color
|
||||
property color disabled: Colors.l50.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,9 +41,9 @@ QtObject {
|
|||
property int height: 40
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.v
|
||||
property color normal: Colors.a
|
||||
property color pressed: Colors.v
|
||||
property color hovered: Colors.v.color
|
||||
property color normal: Colors.a.color
|
||||
property color pressed: Colors.v.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,10 +52,10 @@ QtObject {
|
|||
property int weight : Font.Normal
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.j
|
||||
property color normal: Colors.j
|
||||
property color pressed: Colors.j
|
||||
property color disabled: Colors.l50
|
||||
property color hovered: Colors.j.color
|
||||
property color normal: Colors.j.color
|
||||
property color pressed: Colors.j.color
|
||||
property color disabled: Colors.l50.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,9 +67,9 @@ QtObject {
|
|||
property int height: 40
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.v
|
||||
property color normal: Colors.a
|
||||
property color pressed: Colors.v
|
||||
property color hovered: Colors.v.color
|
||||
property color normal: Colors.a.color
|
||||
property color pressed: Colors.v.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,10 +78,10 @@ QtObject {
|
|||
property int weight : Font.Normal
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.error
|
||||
property color normal: Colors.error
|
||||
property color pressed: Colors.error
|
||||
property color disabled: Colors.l50
|
||||
property color hovered: Colors.error.color
|
||||
property color normal: Colors.error.color
|
||||
property color pressed: Colors.error.color
|
||||
property color disabled: Colors.l50.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,9 +93,9 @@ QtObject {
|
|||
property int height: 50
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.w
|
||||
property color normal: Colors.w
|
||||
property color pressed: Colors.w
|
||||
property color hovered: Colors.w.color
|
||||
property color normal: Colors.w.color
|
||||
property color pressed: Colors.w.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,10 +104,10 @@ QtObject {
|
|||
property int weight : Font.Normal
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.m
|
||||
property color normal: Colors.j
|
||||
property color pressed: Colors.m
|
||||
property color disabled: Colors.l50
|
||||
property color hovered: Colors.m.color
|
||||
property color normal: Colors.j.color
|
||||
property color pressed: Colors.m.color
|
||||
property color disabled: Colors.l50.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,40 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject normal : QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int width: 130
|
||||
property bool shadowEnabled: true
|
||||
property int radius : 0
|
||||
|
||||
property QtObject border : QtObject {
|
||||
property color color: Colors.u
|
||||
property color color: Colors.u.color
|
||||
property int width: 0
|
||||
}
|
||||
}
|
||||
property QtObject aux : QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int width: 200
|
||||
property bool shadowEnabled: false
|
||||
property int radius : 5
|
||||
|
||||
property QtObject border : QtObject {
|
||||
property color color: Colors.u
|
||||
property color color: Colors.u.color
|
||||
property int width: 1
|
||||
}
|
||||
}
|
||||
property QtObject aux2 : QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int width: 250
|
||||
property bool shadowEnabled: false
|
||||
property int radius : 0
|
||||
|
||||
property QtObject border : QtObject {
|
||||
property color color: Colors.u
|
||||
property color color: Colors.u.color
|
||||
property int width: 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject background : QtObject {
|
||||
property color color: Colors.g20
|
||||
property color color: Colors.g20.color
|
||||
property int radius : 10
|
||||
}
|
||||
|
||||
|
|
@ -18,8 +16,8 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.h
|
||||
property color normal: Colors.g20
|
||||
property color pressed: Colors.d
|
||||
property color hovered: Colors.h.color
|
||||
property color normal: Colors.g20.color
|
||||
property color pressed: Colors.d.color
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
|
|
@ -12,9 +10,9 @@ QtObject {
|
|||
property int width: 5
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color hovered: Colors.h
|
||||
property color normal: Colors.c
|
||||
property color pressed: Colors.d
|
||||
property color hovered: Colors.h.color
|
||||
property color normal: Colors.c.color
|
||||
property color pressed: Colors.d.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color backgroundColor: Colors.k
|
||||
property color backgroundColor: Colors.k.color
|
||||
|
||||
property QtObject shadow: QtObject {
|
||||
property color color: Colors.l
|
||||
property color color: Colors.l.color
|
||||
property int horizontalOffset: 2
|
||||
property int radius: 10
|
||||
property int samples: 15
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color backgroundColor: Colors.g
|
||||
property color color: Colors.q
|
||||
property color backgroundColor: Colors.g.color
|
||||
property color color: Colors.q.color
|
||||
property int arrowSize: 8
|
||||
property int delay: 1000
|
||||
property int pointSize: Units.dp * 9
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject transientWindow: QtObject {
|
||||
property color color: Colors.l80
|
||||
property color color: Colors.l80.color
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Linphone 1.0
|
|||
import Linphone.Styles 1.0
|
||||
import Utils 1.0
|
||||
import LinphoneEnums 1.0
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ Column {
|
|||
|
||||
Text {
|
||||
id: username
|
||||
|
||||
anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined)
|
||||
color: usernameColor
|
||||
elide: Text.ElideRight
|
||||
font.weight: contactDescriptionStyle.username.weight
|
||||
|
|
@ -55,6 +55,7 @@ Column {
|
|||
|
||||
Text {
|
||||
id:address
|
||||
anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined)
|
||||
text: SipAddressesModel.cleanSipAddress(sipAddress)
|
||||
color: sipAddressColor
|
||||
elide: Text.ElideRight
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ DesktopPopup {
|
|||
id: notification
|
||||
|
||||
property alias icon: iconSign.icon
|
||||
property var notificationData: ({})
|
||||
property var notificationData: ({
|
||||
timelineModel : null
|
||||
})
|
||||
property int overrodeHeight
|
||||
default property alias _content: content.data
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ Notification {
|
|||
|
||||
onClicked: notification._close(function () {
|
||||
AccountSettingsModel.setDefaultProxyConfigFromSipAddress(notification.localAddress)
|
||||
notification.timelineModel.selected = true
|
||||
notification.notificationData.window.setView('Conversation', {
|
||||
chatRoomModel:notification.timelineModel.getChatRoomModel()/*,
|
||||
peerAddress: notification.peerAddress,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -16,12 +15,12 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject sipAddress: QtObject {
|
||||
property color color: Colors.g
|
||||
property color color: Colors.g.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
|
||||
property QtObject username: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 11
|
||||
}
|
||||
property QtObject messageCounter: QtObject {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -15,7 +14,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject description: QtObject {
|
||||
property color color: Colors.n
|
||||
property color color: Colors.n.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int height: 40
|
||||
}
|
||||
|
|
@ -26,7 +25,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject title: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int bottomMargin: 10
|
||||
property int pointSize: Units.dp * 10
|
||||
property int height: 20
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -10,7 +9,7 @@ QtObject {
|
|||
property int height: 60
|
||||
|
||||
property QtObject error: QtObject {
|
||||
property color color: Colors.error
|
||||
property color color: Colors.error.color
|
||||
property int pointSize: Units.dp * 11
|
||||
property int padding: 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.e
|
||||
property color color: Colors.e.color
|
||||
property int height: 60
|
||||
property int leftMargin: 12
|
||||
property int rightMargin: 12
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.e
|
||||
property color color: Colors.e.color
|
||||
property int height: 280
|
||||
property int leftMargin: 12
|
||||
property int rightMargin: 12
|
||||
|
|
@ -15,19 +14,19 @@ QtObject {
|
|||
property int topMargin: 10
|
||||
|
||||
property QtObject title: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int bottomMargin: 20
|
||||
property int pointSize: Units.dp * 16
|
||||
}
|
||||
|
||||
property QtObject key: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int width: 200
|
||||
}
|
||||
|
||||
property QtObject value: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -13,24 +12,24 @@ QtObject {
|
|||
property int width: 200
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.e
|
||||
property color selected: Colors.j
|
||||
property color normal: Colors.e.color
|
||||
property color selected: Colors.j.color
|
||||
}
|
||||
|
||||
property QtObject endCallAnimation: QtObject {
|
||||
property color blinkColor: Colors.i
|
||||
property color blinkColor: Colors.i.color
|
||||
property int duration: 300
|
||||
property int loops: 3
|
||||
}
|
||||
|
||||
property QtObject sipAddressColor: QtObject {
|
||||
property color normal: Colors.n
|
||||
property color selected: Colors.q
|
||||
property color normal: Colors.n.color
|
||||
property color selected: Colors.q.color
|
||||
}
|
||||
|
||||
property QtObject usernameColor: QtObject {
|
||||
property color normal: Colors.j
|
||||
property color selected: Colors.q
|
||||
property color normal: Colors.j.color
|
||||
property color selected: Colors.q.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.e
|
||||
property color color: Colors.e.color
|
||||
property int height: 60
|
||||
property int leftMargin: 12
|
||||
property int rightMargin: 12
|
||||
|
|
|
|||
|
|
@ -1,26 +1,25 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
|
||||
property QtObject sectionHeading: QtObject {
|
||||
property int padding: 5
|
||||
property int bottomMargin: 20
|
||||
|
||||
property QtObject border: QtObject {
|
||||
property color color: Colors.g10
|
||||
property color color: Colors.g10.color
|
||||
property int width: 1
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property int pointSize: Units.dp * 10
|
||||
property color color: Colors.g
|
||||
property color color: Colors.g.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -28,13 +27,13 @@ QtObject {
|
|||
property int height: 80
|
||||
|
||||
property QtObject border: QtObject {
|
||||
property color color: Colors.f
|
||||
property color color: Colors.f.color
|
||||
property int width: 1
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject composingText: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int height: 25
|
||||
property int leftPadding: 20
|
||||
property int pointSize: Units.dp * 9
|
||||
|
|
@ -51,7 +50,7 @@ QtObject {
|
|||
property int iconSize: 18
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
@ -80,11 +79,11 @@ QtObject {
|
|||
|
||||
property QtObject extension: QtObject {
|
||||
property QtObject background: QtObject {
|
||||
property color color: Colors.l50
|
||||
property color color: Colors.l50.color
|
||||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,11 +95,11 @@ QtObject {
|
|||
property int radius: 3
|
||||
|
||||
property QtObject background: QtObject {
|
||||
property color color: Colors.f
|
||||
property color color: Colors.f.color
|
||||
}
|
||||
|
||||
property QtObject contentItem: QtObject {
|
||||
property color color: Colors.p
|
||||
property color color: Colors.p.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -111,30 +110,30 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject incoming: QtObject {
|
||||
property color backgroundColor: Colors.o
|
||||
property color backgroundColor: Colors.o.color
|
||||
property int avatarSize: 20
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject outgoing: QtObject {
|
||||
property color backgroundColor: Colors.e
|
||||
property color backgroundColor: Colors.e.color
|
||||
property int areaSize: 16
|
||||
property int busyIndicatorSize: 16
|
||||
property int sendIconSize: 12
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject time: QtObject {
|
||||
property color color: Colors.d
|
||||
property color color: Colors.d.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int width: 44
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -14,8 +13,8 @@ QtObject {
|
|||
|
||||
property QtObject background: QtObject {
|
||||
property QtObject color: QtObject {
|
||||
property color normal: Colors.a
|
||||
property color hovered: Colors.o
|
||||
property color normal: Colors.a.color
|
||||
property color hovered: Colors.o.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,7 +23,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 10
|
||||
}
|
||||
}
|
||||
|
|
@ -39,7 +38,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject legend: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int height: 50
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color backgroundColor: Colors.d
|
||||
property color backgroundColor: Colors.d.color
|
||||
|
||||
property QtObject initials: QtObject {
|
||||
property color color: Colors.q
|
||||
property color color: Colors.q.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int ratio: 30
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,23 @@ pragma Singleton
|
|||
import QtQml 2.2
|
||||
import QtQuick 2.7
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property QtObject sipAddress: QtObject {
|
||||
property color color: Colors.n
|
||||
property color color: Colors.n.color
|
||||
property int pointSize: Units.dp * 10
|
||||
property int weight: Font.Normal
|
||||
}
|
||||
|
||||
property QtObject username: QtObject {
|
||||
property color color: Colors.j
|
||||
property color color: Colors.j.color
|
||||
property int pointSize: Units.dp * 11
|
||||
property int weight: Font.Bold
|
||||
property QtObject status : QtObject{
|
||||
property color color : Colors.g
|
||||
property color color : Colors.g.color
|
||||
property int pointSize : Units.dp * 9
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue