mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 06:55:58 +00:00
Divide structs into several data/ modules.
This commit is contained in:
@@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "overview/overview_layout.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "styles/style_overview.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "core/file_utilities.h"
|
||||
@@ -75,6 +76,16 @@ void ItemBase::clickHandlerPressedChanged(const ClickHandlerPtr &action, bool pr
|
||||
Ui::repaintHistoryItem(_parent);
|
||||
}
|
||||
|
||||
void RadialProgressItem::setDocumentLinks(DocumentData *document) {
|
||||
ClickHandlerPtr save;
|
||||
if (document->voice()) {
|
||||
save.reset(new DocumentOpenClickHandler(document));
|
||||
} else {
|
||||
save.reset(new DocumentSaveClickHandler(document));
|
||||
}
|
||||
setLinks(MakeShared<DocumentOpenClickHandler>(document), std::move(save), MakeShared<DocumentCancelClickHandler>(document));
|
||||
}
|
||||
|
||||
void RadialProgressItem::clickHandlerActiveChanged(const ClickHandlerPtr &action, bool active) {
|
||||
ItemBase::clickHandlerActiveChanged(action, active);
|
||||
if (action == _openl || action == _savel || action == _cancell) {
|
||||
@@ -461,6 +472,21 @@ void Video::invalidateCache() {
|
||||
_check->invalidateCache();
|
||||
}
|
||||
}
|
||||
float64 Video::dataProgress() const {
|
||||
return _data->progress();
|
||||
}
|
||||
|
||||
bool Video::dataFinished() const {
|
||||
return !_data->loading();
|
||||
}
|
||||
|
||||
bool Video::dataLoaded() const {
|
||||
return _data->loaded();
|
||||
}
|
||||
|
||||
bool Video::iconAnimated() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Video::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoint point) const {
|
||||
bool loaded = _data->loaded();
|
||||
@@ -642,6 +668,22 @@ void Voice::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoint p
|
||||
}
|
||||
}
|
||||
|
||||
float64 Voice::dataProgress() const {
|
||||
return _data->progress();
|
||||
}
|
||||
|
||||
bool Voice::dataFinished() const {
|
||||
return !_data->loading();
|
||||
}
|
||||
|
||||
bool Voice::dataLoaded() const {
|
||||
return _data->loaded();
|
||||
}
|
||||
|
||||
bool Voice::iconAnimated() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Voice::updateName() {
|
||||
auto version = 0;
|
||||
if (auto forwarded = _parent->Get<HistoryMessageForwarded>()) {
|
||||
@@ -937,6 +979,30 @@ void Document::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoin
|
||||
}
|
||||
}
|
||||
|
||||
float64 Document::dataProgress() const {
|
||||
return _data->progress();
|
||||
}
|
||||
|
||||
bool Document::dataFinished() const {
|
||||
return !_data->loading();
|
||||
}
|
||||
|
||||
bool Document::dataLoaded() const {
|
||||
return _data->loaded();
|
||||
}
|
||||
|
||||
bool Document::iconAnimated() const {
|
||||
return _data->song() || !_data->loaded() || (_radial && _radial->animating());
|
||||
}
|
||||
|
||||
bool Document::withThumb() const {
|
||||
return !_data->song()
|
||||
&& !_data->thumb->isNull()
|
||||
&& _data->thumb->width()
|
||||
&& _data->thumb->height()
|
||||
&& !documentIsExecutableName(_data->name);
|
||||
}
|
||||
|
||||
bool Document::updateStatusText() {
|
||||
bool showPause = false;
|
||||
int32 statusSize = 0, realDuration = 0;
|
||||
|
Reference in New Issue
Block a user