alt-up and alt-down scroll through dialogs, fixed compile on windows

This commit is contained in:
John Preston 2015-01-28 16:29:01 +03:00
parent 89ce0ce1e2
commit 1c2289f2ce
3 changed files with 23 additions and 9 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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);