Port away from KDeclarative
This commit is contained in:
@@ -9,7 +9,6 @@ import Qt.labs.platform 1.1 as Platform
|
||||
import QtMultimedia 5.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.kcoreaddons 1.0 as KCA
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
import NeoChat.Component 1.0
|
||||
@@ -56,7 +55,7 @@ Control {
|
||||
}
|
||||
|
||||
Label {
|
||||
text: KCA.Format.formatDuration(audio.position) + "/" + KCA.Format.formatDuration(audio.duration)
|
||||
text: Controller.formatDuration(audio.position) + "/" + Controller.formatDuration(audio.duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import QtGraphicalEffects 1.15
|
||||
import Qt.labs.platform 1.1
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.kcoreaddons 1.0 as KCA
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
import NeoChat.Component 1.0
|
||||
@@ -43,7 +42,7 @@ RowLayout {
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: !progressInfo.completed && progressInfo.active ? (KCA.Format.formatByteSize(progressInfo.progress) + "/" + KCA.Format.formatByteSize(progressInfo.total)) : KCA.Format.formatByteSize(content.info ? content.info.size : 0)
|
||||
text: !progressInfo.completed && progressInfo.active ? (Controller.formatByteSize(progressInfo.progress) + "/" + Controller.formatByteSize(progressInfo.total)) : Controller.formatByteSize(content.info ? content.info.size : 0)
|
||||
color: Kirigami.Theme.disabledTextColor
|
||||
wrapMode: Label.Wrap
|
||||
}
|
||||
|
||||
@@ -591,3 +591,13 @@ void Controller::joinRoom(const QString &alias)
|
||||
Q_EMIT errorOccured(joinRoomJob->roomId());
|
||||
});
|
||||
}
|
||||
|
||||
QString Controller::formatByteSize(double size, int precision) const
|
||||
{
|
||||
return KFormat().formatByteSize(size, precision);
|
||||
}
|
||||
|
||||
QString Controller::formatDuration(quint64 msecs, KFormat::DurationFormatOptions options) const
|
||||
{
|
||||
return KFormat().formatDuration(msecs, options);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QObject>
|
||||
|
||||
#include <KAboutData>
|
||||
#include <KFormat>
|
||||
|
||||
class QKeySequences;
|
||||
class QNetworkConfigurationManager;
|
||||
|
||||
@@ -81,6 +83,9 @@ public:
|
||||
Q_INVOKABLE void joinRoom(const QString &alias);
|
||||
|
||||
bool isOnline() const;
|
||||
|
||||
Q_INVOKABLE QString formatDuration(quint64 msecs, KFormat::DurationFormatOptions options = KFormat::DefaultDuration) const;
|
||||
Q_INVOKABLE QString formatByteSize(double size, int precision = 1) const;
|
||||
private:
|
||||
explicit Controller(QObject *parent = nullptr);
|
||||
~Controller() override;
|
||||
|
||||
Reference in New Issue
Block a user