Skip to content

Commit

Permalink
alt-up and alt-down scroll through dialogs, fixed compile on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jan 28, 2015
1 parent 89ce0ce commit 1c2289f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/gui/flattextarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,10 @@ void FlatTextarea::keyPressEvent(QKeyEvent *e) {
if (tc == textCursor()) {
bool check = false;
if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Up) {
tc.movePosition(QTextCursor::Start);
tc.movePosition(QTextCursor::Start, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
check = true;
} else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down) {
tc.movePosition(QTextCursor::End);
tc.movePosition(QTextCursor::End, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
check = true;
}
if (check) {
Expand Down
18 changes: 16 additions & 2 deletions Telegram/SourceFiles/historywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3384,9 +3384,23 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
_scroll.scrollToY(_scroll.scrollTop() - _scroll.height());
}
} else if (e->key() == Qt::Key_Down) {
_scroll.scrollToY(_scroll.scrollTop() + _scroll.height() / 10);
if (e->modifiers() & Qt::AltModifier) {
PeerData *after = 0;
MsgId afterMsgId = 0;
App::main()->peerAfter(histPeer, hist ? hist->activeMsgId : 0, after, afterMsgId);
if (after) App::main()->showPeer(after->id, afterMsgId);
} else if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
_scroll.scrollToY(_scroll.scrollTop() + _scroll.height() / 10);
}
} else if (e->key() == Qt::Key_Up) {
_scroll.scrollToY(_scroll.scrollTop() - _scroll.height() / 10);
if (e->modifiers() & Qt::AltModifier) {
PeerData *before = 0;
MsgId beforeMsgId = 0;
App::main()->peerBefore(histPeer, hist ? hist->activeMsgId : 0, before, beforeMsgId);
if (before) App::main()->showPeer(before->id, beforeMsgId);
} else if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
_scroll.scrollToY(_scroll.scrollTop() - _scroll.height() / 10);
}
} else if ((e->key() == Qt::Key_Tab || e->key() == Qt::Key_Backtab) && ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::MetaModifier))) {
PeerData *p = 0;
MsgId m = 0;
Expand Down
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ int gNotifyDefaultDelay = 1500;
int gOtherOnline = 0;

void settingsParseArgs(int argc, char *argv[]) {
if (cPlatform() == dbipMac) {
gCustomNotifies = (QSysInfo::macVersion() < QSysInfo::MV_10_8);
} else {
gCustomNotifies = true;
}
#ifdef Q_OS_MAC
gCustomNotifies = (QSysInfo::macVersion() < QSysInfo::MV_10_8);
#else
gCustomNotifies = true;
#endif
memset_rand(&gInstance, sizeof(gInstance));
gExeDir = psCurrentExeDirectory(argc, argv);
gExeName = psCurrentExeName(argc, argv);
Expand Down

0 comments on commit 1c2289f

Please sign in to comment.