Styles improved. Members dropdown is shown with a delay.

Overview of chat photos fixed. Tray icon tries read a file on Linux.
This commit is contained in:
John Preston 2016-06-21 17:19:24 +03:00
parent d001ec346d
commit c73b5a6da4
12 changed files with 117 additions and 40 deletions

View File

@ -55,13 +55,15 @@ wndMinWidth: 380px;
adaptiveNormalWidth: 640px;
adaptiveWideWidth: 1366px;
windowBg: #fff; // fallback for background: white
windowBg: #ffffff; // fallback for background: white
windowActiveBg: #40ace3; // fallback for blue filled active areas
windowTextFg: #000; // fallback for text color: black
windowTextFg: #000000; // fallback for text color: black
windowSubTextFg: #8a8a8a; // fallback for subtext color: gray
windowSubTextFgOver: #7c99b2; // fallback for subtext over color: gray over blue bg
windowActiveTextFg: #1485c2; // fallback for active color: blue online
windowShadowFg: #000; // fallback for shadow color
windowShadowFg: #000000; // fallback for shadow color
semiboldButtonBlueText: #2b99d5;
wndMinHeight: 480px;
wndDefWidth: 800px;
@ -1260,14 +1262,14 @@ msgFileThumbPadding: margins(10px, 10px, 14px, 10px);
msgFileThumbNameTop: 12px;
msgFileThumbStatusTop: 32px;
msgFileThumbLinkTop: 60px;
msgFileThumbLinkInFg: #3da5e0;
msgFileThumbLinkInFgSelected: #3da5e0;
msgFileThumbLinkInFg: semiboldButtonBlueText;
msgFileThumbLinkInFgSelected: semiboldButtonBlueText;
msgFileThumbLinkOutFg: #5eba5b;
msgFileThumbLinkOutFgSelected: #31a298;
msgFileNameTop: 16px;
msgFileStatusTop: 37px;
msgFileMinWidth: 294px;
msgFileInBg: #59b6eb;
msgFileInBg: windowActiveBg;
msgFileInBgOver: #4eade3;
msgFileInBgSelected: #51a3d3;
msgFileOutBg: #78c67f;
@ -1313,7 +1315,7 @@ msgWaveformBar: 2px;
msgWaveformSkip: 1px;
msgWaveformMin: 2px;
msgWaveformMax: 20px;
msgWaveformInActive: #59b6eb;
msgWaveformInActive: windowActiveBg;
msgWaveformInActiveSelected: #51a3d3;
msgWaveformInInactive: #d4dee6;
msgWaveformInInactiveSelected: #9cc1e1;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 524 B

View File

@ -23,8 +23,8 @@ using "basic_types.style";
dialogsUnreadFg: #ffffff;
dialogsUnreadFgActive: #5b94bf;
dialogsUnreadBg: #009ce6;//#6fc766;
dialogsUnreadBgMuted: #bbb;
dialogsUnreadBg: windowActiveBg;
dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadBgActive: #ffffff;
dialogsUnreadBgMutedActive: #d3e2ee;
dialogsUnreadFont: font(12px bold);

View File

@ -3053,6 +3053,9 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_animActiveTimer.setSingleShot(false);
connect(&_animActiveTimer, SIGNAL(timeout()), this, SLOT(onAnimActiveStep()));
_membersDropdownShowTimer.setSingleShot(true);
connect(&_membersDropdownShowTimer, SIGNAL(timeout()), this, SLOT(onMembersDropdownShow()));
_saveDraftTimer.setSingleShot(true);
connect(&_saveDraftTimer, SIGNAL(timeout()), this, SLOT(onDraftSave()));
_saveCloudDraftTimer.setSingleShot(true);
@ -3958,6 +3961,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_previewCache.clear();
_fieldBarCancel.hide();
_membersDropdownShowTimer.stop();
if (_list) _list->deleteLater();
_list = nullptr;
_scroll.takeWidget();
@ -6025,22 +6029,33 @@ QRect HistoryWidget::getMembersShowAreaGeometry() const {
}
void HistoryWidget::setMembersShowAreaActive(bool active) {
if (!active) {
_membersDropdownShowTimer.stop();
}
if (active && _peer && (_peer->isChat() || _peer->isMegagroup())) {
if (!_membersDropdown) {
_membersDropdown = new Ui::InnerDropdown(this, st::membersInnerDropdown, st::membersInnerScroll);
_membersDropdown->setOwnedWidget(new Profile::MembersWidget(_membersDropdown, _peer, Profile::MembersWidget::TitleVisibility::Hidden));
_membersDropdown->resize(st::membersInnerWidth, _membersDropdown->height());
_membersDropdown->setMaxHeight(countMembersDropdownHeightMax());
_membersDropdown->moveToLeft(0, 0);
connect(_membersDropdown, SIGNAL(hidden()), this, SLOT(onMembersDropdownHidden()));
if (_membersDropdown) {
_membersDropdown->otherEnter();
} else if (!_membersDropdownShowTimer.isActive()) {
_membersDropdownShowTimer.start(300);
}
_membersDropdown->otherEnter();
} else if (_membersDropdown) {
_membersDropdown->otherLeave();
}
}
void HistoryWidget::onMembersDropdownShow() {
if (!_membersDropdown) {
_membersDropdown = new Ui::InnerDropdown(this, st::membersInnerDropdown, st::membersInnerScroll);
_membersDropdown->setOwnedWidget(new Profile::MembersWidget(_membersDropdown, _peer, Profile::MembersWidget::TitleVisibility::Hidden));
_membersDropdown->resize(st::membersInnerWidth, _membersDropdown->height());
_membersDropdown->setMaxHeight(countMembersDropdownHeightMax());
_membersDropdown->moveToLeft(0, 0);
connect(_membersDropdown, SIGNAL(hidden()), this, SLOT(onMembersDropdownHidden()));
}
_membersDropdown->otherEnter();
}
void HistoryWidget::onMembersDropdownHidden() {
_membersDropdown.destroyDelayed();
}

View File

@ -843,6 +843,7 @@ private slots:
void onMentionInsert(UserData *user);
void onInlineBotCancel();
void onMembersDropdownHidden();
void onMembersDropdownShow();
void updateField();
@ -1106,6 +1107,7 @@ private:
BotKeyboard _keyboard;
ChildWidget<Ui::InnerDropdown> _membersDropdown = { nullptr };
QTimer _membersDropdownShowTimer;
Dropdown _attachType;
EmojiPan _emojiPan;

View File

@ -1280,7 +1280,8 @@ void MainWidget::preloadOverviews(PeerData *peer) {
History *h = App::history(peer->id);
bool sending = false;
for (int32 i = 0; i < OverviewCount; ++i) {
if (preloadOverview(peer, MediaOverviewType(i))) {
auto type = MediaOverviewType(i);
if (type != OverviewChatPhotos && preloadOverview(peer, type)) {
sending = true;
}
}

View File

@ -160,6 +160,14 @@ void MediaView::moveToScreen() {
void MediaView::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) {
if (!_photo && !_doc) return;
if (_photo && _overview == OverviewChatPhotos && _history && !_history->peer->isUser()) {
auto lastChatPhoto = computeLastOverviewChatPhoto();
if (_index < 0 && _photo == lastChatPhoto.photo && _photo == _additionalChatPhoto) {
return showPhoto(_photo, lastChatPhoto.item);
}
computeAdditionalChatPhoto(_history->peer, lastChatPhoto.photo);
}
if (_history && (_history->peer == peer || (_migrated && _migrated->peer == peer)) && type == _overview && _msgid) {
_index = -1;
if (_msgmigrated) {
@ -332,8 +340,8 @@ void MediaView::updateControls() {
(_msgmigrated && _migrated && _migrated->overview[_overview].size() < _migrated->overviewCount(_overview)) ||
(!_msgmigrated && _history && _migrated && (!_migrated->overview[_overview].isEmpty() || _migrated->overviewCount(_overview) > 0)))) ||
(_index < 0 && _photo == _additionalChatPhoto &&
((_history && !_history->overview[_overview].isEmpty()) ||
(_migrated && _history->overviewLoaded(_overview) && !_migrated->overview[_overview].isEmpty()))
((_history && _history->overviewCount(_overview) > 0) ||
(_migrated && _history->overviewLoaded(_overview) && _migrated->overviewCount(_overview) > 0))
);
_rightNavVisible = (_index >= 0) && (
(!_msgmigrated && _history && _index + 1 < _history->overview[_overview].size()) ||
@ -828,6 +836,7 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) {
computeAdditionalChatPhoto(_history->peer, lastChatPhoto.photo);
if (_additionalChatPhoto == _photo) {
_overview = OverviewChatPhotos;
findCurrent();
} else {
_additionalChatPhoto = nullptr;
_history = _migrated = nullptr;
@ -1508,6 +1517,10 @@ bool MediaView::moveToNext(int32 delta) {
stopGif();
displayPhoto(lastChatPhoto.photo, lastChatPhoto.item); preloadData(delta);
return true;
} else if (_history && (_history->overviewCount(OverviewChatPhotos) != 0 || (
_migrated && _migrated->overviewCount(OverviewChatPhotos) != 0))) {
loadBack();
return true;
}
}
return false;
@ -2069,7 +2082,12 @@ void MediaView::findCurrent() {
}
void MediaView::loadBack() {
if (_loadRequest || _index < 0 || (_overview == OverviewCount && !_user)) return;
if (_loadRequest || (_overview == OverviewCount && !_user)) {
return;
}
if (_index < 0 && (!_additionalChatPhoto || _photo != _additionalChatPhoto || !_history)) {
return;
}
if (_history && _overview != OverviewCount && (!_history->overviewLoaded(_overview) || (_migrated && !_migrated->overviewLoaded(_overview)))) {
if (App::main()) {
@ -2168,6 +2186,8 @@ void MediaView::updateHeader() {
int32 index = _index, count = 0, addcount = (_migrated && _overview != OverviewCount) ? _migrated->overviewCount(_overview) : 0;
if (_history) {
if (_overview != OverviewCount) {
bool lastOverviewPhotoLoaded = (!_history->overview[_overview].isEmpty() || (
_migrated && _history->overviewCount(_overview) == 0 && !_migrated->overview[_overview].isEmpty()));
count = _history->overviewCount(_overview);
if (addcount >= 0 && count >= 0) {
count += addcount;
@ -2178,10 +2198,10 @@ void MediaView::updateHeader() {
} else {
index += count - _history->overview[_overview].size();
}
if (_additionalChatPhoto) {
if (_additionalChatPhoto && lastOverviewPhotoLoaded) {
++count;
}
} else if (index < 0 && _additionalChatPhoto && _photo == _additionalChatPhoto) {
} else if (index < 0 && _additionalChatPhoto && _photo == _additionalChatPhoto && lastOverviewPhotoLoaded) {
// Additional chat photo (not in the list => place it at the end of the list).
index = count;
++count;

View File

@ -105,6 +105,8 @@ f_gdk_init_check gdk_init_check = nullptr;
f_gdk_pixbuf_new_from_data gdk_pixbuf_new_from_data = nullptr;
f_gtk_status_icon_new_from_pixbuf gtk_status_icon_new_from_pixbuf = nullptr;
f_gtk_status_icon_set_from_pixbuf gtk_status_icon_set_from_pixbuf = nullptr;
f_gtk_status_icon_new_from_file gtk_status_icon_new_from_file = nullptr;
f_gtk_status_icon_set_from_file gtk_status_icon_set_from_file = nullptr;
f_gtk_status_icon_set_title gtk_status_icon_set_title = nullptr;
f_gtk_status_icon_set_tooltip_text gtk_status_icon_set_tooltip_text = nullptr;
f_gtk_status_icon_set_visible gtk_status_icon_set_visible = nullptr;
@ -157,6 +159,8 @@ void start() {
load(lib_gtk, "gdk_pixbuf_new_from_data", gdk_pixbuf_new_from_data);
load(lib_gtk, "gtk_status_icon_new_from_pixbuf", gtk_status_icon_new_from_pixbuf);
load(lib_gtk, "gtk_status_icon_set_from_pixbuf", gtk_status_icon_set_from_pixbuf);
load(lib_gtk, "gtk_status_icon_new_from_file", gtk_status_icon_new_from_file);
load(lib_gtk, "gtk_status_icon_set_from_file", gtk_status_icon_set_from_file);
load(lib_gtk, "gtk_status_icon_set_title", gtk_status_icon_set_title);
load(lib_gtk, "gtk_status_icon_set_tooltip_text", gtk_status_icon_set_tooltip_text);
load(lib_gtk, "gtk_status_icon_set_visible", gtk_status_icon_set_visible);

View File

@ -128,6 +128,12 @@ extern f_gtk_status_icon_new_from_pixbuf gtk_status_icon_new_from_pixbuf;
typedef void (*f_gtk_status_icon_set_from_pixbuf)(GtkStatusIcon *status_icon, GdkPixbuf *pixbuf);
extern f_gtk_status_icon_set_from_pixbuf gtk_status_icon_set_from_pixbuf;
typedef GtkStatusIcon* (*f_gtk_status_icon_new_from_file)(const gchar *filename);
extern f_gtk_status_icon_new_from_file gtk_status_icon_new_from_file;
typedef void (*f_gtk_status_icon_set_from_file)(GtkStatusIcon *status_icon, const gchar *filename);
extern f_gtk_status_icon_set_from_file gtk_status_icon_set_from_file;
typedef void (*f_gtk_status_icon_set_title)(GtkStatusIcon *status_icon, const gchar *title);
extern f_gtk_status_icon_set_title gtk_status_icon_set_title;

View File

@ -248,9 +248,16 @@ void MainWindow::psSetupTrayIcon() {
if (!trayIcon) {
trayIcon = new QSystemTrayIcon(this);
QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));
QIcon icon;
QFileInfo f(_trayIconImageFile());
if (f.exists()) {
QByteArray path = QFile::encodeName(f.absoluteFilePath());
icon = QIcon(path.constData());
} else {
icon = QIcon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));
}
trayIcon->setIcon(icon);
trayIcon->setToolTip(str_const_toString(AppName));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
@ -329,18 +336,30 @@ void MainWindow::psUpdateCounter() {
_psUpdateIndicatorTimer.start(100);
}
} else if (useStatusIcon && trayIconChecked) {
loadPixbuf(_trayIconImageGen());
Libs::gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf);
QFileInfo iconFile(_trayIconImageFile());
if (iconFile.exists()) {
QByteArray path = QFile::encodeName(f.absoluteFilePath());
Libs::gtk_status_icon_set_from_file(_trayIcon, path.constData());
} else {
loadPixbuf(_trayIconImageGen());
Libs::gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf);
}
}
} else if (trayIcon) {
int32 counter = App::histories().unreadBadge();
bool muted = App::histories().unreadOnlyMuted();
QIcon icon;
QFileInfo f(_trayIconImageFile());
if (f.exists()) {
QByteArray path = QFile::encodeName(f.absoluteFilePath());
icon = QIcon(path.constData());
} else {
int32 counter = App::histories().unreadBadge();
bool muted = App::histories().unreadOnlyMuted();
style::color bg = muted ? st::counterMuteBG : st::counterBG;
QIcon iconSmall;
iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly));
iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly));
trayIcon->setIcon(iconSmall);
style::color bg = muted ? st::counterMuteBG : st::counterBG;
icon.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly));
icon.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly));
}
trayIcon->setIcon(icon);
}
}
@ -382,6 +401,8 @@ void MainWindow::LibsLoaded() {
&& (Libs::gdk_pixbuf_new_from_data != nullptr)
&& (Libs::gtk_status_icon_new_from_pixbuf != nullptr)
&& (Libs::gtk_status_icon_set_from_pixbuf != nullptr)
&& (Libs::gtk_status_icon_new_from_file != nullptr)
&& (Libs::gtk_status_icon_set_from_file != nullptr)
&& (Libs::gtk_status_icon_set_title != nullptr)
&& (Libs::gtk_status_icon_set_tooltip_text != nullptr)
&& (Libs::gtk_status_icon_set_visible != nullptr)
@ -532,8 +553,14 @@ void MainWindow::psCreateTrayIcon() {
if (Libs::gdk_init_check(0, 0)) {
if (!_trayMenu) _trayMenu = Libs::gtk_menu_new();
if (_trayMenu) {
loadPixbuf(_trayIconImageGen());
_trayIcon = Libs::gtk_status_icon_new_from_pixbuf(_trayPixbuf);
QFileInfo iconFile(_trayIconImageFile());
if (iconFile.exists()) {
QByteArray path = QFile::encodeName(iconFile.absoluteFilePath());
_trayIcon = Libs::gtk_status_icon_new_from_file(path.constData());
} else {
loadPixbuf(_trayIconImageGen());
_trayIcon = Libs::gtk_status_icon_new_from_pixbuf(_trayPixbuf);
}
if (_trayIcon) {
Libs::g_signal_connect_helper(_trayIcon, "popup-menu", GCallback(_trayIconPopup), _trayMenu);
Libs::g_signal_connect_helper(_trayIcon, "activate", GCallback(_trayIconActivate), _trayMenu);

View File

@ -77,8 +77,8 @@ profilePrimaryButton: BoxButton {
duration: 200;
}
profileSecondaryButton: BoxButton(profilePrimaryButton) {
textFg: #2b99d5;
textFgOver: #2b99d5;
textFg: semiboldButtonBlueText;
textFgOver: semiboldButtonBlueText;
textBg: #ffffff;
textBgOver: #f2f7fa;
}
@ -157,7 +157,7 @@ profileMemberStatusFg: windowSubTextFg;
profileMemberStatusFgOver: windowSubTextFgOver;
profileMemberStatusFgActive: windowActiveTextFg;
profileMemberAdminIcon: icon {
{ "profile_admin_star", #3babe7, point(4px, 2px) },
{ "profile_admin_star", #3babe7, point(4px, 3px) },
};
profileLimitReachedLabel: flatLabel(labelDefFlat) {
width: 180px;