mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 07:08:07 +00:00
feat(app): use new compilations flags
This commit is contained in:
parent
24eb82f6bd
commit
989bbc4edf
16 changed files with 119 additions and 172 deletions
|
|
@ -12,6 +12,22 @@ set(CMAKE_CXX_STANDARD 11)
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# -Wold-style-cast \
|
||||
set(CUSTOM_FLAGS "\
|
||||
-Wcast-align \
|
||||
-Wconversion \
|
||||
-Wextra \
|
||||
-Wfloat-equal \
|
||||
-Winit-self \
|
||||
-Winline \
|
||||
-Wlogical-op \
|
||||
-Woverloaded-virtual \
|
||||
-Wpointer-arith \
|
||||
-Wuninitialized \
|
||||
-Wunused \
|
||||
")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}")
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Define packages, libs, sources, headers, resources and languages
|
||||
# --------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -140,11 +140,13 @@
|
|||
<file>ui/modules/Linphone/Styles/qmldir</file>
|
||||
<file>ui/modules/Linphone/Styles/TimelineStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Timeline.qml</file>
|
||||
<file>ui/scripts/LinphoneUtils/linphone-utils.js</file>
|
||||
<file>ui/scripts/LinphoneUtils/qmldir</file>
|
||||
<file>ui/scripts/Utils/qmldir</file>
|
||||
<file>ui/scripts/Utils/uri-tools.js</file>
|
||||
<file>ui/scripts/Utils/utils.js</file>
|
||||
<file>ui/views/App/Calls/AbstractCall.qml</file>
|
||||
<file>ui/views/App/Calls/Calls.qml</file>
|
||||
<file>ui/views/App/Calls/StartingCall.qml</file>
|
||||
<file>ui/views/App/Calls/StartingIncomingCall.qml</file>
|
||||
<file>ui/views/App/Calls/StartingOutgoingCall.qml</file>
|
||||
<file>ui/views/App/MainWindow/Contact.qml</file>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ QHash<int, QByteArray> ChatModel::roleNames () const {
|
|||
return roles;
|
||||
}
|
||||
|
||||
int ChatModel::rowCount (const QModelIndex &) const {
|
||||
return m_entries.count();
|
||||
}
|
||||
|
||||
QVariant ChatModel::data (const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
|
|
@ -88,7 +92,9 @@ void ChatModel::fillMessageEntry (
|
|||
const shared_ptr<linphone::ChatMessage> &message
|
||||
) {
|
||||
dest["type"] = EntryType::MessageEntry;
|
||||
dest["timestamp"] = QDateTime::fromTime_t(message->getTime());
|
||||
dest["timestamp"] = QDateTime::fromMSecsSinceEpoch(
|
||||
static_cast<qint64>(message->getTime()) * 1000
|
||||
);
|
||||
dest["content"] = Utils::linphoneStringToQString(
|
||||
message->getText()
|
||||
);
|
||||
|
|
@ -97,9 +103,11 @@ void ChatModel::fillMessageEntry (
|
|||
|
||||
void ChatModel::fillCallStartEntry (
|
||||
QVariantMap &dest,
|
||||
const std::shared_ptr<linphone::CallLog> &call_log
|
||||
const shared_ptr<linphone::CallLog> &call_log
|
||||
) {
|
||||
QDateTime timestamp = QDateTime::fromTime_t(call_log->getStartDate());
|
||||
QDateTime timestamp = QDateTime::fromMSecsSinceEpoch(
|
||||
static_cast<qint64>(call_log->getStartDate()) * 1000
|
||||
);
|
||||
|
||||
dest["type"] = EntryType::CallEntry;
|
||||
dest["timestamp"] = timestamp;
|
||||
|
|
@ -110,10 +118,10 @@ void ChatModel::fillCallStartEntry (
|
|||
|
||||
void ChatModel::fillCallEndEntry (
|
||||
QVariantMap &dest,
|
||||
const std::shared_ptr<linphone::CallLog> &call_log
|
||||
const shared_ptr<linphone::CallLog> &call_log
|
||||
) {
|
||||
QDateTime timestamp = QDateTime::fromTime_t(
|
||||
call_log->getStartDate() + call_log->getDuration()
|
||||
QDateTime timestamp = QDateTime::fromMSecsSinceEpoch(
|
||||
static_cast<qint64>(call_log->getStartDate() + call_log->getDuration()) * 1000
|
||||
);
|
||||
|
||||
dest["type"] = EntryType::CallEntry;
|
||||
|
|
@ -139,7 +147,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
|
|||
// WARNING: Unable to remove symmetric call here. (start/end)
|
||||
// We are between `beginRemoveRows` and `endRemoveRows`.
|
||||
// A solution is to schedule a `removeEntry` call in the Qt main loop.
|
||||
std::shared_ptr<void> linphone_ptr = pair.second;
|
||||
shared_ptr<void> linphone_ptr = pair.second;
|
||||
QTimer::singleShot(0, this, [this, linphone_ptr]() {
|
||||
auto it = find_if(
|
||||
m_entries.begin(), m_entries.end(),
|
||||
|
|
@ -149,7 +157,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
|
|||
);
|
||||
|
||||
if (it != m_entries.end())
|
||||
removeEntry(distance(m_entries.begin(), it));
|
||||
removeEntry(static_cast<int>(distance(m_entries.begin(), it)));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ public:
|
|||
|
||||
ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {}
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const {
|
||||
return m_entries.count();
|
||||
}
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const;
|
||||
|
||||
QHash<int, QByteArray> roleNames () const;
|
||||
QVariant data (const QModelIndex &index, int role) const;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
ChatModelFilter m_chat_model_filter;
|
||||
|
||||
unsigned int m_n_max_displayed_entries = ENTRIES_CHUNK_SIZE;
|
||||
int m_n_max_displayed_entries = ENTRIES_CHUNK_SIZE;
|
||||
|
||||
static const unsigned int ENTRIES_CHUNK_SIZE;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ ContactsListModel::ContactsListModel (QObject *parent): QAbstractListModel(paren
|
|||
}
|
||||
}
|
||||
|
||||
int ContactsListModel::rowCount (const QModelIndex &) const {
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ContactsListModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$contact";
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ class ContactsListModel : public QAbstractListModel {
|
|||
public:
|
||||
ContactsListModel (QObject *parent = Q_NULLPTR);
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const {
|
||||
return m_list.count();
|
||||
}
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const;
|
||||
|
||||
QHash<int, QByteArray> roleNames () const;
|
||||
QVariant data (const QModelIndex &index, int role) const;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
#include "ContactsListProxyModel.hpp"
|
||||
|
||||
#define USERNAME_WEIGHT 50.0
|
||||
#define MAIN_SIP_ADDRESS_WEIGHT 25.0
|
||||
#define OTHER_SIP_ADDRESSES_WEIGHT 25.0
|
||||
#define USERNAME_WEIGHT 50.0f
|
||||
#define MAIN_SIP_ADDRESS_WEIGHT 25.0f
|
||||
#define OTHER_SIP_ADDRESSES_WEIGHT 25.0f
|
||||
|
||||
#define FACTOR_POS_1 0.90
|
||||
#define FACTOR_POS_2 0.80
|
||||
#define FACTOR_POS_3 0.70
|
||||
#define FACTOR_POS_OTHER 0.60
|
||||
#define FACTOR_POS_1 0.90f
|
||||
#define FACTOR_POS_2 0.80f
|
||||
#define FACTOR_POS_3 0.70f
|
||||
#define FACTOR_POS_OTHER 0.60f
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -63,7 +63,9 @@ bool ContactsListProxyModel::filterAcceptsRow (
|
|||
index.data()
|
||||
);
|
||||
|
||||
int weight = m_weights[contact] = computeContactWeight(*contact);
|
||||
unsigned int weight = m_weights[contact] = static_cast<unsigned int>(
|
||||
computeContactWeight(*contact)
|
||||
);
|
||||
|
||||
return weight > 0 && (
|
||||
!m_use_connected_filter ||
|
||||
|
|
@ -79,8 +81,8 @@ bool ContactsListProxyModel::lessThan (const QModelIndex &left, const QModelInde
|
|||
sourceModel()->data(right)
|
||||
);
|
||||
|
||||
float weight_a = m_weights[contact_a];
|
||||
float weight_b = m_weights[contact_b];
|
||||
unsigned int weight_a = m_weights[contact_a];
|
||||
unsigned int weight_b = m_weights[contact_b];
|
||||
|
||||
// Sort by weight and name.
|
||||
return (
|
||||
|
|
@ -139,8 +141,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact)
|
|||
);
|
||||
|
||||
// Compute for other addresses.
|
||||
int size = addresses.size();
|
||||
|
||||
float size = static_cast<float>(addresses.size());
|
||||
for (++it; it != addresses.cend(); ++it)
|
||||
weight += computeStringWeight(
|
||||
Utils::linphoneStringToQString((*it)->asString()),
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ private:
|
|||
|
||||
// It's just a cache to save values computed by `filterAcceptsRow`
|
||||
// and reused by `lessThan`.
|
||||
mutable QHash<const ContactModel *, int> m_weights;
|
||||
mutable QHash<const ContactModel *, unsigned int> m_weights;
|
||||
|
||||
bool m_use_connected_filter;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
CoreManager *CoreManager::m_instance = nullptr;
|
||||
|
||||
CoreManager::CoreManager (QObject *parent) : m_core(
|
||||
CoreManager::CoreManager (QObject *parent) : QObject(parent), m_core(
|
||||
linphone::Factory::get()->createCore(nullptr, "", "", nullptr)
|
||||
) {
|
||||
setDatabasesPaths();
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ void TimelineModel::init_entries () {
|
|||
|
||||
// Insert event message in timeline entries.
|
||||
QVariantMap map;
|
||||
map["timestamp"] = QDateTime::fromTime_t(message->getTime());
|
||||
map["timestamp"] = QDateTime::fromMSecsSinceEpoch(
|
||||
static_cast<qint64>(message->getTime()) * 1000
|
||||
);
|
||||
map["sipAddresses"] = Utils::linphoneStringToQString(
|
||||
chat_room->getPeerAddress()->asString()
|
||||
);
|
||||
|
|
@ -104,8 +106,8 @@ void TimelineModel::init_entries () {
|
|||
|
||||
// Make a new map.
|
||||
QVariantMap map;
|
||||
map["timestamp"] = QDateTime::fromTime_t(
|
||||
call_log->getStartDate() + call_log->getDuration()
|
||||
map["timestamp"] = QDateTime::fromMSecsSinceEpoch(
|
||||
static_cast<qint64>(call_log->getStartDate() + call_log->getDuration()) * 1000
|
||||
);
|
||||
map["sipAddresses"] = address;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
// ===================================================================
|
||||
|
||||
namespace Utils {
|
||||
inline QString linphoneStringToQString (const std::string &string) {
|
||||
return QString::fromLocal8Bit(string.c_str(), string.size());
|
||||
return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size()));
|
||||
}
|
||||
|
||||
inline std::string qStringToLinphoneString (const QString &string) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
|
|||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
import LinphoneUtils 1.0
|
||||
import Linphone.Styles 1.0
|
||||
import Utils 1.0
|
||||
|
||||
|
|
@ -39,9 +40,7 @@ Rectangle {
|
|||
Layout.preferredWidth: ContactStyle.contentHeight
|
||||
image: contact.avatar || ''
|
||||
presenceLevel: contact.presenceLevel || Presence.White
|
||||
username: Utils.isString(contact)
|
||||
? contact.substring(4, contact.indexOf('@')) // 4 = length("sip:")
|
||||
: contact.username
|
||||
username: LinphoneUtils.getContactUsername(contact)
|
||||
}
|
||||
|
||||
ContactDescription {
|
||||
|
|
|
|||
|
|
@ -26,44 +26,49 @@ Window {
|
|||
// Calls list.
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
childA: ColumnLayout {
|
||||
childA: Rectangle {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 50
|
||||
color: '#FFFFFF'
|
||||
|
||||
ActionBar {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: 10
|
||||
anchors.left: parent.left
|
||||
iconSize: 30
|
||||
spacing: 16
|
||||
|
||||
ActionButton {
|
||||
icon: 'call'
|
||||
}
|
||||
|
||||
ActionButton {
|
||||
icon: 'conference'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollableListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 1
|
||||
delegate: CallControls {
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
model: callsList
|
||||
}
|
||||
color: 'yellow'
|
||||
}
|
||||
|
||||
/* childA: ColumnLayout { */
|
||||
/* anchors.fill: parent */
|
||||
/* spacing: 0 */
|
||||
|
||||
/* Rectangle { */
|
||||
/* Layout.fillWidth: true */
|
||||
/* Layout.preferredHeight: 50 */
|
||||
/* color: '#FFFFFF' */
|
||||
|
||||
/* ActionBar { */
|
||||
/* anchors.verticalCenter: parent.verticalCenter */
|
||||
/* anchors.leftMargin: 10 */
|
||||
/* anchors.left: parent.left */
|
||||
/* iconSize: 30 */
|
||||
/* spacing: 16 */
|
||||
|
||||
/* ActionButton { */
|
||||
/* icon: 'call' */
|
||||
/* } */
|
||||
|
||||
/* ActionButton { */
|
||||
/* icon: 'conference' */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ScrollableListView { */
|
||||
/* Layout.fillWidth: true */
|
||||
/* Layout.fillHeight: true */
|
||||
/* spacing: 1 */
|
||||
/* delegate: CallControls { */
|
||||
/* width: parent.width */
|
||||
/* } */
|
||||
|
||||
/* model: callsList */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Content.
|
||||
// ---------------------------------------------------------------
|
||||
|
|
@ -78,14 +83,20 @@ Window {
|
|||
resizeAInPriority: true
|
||||
|
||||
// Call.
|
||||
childA: Rectangle {
|
||||
childA: AbstractCall {
|
||||
anchors.fill: parent
|
||||
callTypeLabel: 'INCOMING VIDEO CALL'
|
||||
}
|
||||
|
||||
childB: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: 'green'
|
||||
}
|
||||
|
||||
// Chat.
|
||||
childB: Chat {
|
||||
anchors.fill: parent
|
||||
}
|
||||
//childB: Chat {
|
||||
// anchors.fill: parent
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
Rectangle {
|
||||
property alias callType: callType.text
|
||||
property alias sipAddress: contactDescription.sipAddress
|
||||
property alias username: contactDescription.username
|
||||
property alias avatarImage: image.source
|
||||
|
||||
default property alias _actionArea: actionArea.data
|
||||
|
||||
color: '#EAEAEA'
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
|
||||
spacing: 0
|
||||
|
||||
// Call type.
|
||||
Column {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Text {
|
||||
id: callType
|
||||
|
||||
color: '#8E8E8E'
|
||||
font.bold: true
|
||||
font.pointSize: 17
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
CaterpillarAnimation {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
// Contact area.
|
||||
Item {
|
||||
id: contactContainer
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitHeight: contactDescription.height + image.height
|
||||
width: parent.width
|
||||
|
||||
ContactDescription {
|
||||
id: contactDescription
|
||||
|
||||
height: 60
|
||||
horizontalTextAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
RoundedImage {
|
||||
id: image
|
||||
|
||||
function _computeImageSize () {
|
||||
var height = contactContainer.height - contactDescription.height
|
||||
var width = contactContainer.width
|
||||
|
||||
var size = height < 400 ? height : 400
|
||||
return size < width ? size : width
|
||||
}
|
||||
|
||||
anchors.top: contactDescription.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: _computeImageSize()
|
||||
width: height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions area.
|
||||
Item {
|
||||
id: actionArea
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
|
|||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
import LinphoneUtils 1.0
|
||||
import Utils 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
|
@ -57,9 +58,7 @@ ColumnLayout {
|
|||
Layout.preferredHeight: ConversationStyle.bar.avatarSize
|
||||
Layout.preferredWidth: ConversationStyle.bar.avatarSize
|
||||
presenceLevel: _contact.presenceLevel || Presence.White
|
||||
username: Utils.isString(_contact)
|
||||
? _contact.substring(4, _contact.indexOf('@')) // 4 = length("sip:")
|
||||
: _contact.username
|
||||
username: LinphoneUtils.getContactUsername(_contact)
|
||||
}
|
||||
|
||||
ContactDescription {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue