mirror of https://github.com/procxx/kepka.git
added audio files >> link to profile and media types dropdown
This commit is contained in:
parent
4f3f56f247
commit
4d230eda63
|
@ -416,13 +416,14 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||
"lng_profile_photos_header" = "Photos overview";
|
||||
"lng_profile_videos" = "{count:_not_used_|# video file|# video files} »";
|
||||
"lng_profile_videos_header" = "Video files overview";
|
||||
"lng_profile_songs" = "{count:_not_used_|# audio file|# audio files} »";
|
||||
"lng_profile_songs_header" = "Audio files overview";
|
||||
"lng_profile_files" = "{count:_not_used_|# file|# files} »";
|
||||
"lng_profile_files_header" = "Files overview";
|
||||
"lng_profile_audios" = "{count:_not_used_|# voice message|# voice messages} »";
|
||||
"lng_profile_audios_header" = "Voice messages overview";
|
||||
"lng_profile_shared_links" = "{count:_not_used_|# shared link|# shared links} »";
|
||||
"lng_profile_shared_links_header" = "Shared links overview";
|
||||
"lng_profile_audio_files_header" = "Playlist";
|
||||
"lng_profile_copy_phone" = "Copy phone number";
|
||||
|
||||
"lng_channel_add_admins" = "New administrator";
|
||||
|
@ -523,6 +524,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||
"lng_media_type" = "Media type";
|
||||
"lng_media_type_photos" = "Photos";
|
||||
"lng_media_type_videos" = "Video files";
|
||||
"lng_media_type_songs" = "Audio files";
|
||||
"lng_media_type_files" = "Files";
|
||||
"lng_media_type_audios" = "Voice messages";
|
||||
"lng_media_type_links" = "Shared links";
|
||||
|
|
|
@ -1722,6 +1722,12 @@ dropdownMediaVideos: iconedButton(dropdownMediaPhotos) {
|
|||
icon: sprite(92px, 348px, 24px, 24px);
|
||||
downIcon: sprite(92px, 348px, 24px, 24px);
|
||||
}
|
||||
dropdownMediaSongs: iconedButton(dropdownMediaPhotos) {
|
||||
icon: sprite(60px, 374px, 24px, 26px);
|
||||
downIcon: sprite(60px, 374px, 24px, 26px);
|
||||
iconPos: point(12px, 12px);
|
||||
downIconPos: point(12px, 13px);
|
||||
}
|
||||
dropdownMediaDocuments: iconedButton(dropdownAttachDocument) {
|
||||
width: 200px;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 178 KiB |
Binary file not shown.
Before Width: | Height: | Size: 236 KiB After Width: | Height: | Size: 237 KiB |
|
@ -2841,7 +2841,7 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) {
|
|||
_minh = qMax(thumbh, int32(st::minPhotoSize));
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply || (fwd && fwd->fromForwarded()->isChannel()) || !_caption.isEmpty()) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
if (reply) {
|
||||
_minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
|
@ -2868,7 +2868,7 @@ int32 HistoryPhoto::resize(int32 width, const HistoryItem *parent) {
|
|||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
|
||||
pixw = qMin(width, _maxw);
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply || (fwd && fwd->fromForwarded()->isChannel()) || !_caption.isEmpty()) {
|
||||
pixw -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
|
||||
|
@ -2895,7 +2895,7 @@ int32 HistoryPhoto::resize(int32 width, const HistoryItem *parent) {
|
|||
if (pixh < 1) pixh = 1;
|
||||
w = qMax(pixw, int16(st::minPhotoSize));
|
||||
_height = qMax(pixh, int16(st::minPhotoSize));
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply || (fwd && fwd->fromForwarded()->isChannel()) || !_caption.isEmpty()) {
|
||||
if (reply) {
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else {
|
||||
|
@ -2943,7 +2943,7 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x
|
|||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
int replyFrom = 0, fwdFrom = 0;
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply || (fwd && fwd->fromForwarded()->isChannel()) || !_caption.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
if (reply) {
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
|
@ -2993,7 +2993,7 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x
|
|||
if (x >= skipx && y >= skipy && x < skipx + width && y < skipy + height) {
|
||||
lnk = openl;
|
||||
if (_caption.isEmpty()) {
|
||||
int32 fullRight = skipx + width + (skipx ? st::mediaPadding.right() : 0), fullBottom = _height;
|
||||
int32 fullRight = skipx + width, fullBottom = _height - (skipx ? st::mediaPadding.bottom() : 0);
|
||||
bool inDate = parent->pointInTime(fullRight, fullBottom, x, y, InfoDisplayOverImage);
|
||||
if (inDate) {
|
||||
state = HistoryInDateCursorState;
|
||||
|
@ -3048,7 +3048,7 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
|
||||
if (width < 0) width = w;
|
||||
int skipx = 0, skipy = 0, height = _height;
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply || (fwd && fwd->fromForwarded()->isChannel()) || !_caption.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
|
||||
style::color bg(selected ? (outbg ? st::msgOutSelectBg : st::msgInSelectBg) : (outbg ? st::msgOutBg : st::msgInBg));
|
||||
|
@ -3125,7 +3125,7 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
// date
|
||||
QString time(parent->timeText());
|
||||
if (_caption.isEmpty()) {
|
||||
int32 fullRight = skipx + width + (skipx ? st::mediaPadding.right() : 0), fullBottom = _height;
|
||||
int32 fullRight = skipx + width, fullBottom = _height - (skipx ? st::mediaPadding.bottom() : 0);
|
||||
parent->drawInfo(p, fullRight, fullBottom, selected, InfoDisplayOverImage);
|
||||
} else {
|
||||
p.setPen(st::black->p);
|
||||
|
@ -5918,7 +5918,7 @@ void HistoryImageLink::draw(Painter &p, const HistoryItem *parent, bool selected
|
|||
App::roundRect(p, skipx, skipy, width, height, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
||||
int32 fullRight = skipx + width + (skipx ? st::mediaPadding.right() : 0), fullBottom = _height;
|
||||
int32 fullRight = skipx + width, fullBottom = _height - (skipx ? st::mediaPadding.bottom() : 0);
|
||||
parent->drawInfo(p, fullRight, fullBottom, selected, InfoDisplayOverImage);
|
||||
}
|
||||
|
||||
|
@ -6055,7 +6055,8 @@ void HistoryImageLink::getState(TextLinkPtr &lnk, HistoryCursorState &state, int
|
|||
if (x >= skipx && y >= skipy && x < skipx + width && y < skipy + height && data) {
|
||||
lnk = link;
|
||||
|
||||
bool inDate = parent->pointInTime(skipx + width + (skipx ? st::mediaPadding.right() : 0), _height, x, y, InfoDisplayOverImage);
|
||||
int32 fullRight = skipx + width, fullBottom = _height - (skipx ? st::mediaPadding.bottom() : 0);
|
||||
bool inDate = parent->pointInTime(fullRight, fullBottom, x, y, InfoDisplayOverImage);
|
||||
if (inDate) {
|
||||
state = HistoryInDateCursorState;
|
||||
}
|
||||
|
|
|
@ -117,9 +117,9 @@ enum HistoryMediaType {
|
|||
enum MediaOverviewType {
|
||||
OverviewPhotos,
|
||||
OverviewVideos,
|
||||
OverviewAudioDocuments,
|
||||
OverviewDocuments,
|
||||
OverviewAudios,
|
||||
OverviewAudioDocuments,
|
||||
OverviewLinks,
|
||||
|
||||
OverviewCount
|
||||
|
@ -140,9 +140,9 @@ inline MTPMessagesFilter typeToMediaFilter(MediaOverviewType &type) {
|
|||
switch (type) {
|
||||
case OverviewPhotos: return MTP_inputMessagesFilterPhotos();
|
||||
case OverviewVideos: return MTP_inputMessagesFilterVideo();
|
||||
case OverviewAudioDocuments: return MTP_inputMessagesFilterAudioDocuments();
|
||||
case OverviewDocuments: return MTP_inputMessagesFilterDocument();
|
||||
case OverviewAudios: return MTP_inputMessagesFilterAudio();
|
||||
case OverviewAudioDocuments: return MTP_inputMessagesFilterAudioDocuments();
|
||||
case OverviewLinks: return MTP_inputMessagesFilterUrl();
|
||||
default: type = OverviewCount; break;
|
||||
}
|
||||
|
|
|
@ -1443,6 +1443,7 @@ void MainWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) {
|
|||
switch (i) {
|
||||
case OverviewPhotos: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaPhotos, lang(lng_media_type_photos))), SIGNAL(clicked()), this, SLOT(onPhotosSelect())); break;
|
||||
case OverviewVideos: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaVideos, lang(lng_media_type_videos))), SIGNAL(clicked()), this, SLOT(onVideosSelect())); break;
|
||||
case OverviewAudioDocuments: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaSongs, lang(lng_media_type_songs))), SIGNAL(clicked()), this, SLOT(onSongsSelect())); break;
|
||||
case OverviewDocuments: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaDocuments, lang(lng_media_type_files))), SIGNAL(clicked()), this, SLOT(onDocumentsSelect())); break;
|
||||
case OverviewAudios: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaAudios, lang(lng_media_type_audios))), SIGNAL(clicked()), this, SLOT(onAudiosSelect())); break;
|
||||
case OverviewLinks: connect(_mediaType.addButton(new IconedButton(this, st::dropdownMediaLinks, lang(lng_media_type_links))), SIGNAL(clicked()), this, SLOT(onLinksSelect())); break;
|
||||
|
@ -2488,7 +2489,7 @@ PeerData *MainWidget::overviewPeer() {
|
|||
}
|
||||
|
||||
bool MainWidget::mediaTypeSwitch() {
|
||||
if (!overview || (overview->type() == OverviewAudioDocuments)) return false;
|
||||
if (!overview) return false;
|
||||
|
||||
for (int32 i = 0; i < OverviewCount; ++i) {
|
||||
if (!(_mediaTypeMask & ~(1 << i))) {
|
||||
|
@ -2948,6 +2949,11 @@ void MainWidget::onVideosSelect() {
|
|||
_mediaType.hideStart();
|
||||
}
|
||||
|
||||
void MainWidget::onSongsSelect() {
|
||||
if (overview) overview->switchType(OverviewAudioDocuments);
|
||||
_mediaType.hideStart();
|
||||
}
|
||||
|
||||
void MainWidget::onDocumentsSelect() {
|
||||
if (overview) overview->switchType(OverviewDocuments);
|
||||
_mediaType.hideStart();
|
||||
|
|
|
@ -468,6 +468,7 @@ public slots:
|
|||
|
||||
void onPhotosSelect();
|
||||
void onVideosSelect();
|
||||
void onSongsSelect();
|
||||
void onDocumentsSelect();
|
||||
void onAudiosSelect();
|
||||
void onLinksSelect();
|
||||
|
|
|
@ -2720,9 +2720,9 @@ void OverviewWidget::switchType(MediaOverviewType type) {
|
|||
switch (type) {
|
||||
case OverviewPhotos: _header = lang(lng_profile_photos_header); break;
|
||||
case OverviewVideos: _header = lang(lng_profile_videos_header); break;
|
||||
case OverviewAudioDocuments: _header = lang(lng_profile_songs_header); break;
|
||||
case OverviewDocuments: _header = lang(lng_profile_files_header); break;
|
||||
case OverviewAudios: _header = lang(lng_profile_audios_header); break;
|
||||
case OverviewAudioDocuments: _header = lang(lng_profile_audio_files_header); break;
|
||||
case OverviewLinks: _header = lang(lng_profile_shared_links_header); break;
|
||||
}
|
||||
noSelectingScroll();
|
||||
|
|
|
@ -182,6 +182,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
|||
// shared media
|
||||
connect((_mediaButtons[OverviewPhotos] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaPhotos()));
|
||||
connect((_mediaButtons[OverviewVideos] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaVideos()));
|
||||
connect((_mediaButtons[OverviewAudioDocuments] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaSongs()));
|
||||
connect((_mediaButtons[OverviewDocuments] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaDocuments()));
|
||||
connect((_mediaButtons[OverviewAudios] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaAudios()));
|
||||
connect((_mediaButtons[OverviewLinks] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaLinks()));
|
||||
|
@ -386,6 +387,10 @@ void ProfileInner::onMediaVideos() {
|
|||
App::main()->showMediaOverview(_peer, OverviewVideos);
|
||||
}
|
||||
|
||||
void ProfileInner::onMediaSongs() {
|
||||
App::main()->showMediaOverview(_peer, OverviewAudioDocuments);
|
||||
}
|
||||
|
||||
void ProfileInner::onMediaDocuments() {
|
||||
App::main()->showMediaOverview(_peer, OverviewDocuments);
|
||||
}
|
||||
|
@ -769,8 +774,6 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
|
|||
p.setPen(st::black->p);
|
||||
bool mediaFound = false;
|
||||
for (int i = 0; i < OverviewCount; ++i) {
|
||||
if (i == OverviewAudioDocuments) continue;
|
||||
|
||||
if (!_mediaButtons[i]->isHidden()) {
|
||||
mediaFound = true;
|
||||
top += _mediaButtons[i]->height() + st::setLittleSkip;
|
||||
|
@ -1019,7 +1022,6 @@ bool ProfileInner::updateMediaLinks(int32 *addToScroll) {
|
|||
QPoint p(addToScroll ? mapFromGlobal(QCursor::pos()) : QPoint(0, 0));
|
||||
bool oneWasShown = false;
|
||||
for (int i = 0; i < OverviewCount; ++i) {
|
||||
if (i == OverviewAudioDocuments) continue;
|
||||
if (!_mediaButtons[i]->isHidden()) {
|
||||
oneWasShown = true;
|
||||
break;
|
||||
|
@ -1032,8 +1034,6 @@ bool ProfileInner::updateMediaLinks(int32 *addToScroll) {
|
|||
int32 y = _mediaButtons[OverviewPhotos]->y();
|
||||
if (addToScroll) *addToScroll = 0;
|
||||
for (int i = 0; i < OverviewCount; ++i) {
|
||||
if (i == OverviewAudioDocuments) continue;
|
||||
|
||||
int32 addToY = _mediaButtons[i]->height() + st::setLittleSkip;
|
||||
|
||||
int32 count = (_hist->overviewCount[i] > 0) ? _hist->overviewCount[i] : (_hist->overviewCount[i] == 0 ? _hist->overview[i].size() : -1);
|
||||
|
@ -1168,8 +1168,6 @@ void ProfileInner::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
bool mediaFound = false;
|
||||
for (int i = 0; i < OverviewCount; ++i) {
|
||||
if (i == OverviewAudioDocuments) continue;
|
||||
|
||||
_mediaButtons[i]->move(_left, top);
|
||||
if (!_mediaButtons[i]->isHidden()) {
|
||||
mediaFound = true;
|
||||
|
@ -1516,6 +1514,7 @@ QString ProfileInner::overviewLinkText(int32 type, int32 count) {
|
|||
switch (type) {
|
||||
case OverviewPhotos: return lng_profile_photos(lt_count, count);
|
||||
case OverviewVideos: return lng_profile_videos(lt_count, count);
|
||||
case OverviewAudioDocuments: return lng_profile_songs(lt_count, count);
|
||||
case OverviewDocuments: return lng_profile_files(lt_count, count);
|
||||
case OverviewAudios: return lng_profile_audios(lt_count, count);
|
||||
case OverviewLinks: return lng_profile_shared_links(lt_count, count);
|
||||
|
|
|
@ -100,6 +100,7 @@ public slots:
|
|||
|
||||
void onMediaPhotos();
|
||||
void onMediaVideos();
|
||||
void onMediaSongs();
|
||||
void onMediaDocuments();
|
||||
void onMediaAudios();
|
||||
void onMediaLinks();
|
||||
|
|
Loading…
Reference in New Issue