Commit d417a15b authored by Andreas Traczyk's avatar Andreas Traczyk

refacto: remove unused LRC models

Change-Id: Id5558187dd0f906dfd3565e204ea5c4d7490ef77
parent 2a2b901a
......@@ -27,6 +27,7 @@
#include <QDesktopServices>
#include <QScrollBar>
#include <QWebEngineScript>
#include <QMimeData>
#include <algorithm>
#include <memory>
......@@ -50,7 +51,6 @@
#include "pixbufmanipulator.h"
#include "ringthemeutils.h"
#include "settingskey.h"
#include "windowscontactbackend.h"
CallWidget::CallWidget(QWidget* parent) :
NavWidget(parent),
......
......@@ -33,12 +33,6 @@
#include "navwidget.h"
#include "smartlistmodel.h"
// old LRC
#include "accountmodel.h"
#include "media/textrecording.h"
#include "video/previewmanager.h"
#include "video/renderer.h"
// new LRC
#include "api/account.h"
#include "api/contact.h"
......
......@@ -46,8 +46,6 @@
#include "api/conversationmodel.h"
#include "api/peerdiscoverymodel.h"
#include "account.h"
using namespace lrc::api;
class LRCInstance : public QObject
......@@ -61,8 +59,6 @@ public:
};
static void init() {
instance();
// TODO: remove when all platforms migrate to avModel
instance().avModel().deactivateOldVideoModels();
};
static Lrc& getAPI() {
return *(instance().lrc_);
......
......@@ -27,9 +27,6 @@
#include <QTimer>
#include <QWindow>
#include "media/text.h"
#include "media/textrecording.h"
#ifdef Q_OS_WIN
#include <QWinThumbnailToolBar>
#include <QWinThumbnailToolButton>
......@@ -37,7 +34,6 @@
#endif
#include "aboutdialog.h"
#include "callmodel.h"
#include "callwidget.h"
#include "settingskey.h"
#include "utils.h"
......@@ -140,10 +136,11 @@ MainWindow::MainWindow(QWidget* parent)
connect(&GlobalSystemTray::instance(), SIGNAL(messageClicked()), this, SLOT(notificationClicked()));
connect(&netManager_, &QNetworkConfigurationManager::onlineStateChanged, [=](bool online) {
Q_UNUSED(online)
AccountModel::instance().slotConnectivityChanged();
});
connect(&netManager_, &QNetworkConfigurationManager::onlineStateChanged,
[=](bool online) {
Q_UNUSED(online);
LRCInstance::connectivityChanged();
});
auto flags_ = windowFlags();
......
......@@ -306,7 +306,7 @@ NewWizardWidget::timeoutNameLookupTimer()
{
if (ui->signUpCheckbox->isChecked() && !ui->usernameEdit->text().isEmpty()) {
updateNameRegistrationUi(NameRegistrationUIState::SEARCHING);
NameDirectory::instance().lookupName(nullptr, QString(), registeredName_);
NameDirectory::instance().lookupName(QString(), registeredName_);
}
}
......
......@@ -25,6 +25,8 @@
#include "lrcinstance.h"
#include "navwidget.h"
#include "namedirectory.h"
namespace Ui {
class NewWizardWidget;
}
......
......@@ -29,9 +29,6 @@
#include <QBuffer>
#include <QPainter>
#include "person.h"
#include "call.h"
#include "contactmethod.h"
#include "globalinstances.h"
// new LRC
......@@ -44,40 +41,6 @@
#include "ringthemeutils.h"
#undef interface
QVariant
PixbufManipulator::callPhoto(Call* c, const QSize& size, bool displayPresence)
{
if (!c || c->type() == Call::Type::CONFERENCE){
return QVariant::fromValue(Utils::fallbackAvatar(size,
c->peerContactMethod()->uri().full(),
c->peerContactMethod()->bestName()));
}
return callPhoto(c->peerContactMethod(), size, displayPresence);
}
QVariant
PixbufManipulator::callPhoto(const ContactMethod* cm, const QSize& size, bool displayPresence)
{
if (cm && cm->contact()) {
return contactPhoto(cm->contact(), size, displayPresence);
} else {
return QVariant::fromValue(Utils::fallbackAvatar(size, cm));
}
}
QVariant
PixbufManipulator::contactPhoto(Person* p, const QSize& size, bool displayPresence)
{
Q_UNUSED(displayPresence);
QImage photo;
if (p->photo().isValid()) {
photo = p->photo().value<QImage>();
} else {
photo = Utils::fallbackAvatar(IMAGE_SIZE, p->phoneNumbers().at(0));
}
return QVariant::fromValue(Utils::scaleAndFrame(photo, size));
}
QVariant PixbufManipulator::personPhoto(const QByteArray& data, const QString& type)
{
QImage avatar;
......@@ -99,13 +62,6 @@ PixbufManipulator::numberCategoryIcon(const QVariant& p, const QSize& size, bool
return QVariant();
}
QVariant
PixbufManipulator::securityIssueIcon(const QModelIndex& index)
{
Q_UNUSED(index)
return QVariant();
}
QByteArray
PixbufManipulator::toByteArray(const QVariant& pxm)
{
......@@ -114,19 +70,6 @@ PixbufManipulator::toByteArray(const QVariant& pxm)
return ba;
}
QVariant
PixbufManipulator::collectionIcon(const CollectionInterface* colItf, PixmapManipulatorI::CollectionIconHint hint) const
{
Q_UNUSED(colItf)
Q_UNUSED(hint)
return QVariant();
}
QVariant
PixbufManipulator::securityLevelIcon(const SecurityEvaluationModel::SecurityLevel level) const
{
Q_UNUSED(level)
return QVariant();
}
QVariant
PixbufManipulator::userActionIcon(const UserActionElement& state) const
{
......@@ -140,48 +83,6 @@ QVariant PixbufManipulator::decorationRole(const QModelIndex& index)
return QVariant();
}
QVariant PixbufManipulator::decorationRole(const Call* c)
{
QImage photo;
if (c && c->peerContactMethod()
&& c->peerContactMethod()->contact()
&& c->peerContactMethod()->contact()->photo().isValid()) {
photo = c->peerContactMethod()->contact()->photo().value<QImage>();
} else {
Utils::fallbackAvatar(IMAGE_SIZE, c->peerContactMethod());
}
return QVariant::fromValue(Utils::scaleAndFrame(photo, IMAGE_SIZE));
}
QVariant PixbufManipulator::decorationRole(const ContactMethod* cm)
{
QImage photo;
if (cm && cm->contact()
&& cm->contact()->photo().isValid()) {
photo = cm->contact()->photo().value<QImage>();
} else {
photo = Utils::fallbackAvatar(IMAGE_SIZE, cm);
}
return QVariant::fromValue(Utils::scaleAndFrame(photo, IMAGE_SIZE));
}
QVariant PixbufManipulator::decorationRole(const Person* p)
{
QImage photo;
if (p && p->photo().isValid()) {
photo = p->photo().value<QImage>();
} else {
photo = Utils::fallbackAvatar(IMAGE_SIZE, p->phoneNumbers().at(0));
}
return QVariant::fromValue(Utils::scaleAndFrame(photo, IMAGE_SIZE));
}
QVariant PixbufManipulator::decorationRole(const Account* acc)
{
Q_UNUSED(acc);
return QVariant();
}
QVariant
PixbufManipulator::decorationRole(const lrc::api::conversation::Info & conversationInfo,
const lrc::api::account::Info & accountInfo)
......
......@@ -31,25 +31,13 @@ QByteArray QImageToByteArray(QImage image);
class PixbufManipulator : public Interfaces::PixmapManipulatorI {
public:
QVariant callPhoto(Call* c, const QSize& size, bool displayPresence = true) override;
QVariant callPhoto(const ContactMethod* n, const QSize& size, bool displayPresence = true) override;
QVariant contactPhoto(Person* c, const QSize& size, bool displayPresence = true) override;
QVariant personPhoto(const QByteArray& data, const QString& type = "PNG") override;
/* TODO: the following methods return an empty QVariant/QByteArray */
QVariant numberCategoryIcon(const QVariant& p, const QSize& size, bool displayPresence = false, bool isPresent = false) override;
QVariant securityIssueIcon(const QModelIndex& index) override;
QByteArray toByteArray(const QVariant& pxm) override;
QVariant collectionIcon(const CollectionInterface* colItf,
Interfaces::PixmapManipulatorI::CollectionIconHint hint =
Interfaces::PixmapManipulatorI::CollectionIconHint::NONE) const override;
QVariant securityLevelIcon(const SecurityEvaluationModel::SecurityLevel level) const override;
QVariant userActionIcon(const UserActionElement& state) const override;
QVariant decorationRole(const QModelIndex& index) override;
QVariant decorationRole(const Call* c) override;
QVariant decorationRole(const ContactMethod* cm) override;
QVariant decorationRole(const Person* p) override;
QVariant decorationRole(const Account* acc) override;
QVariant decorationRole(const lrc::api::conversation::Info& conversation,
const lrc::api::account::Info& accountInfo) override;
};
......@@ -306,7 +306,6 @@
<ClCompile Include="updateconfirmdialog.cpp" />
<ClCompile Include="videowidget.cpp" />
<ClCompile Include="webchathelpers.cpp" />
<ClCompile Include="windowscontactbackend.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="aboutdialog.h">
......@@ -502,7 +501,6 @@
</QtMoc>
<ClInclude Include="version.h" />
<ClInclude Include="webchathelpers.h" />
<ClInclude Include="windowscontactbackend.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
......
......@@ -108,9 +108,6 @@
<ClCompile Include="videowidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="windowscontactbackend.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="smartlistview.cpp">
<Filter>Source Files</Filter>
</ClCompile>
......@@ -266,9 +263,6 @@
<QtMoc Include="videowidget.h">
<Filter>Header Files</Filter>
</QtMoc>
<ClInclude Include="windowscontactbackend.h">
<Filter>Header Files</Filter>
</ClInclude>
<QtMoc Include="smartlistmodel.h">
<Filter>Header Files</Filter>
</QtMoc>
......
......@@ -33,8 +33,8 @@
#include "banneditemwidget.h"
#include "version.h"
#include "namedirectory.h"
#include "api/newdevicemodel.h"
#include "media/recordingmodel.h"
#include <QFileDialog>
#include <QInputDialog>
......@@ -389,7 +389,7 @@ void SettingsWidget::receiveRegNameSlot(const std::string& accountID,
void SettingsWidget::beforeNameLookup()
{
NameDirectory::instance().lookupName(nullptr, QString(), registeredName_);
NameDirectory::instance().lookupName(QString(), registeredName_);
}
void SettingsWidget::afterNameLookup(lrc::api::account::LookupStatus status, const std::string& regName)
......@@ -765,8 +765,6 @@ void SettingsWidget::setConnections()
connect(ui->downloadButton, &QAbstractButton::clicked, this, &SettingsWidget::openDownloadFolderSlot);
connect(ui->alwaysRecordingCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetAlwaysRecording);
connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &SettingsWidget::checkForUpdateSlot);
connect(ui->autoUpdateCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetUpdateAutomatic);
......@@ -797,14 +795,14 @@ void SettingsWidget::populateGeneralSettings()
ui->notificationCheckBox->setChecked(notifs);
//recordings
ui->alwaysRecordingCheckBox->setChecked(media::RecordingModel::instance().isAlwaysRecording());
if (media::RecordingModel::instance().recordPath().isEmpty()) {
QString recordPath = QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
media::RecordingModel::instance().setRecordPath(recordPath);
if (LRCInstance::avModel().getRecordPath().empty()) {
QString recordPath = QDir::toNativeSeparators(
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
LRCInstance::avModel().setRecordPath(recordPath.toStdString());
}
Utils::setElidedText(ui->recordPathButton, media::RecordingModel::instance().recordPath());
Utils::setElidedText(ui->recordPathButton,
QString::fromStdString(LRCInstance::avModel().getRecordPath()));
#ifdef Q_OS_WIN
ui->autoUpdateCheckBox->setChecked(settings.value(SettingsKey::autoUpdate).toBool());
......@@ -851,19 +849,20 @@ void SettingsWidget::openDownloadFolderSlot()
}
}
void SettingsWidget::slotSetAlwaysRecording(bool state)
{
media::RecordingModel::instance().setAlwaysRecording(state);
}
void SettingsWidget::openRecordFolderSlot()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Select A Folder For Your Recordings"),
media::RecordingModel::instance().recordPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
QString dir = QFileDialog::getExistingDirectory(
this,
tr("Select A Folder For Your Recordings"),
QString::fromStdString(LRCInstance::avModel().getRecordPath()),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks
);
if (!dir.isEmpty()) {
media::RecordingModel::instance().setRecordPath(dir);
Utils::setElidedText(ui->recordPathButton, media::RecordingModel::instance().recordPath());
LRCInstance::avModel().setRecordPath(dir.toStdString());
Utils::setElidedText(ui->recordPathButton,
QString::fromStdString(LRCInstance::avModel().getRecordPath())
);
}
}
......
......@@ -129,7 +129,6 @@ private slots:
void checkForUpdateSlot();
void slotSetClosedOrMin(bool state);
void openDownloadFolderSlot();
void slotSetAlwaysRecording(bool state);
void openRecordFolderSlot();
void slotSetUpdateAutomatic(bool state);
void outputDevIndexChangedSlot(int index);
......
......@@ -376,7 +376,7 @@
</size>
</property>
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="generalSettings">
<property name="sizePolicy">
......@@ -867,46 +867,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_30">
<property name="spacing">
<number>12</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="ToggleSwitch" name="alwaysRecordingCheckBox" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Always Recording</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
......@@ -1250,7 +1210,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>749</width>
<width>705</width>
<height>1387</height>
</rect>
</property>
......@@ -2573,7 +2533,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>749</width>
<width>683</width>
<height>864</height>
</rect>
</property>
......@@ -3941,18 +3901,18 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="ToggleSwitch" name="hardwareAccelCheckBox" native="false">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Enable hardware acceleration</string>
</property>
</widget>
</item>
<item>
<widget class="ToggleSwitch" name="hardwareAccelCheckBox" native="true">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Enable hardware acceleration</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_24">
<property name="orientation">
......
......@@ -623,23 +623,6 @@ Utils::fallbackAvatar(const QSize size, const QString& canonicalUriStr, const QS
return avatar;
}
QImage
Utils::fallbackAvatar(const QSize size, const ContactMethod* cm)
{
if (cm == nullptr) {
return QImage();
}
QImage image;
auto letterStr = QString();
if (cm->uri().userinfo() != cm->bestName()) {
letterStr = cm->bestName();
}
image = fallbackAvatar(size,
cm->uri().full(),
letterStr);
return image;
}
QImage
Utils::fallbackAvatar(const QSize size, const std::string& alias, const std::string& uri)
{
......
......@@ -42,11 +42,10 @@
#define LPCWSTR char*
#endif
#include <api/conversationmodel.h>
#include <api/account.h>
#include <api/contactmodel.h>
#include <api/contact.h>
#include <contactmethod.h>
#include "api/conversationmodel.h"
#include "api/account.h"
#include "api/contactmodel.h"
#include "api/contact.h"
static const QSize IMAGE_SIZE{ 128, 128 };
......@@ -96,7 +95,6 @@ QImage getCirclePhoto(const QImage original, int sizePhoto);
QImage conversationPhoto(const std::string& convUid, const lrc::api::account::Info& accountInfo);
QColor getAvatarColor(const QString& canonicalUri);
QImage fallbackAvatar(const QSize size, const QString& canonicalUriStr, const QString& letterStr = QString());
QImage fallbackAvatar(const QSize size, const ContactMethod* cm);
QImage fallbackAvatar(const QSize size, const std::string& alias, const std::string& uri);
QByteArray QImageToByteArray(QImage image);
QByteArray QByteArrayFromFile(const QString& filename);
......
......@@ -22,11 +22,6 @@
#include <QTime>
// LRC
#include "callmodel.h"
#include "person.h"
#include "account.h"
#include "lrcinstance.h"
#include "utils.h"
......@@ -46,6 +41,8 @@ VideoOverlay::VideoOverlay(QWidget* parent) :
ui->noMicButton->setCheckable(true);
ui->onHoldLabel->setVisible(false);
ui->recButton->setVisible(false);
}
VideoOverlay::~VideoOverlay()
......
......@@ -23,11 +23,6 @@
#include <QMouseEvent>
#include <QPropertyAnimation>
#include "callmodel.h"
#include "video/devicemodel.h"
#include "video/sourcemodel.h"
#include "media/video.h"
#include "videooverlay.h"
namespace Ui {
......
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2015-2017 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* 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/>. *
**************************************************************************/
#pragma once
#include <QObject>
#include <QStandardPaths>
#include <QDir>
#include <QXmlStreamReader>
#include <QtConcurrent/QtConcurrent>
#include <QImage>
#include <QFileSystemWatcher>
#include "person.h"
#include "collectioninterface.h"
#include "contactmethod.h"
#include "phonedirectorymodel.h"
class WindowsContactBackend : public CollectionInterface
{
public:
explicit WindowsContactBackend(CollectionMediator<Person>* mediator, CollectionInterface* parent = nullptr);
virtual ~WindowsContactBackend();
virtual bool load() override;
virtual bool reload() override;
virtual bool clear() override;
virtual QString name () const override;
virtual QString category () const override;
virtual bool isEnabled() const override;
virtual QByteArray id () const override;
virtual FlagPack<CollectionInterface::SupportedFeatures> supportedFeatures() const override;
private:
bool loadRun();
private:
CollectionMediator<Person>* mediator_;
constexpr static int sizePhoto_ = 50;
QFileSystemWatcher* watcher_;
private:
bool getPersonFromContactFile(const QDir &contactDir, const QString& contactFileName);
};
class WindowsContactEditor : public CollectionEditor<Person>
{
public:
WindowsContactEditor(CollectionMediator<Person>* m, WindowsContactBackend* parent);
~WindowsContactEditor();
virtual bool save ( const Person* item ) override;
virtual bool remove ( const Person* item ) override;
virtual bool edit ( Person* item ) override;
virtual bool addNew ( Person* item ) override;
virtual bool addExisting( const Person* item ) override;
private:
virtual QVector<Person*> items() const override;
QVector<Person*> items_;
WindowsContactBackend* collection_;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment