2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

version 0.6.16 - document/video paths storage, username not found box support, download/upload sessions stop/resume

This commit is contained in:
John Preston
2014-12-05 16:44:27 +03:00
parent e91f93bfed
commit a7a43e4031
26 changed files with 504 additions and 145 deletions

View File

@@ -516,6 +516,11 @@ void VideoCancelLink::onClick(Qt::MouseButton button) const {
data->cancel();
}
VideoData::VideoData(const VideoId &id, const uint64 &access, int32 user, int32 date, int32 duration, int32 w, int32 h, const ImagePtr &thumb, int32 dc, int32 size) :
id(id), access(access), user(user), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), fileType(0), openOnSave(0), openOnSaveMsgId(0), loader(0) {
location = Local::readFileLocation(mediaKey(mtpc_inputVideoFileLocation, dc, id));
}
void VideoData::save(const QString &toFile) {
cancel(true);
loader = new mtpFileLoader(dc, id, access, mtpc_inputVideoFileLocation, toFile, size);
@@ -524,6 +529,12 @@ void VideoData::save(const QString &toFile) {
loader->start();
}
QString VideoData::already(bool check) {
if (!check) return location.name;
if (!location.check()) location = Local::readFileLocation(mediaKey(mtpc_inputVideoFileLocation, dc, id));
return location.name;
}
void AudioOpenLink::onClick(Qt::MouseButton button) const {
AudioData *data = audio();
if ((!data->user && !data->date) || button != Qt::LeftButton) return;
@@ -591,6 +602,11 @@ void AudioCancelLink::onClick(Qt::MouseButton button) const {
data->cancel();
}
AudioData::AudioData(const AudioId &id, const uint64 &access, int32 user, int32 date, int32 duration, int32 dc, int32 size) :
id(id), access(access), user(user), date(date), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0) {
location = Local::readFileLocation(mediaKey(mtpc_inputAudioFileLocation, dc, id));
}
void AudioData::save(const QString &toFile) {
cancel(true);
loader = new mtpFileLoader(dc, id, access, mtpc_inputAudioFileLocation, toFile, size, (size < AudioVoiceMsgInMemory));
@@ -599,6 +615,12 @@ void AudioData::save(const QString &toFile) {
loader->start();
}
QString AudioData::already(bool check) {
if (!check) return location.name;
if (!location.check()) location = Local::readFileLocation(mediaKey(mtpc_inputAudioFileLocation, dc, id));
return location.name;
}
void DocumentOpenLink::onClick(Qt::MouseButton button) const {
DocumentData *data = document();
if ((!data->user && !data->date) || button != Qt::LeftButton) return;
@@ -694,6 +716,11 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const {
data->cancel();
}
DocumentData::DocumentData(const DocumentId &id, const uint64 &access, int32 user, int32 date, const QString &name, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) :
id(id), access(access), user(user), date(date), name(name), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0) {
location = Local::readFileLocation(mediaKey(mtpc_inputDocumentFileLocation, dc, id));
}
void DocumentData::save(const QString &toFile) {
cancel(true);
loader = new mtpFileLoader(dc, id, access, mtpc_inputDocumentFileLocation, toFile, size);
@@ -702,6 +729,12 @@ void DocumentData::save(const QString &toFile) {
loader->start();
}
QString DocumentData::already(bool check) {
if (!check) return location.name;
if (!location.check()) location = Local::readFileLocation(mediaKey(mtpc_inputDocumentFileLocation, dc, id));
return location.name;
}
void PeerLink::onClick(Qt::MouseButton button) const {
if (button == Qt::LeftButton && App::main()) {
App::main()->showPeerProfile(peer());
@@ -4089,6 +4122,7 @@ void HistoryMessage::drawInDialog(QPainter &p, const QRect &r, bool act, const H
p.setFont(st::dlgHistFont->f);
p.setPen((act ? st::dlgActiveColor : (_media ? st::dlgSystemColor : st::dlgTextColor))->p);
cache.drawElided(p, r.left(), r.top(), r.width(), r.height() / st::dlgHistFont->height);
textstyleRestore();
}
}