Move locationhelper, linemodel and mediasizehelper to Timeline
This commit is contained in:
@@ -25,6 +25,7 @@ private Q_SLOTS:
|
||||
void MediaSizeHelperTest::uninitialized()
|
||||
{
|
||||
MediaSizeHelper mediasizehelper;
|
||||
mediasizehelper.setMaxSize(540, 540);
|
||||
QCOMPARE(mediasizehelper.currentSize(), QSize(540, qRound(qreal(NeoChatConfig::self()->mediaMaxWidth()) / qreal(16.0) * qreal(9.0))));
|
||||
}
|
||||
|
||||
@@ -60,6 +61,7 @@ void MediaSizeHelperTest::limits()
|
||||
QFETCH(QSize, currentSize);
|
||||
|
||||
MediaSizeHelper mediasizehelper;
|
||||
mediasizehelper.setMaxSize(540, 540);
|
||||
mediasizehelper.setMediaWidth(mediaWidth);
|
||||
mediasizehelper.setMediaHeight(mediaHeight);
|
||||
mediasizehelper.setContentMaxWidth(contentMaxWidth);
|
||||
|
||||
@@ -67,19 +67,13 @@ add_library(neochat STATIC
|
||||
models/livelocationsmodel.h
|
||||
models/locationsmodel.cpp
|
||||
models/locationsmodel.h
|
||||
locationhelper.cpp
|
||||
locationhelper.h
|
||||
registration.cpp
|
||||
jobs/neochatgetcommonroomsjob.cpp
|
||||
jobs/neochatgetcommonroomsjob.h
|
||||
mediasizehelper.cpp
|
||||
mediasizehelper.h
|
||||
models/notificationsmodel.cpp
|
||||
models/notificationsmodel.h
|
||||
proxycontroller.cpp
|
||||
proxycontroller.h
|
||||
models/linemodel.cpp
|
||||
models/linemodel.h
|
||||
enums/neochatroomtype.h
|
||||
models/sortfilterroomtreemodel.cpp
|
||||
models/sortfilterroomtreemodel.h
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <Quotient/qt_connection_util.h>
|
||||
#include <Quotient/settings.h>
|
||||
|
||||
#include "mediasizehelper.h"
|
||||
#include "models/actionsmodel.h"
|
||||
#include "models/messagemodel.h"
|
||||
#include "models/pushrulemodel.h"
|
||||
@@ -92,6 +93,14 @@ Controller::Controller(QObject *parent)
|
||||
return false;
|
||||
});
|
||||
|
||||
MediaSizeHelper::setMaxSize(NeoChatConfig::mediaMaxWidth(), NeoChatConfig::mediaMaxHeight());
|
||||
connect(NeoChatConfig::self(), &NeoChatConfig::MediaMaxWidthChanged, this, []() {
|
||||
MediaSizeHelper::setMaxSize(NeoChatConfig::mediaMaxWidth(), NeoChatConfig::mediaMaxHeight());
|
||||
});
|
||||
connect(NeoChatConfig::self(), &NeoChatConfig::MediaMaxHeightChanged, this, []() {
|
||||
MediaSizeHelper::setMaxSize(NeoChatConfig::mediaMaxWidth(), NeoChatConfig::mediaMaxHeight());
|
||||
});
|
||||
|
||||
ProxyController::instance().setApplicationProxy();
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
|
||||
@@ -56,11 +56,14 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE
|
||||
VideoComponent.qml
|
||||
SOURCES
|
||||
contentprovider.cpp
|
||||
locationhelper.cpp
|
||||
mediasizehelper.cpp
|
||||
messageattached.cpp
|
||||
pollhandler.cpp
|
||||
timelinedelegate.cpp
|
||||
enums/delegatetype.h
|
||||
models/itinerarymodel.cpp
|
||||
models/linemodel.cpp
|
||||
models/mediamessagefiltermodel.cpp
|
||||
models/messagecontentmodel.cpp
|
||||
models/messagecontentfiltermodel.cpp
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
#include "mediasizehelper.h"
|
||||
|
||||
#include "neochatconfig.h"
|
||||
int MediaSizeHelper::m_mediaMaxWidth = 0;
|
||||
int MediaSizeHelper::m_mediaMaxHeight = 0;
|
||||
|
||||
MediaSizeHelper::MediaSizeHelper(QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -128,17 +129,17 @@ bool MediaSizeHelper::limitWidth() const
|
||||
qreal MediaSizeHelper::widthLimit() const
|
||||
{
|
||||
if (m_contentMaxWidth < 0.0) {
|
||||
return NeoChatConfig::self()->mediaMaxWidth();
|
||||
return m_mediaMaxWidth;
|
||||
}
|
||||
return std::min(m_contentMaxWidth, qreal(NeoChatConfig::self()->mediaMaxWidth()));
|
||||
return std::min(m_contentMaxWidth, qreal(m_mediaMaxWidth));
|
||||
}
|
||||
|
||||
qreal MediaSizeHelper::heightLimit() const
|
||||
{
|
||||
if (m_contentMaxHeight < 0.0) {
|
||||
return NeoChatConfig::self()->mediaMaxHeight();
|
||||
return m_mediaMaxHeight;
|
||||
}
|
||||
return std::min(m_contentMaxHeight, qreal(NeoChatConfig::self()->mediaMaxHeight()));
|
||||
return std::min(m_contentMaxHeight, qreal(m_mediaMaxHeight));
|
||||
}
|
||||
|
||||
QSize MediaSizeHelper::currentSize() const
|
||||
@@ -160,4 +161,10 @@ QSize MediaSizeHelper::currentSize() const
|
||||
}
|
||||
}
|
||||
|
||||
void MediaSizeHelper::setMaxSize(int width, int height)
|
||||
{
|
||||
MediaSizeHelper::m_mediaMaxWidth = width;
|
||||
MediaSizeHelper::m_mediaMaxHeight = height;
|
||||
}
|
||||
|
||||
#include "moc_mediasizehelper.cpp"
|
||||
@@ -83,6 +83,8 @@ public:
|
||||
|
||||
QSize currentSize() const;
|
||||
|
||||
static void setMaxSize(int width, int height);
|
||||
|
||||
Q_SIGNALS:
|
||||
void contentMaxWidthChanged();
|
||||
void contentMaxHeightChanged();
|
||||
@@ -102,4 +104,7 @@ private:
|
||||
bool limitWidth() const;
|
||||
qreal widthLimit() const;
|
||||
qreal heightLimit() const;
|
||||
|
||||
static int m_mediaMaxWidth;
|
||||
static int m_mediaMaxHeight;
|
||||
};
|
||||
Reference in New Issue
Block a user