1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

keyboard shortcut to change current chat

This commit is contained in:
agilob 2015-02-27 17:56:47 +00:00
parent 337bf0cd2b
commit 2ec1bd0977
No known key found for this signature in database
GPG Key ID: 34568050DBCCB997
4 changed files with 41 additions and 10 deletions

View File

@ -20,6 +20,7 @@
#include <QFileDialog>
#include <QHBoxLayout>
#include <QDebug>
#include <QShortcut>
#include "src/misc/smileypack.h"
#include "src/widget/emoticonswidget.h"
@ -42,7 +43,6 @@ GenericChatForm::GenericChatForm(QWidget *parent)
, audioOutputFlag(false)
{
curRow = 0;
headWidget = new QWidget();
nameLabel = new CroppingLabel();
@ -169,10 +169,23 @@ GenericChatForm::GenericChatForm(QWidget *parent)
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
connect(chatWidget, &ChatLog::customContextMenuRequested, this, &GenericChatForm::onChatContextMenuRequested);
new QShortcut(QKeySequence(Qt::Key_PageUp), this, SLOT(previousContact()));
new QShortcut(QKeySequence(Qt::Key_PageDown), this, SLOT(nextContact()));
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
}
void GenericChatForm::previousContact()
{
parent->previousContact();
}
void GenericChatForm::nextContact()
{
parent->nextContact();
}
bool GenericChatForm::isEmpty()
{
return chatWidget->isEmpty();

View File

@ -34,6 +34,7 @@ class CroppingLabel;
class ChatTextEdit;
class ChatLog;
class MaskablePixmapWidget;
class Widget;
struct ToxID;
namespace Ui {
@ -74,12 +75,15 @@ protected slots:
void onCopyLogClicked();
void clearChatArea(bool);
void onSelectAllClicked();
void previousContact();
void nextContact();
protected:
QString resolveToxID(const ToxID &id);
void insertChatMessage(ChatMessage::Ptr msg);
ToxID previousId;
Widget *parent;
QMenu menu;
int curRow;
CroppingLabel *nameLabel;

View File

@ -746,6 +746,7 @@ void Widget::onFriendUsernameChanged(int friendId, const QString& username)
void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
{
qDebug() << "active chat";
hideMainForms();
widget->setChatForm(*ui);
if (activeChatroomWidget != nullptr)
@ -1197,3 +1198,14 @@ void Widget::reloadTheme()
for (Group* g : GroupList::getAllGroups())
g->getGroupWidget()->reloadTheme();
}
void Widget::nextContact()
{
// dont know how to get current/previous/next contact from friendlistwidget
qDebug() << "next contact";
}
void Widget::previousContact()
{
qDebug() << "previous contact";
}

View File

@ -104,6 +104,8 @@ public slots:
void onGroupTitleChanged(int groupnumber, const QString& author, const QString& title);
void playRingtone();
void onFriendTypingChanged(int friendId, bool isTyping);
void nextContact();
void previousContact();
signals:
void friendRequestAccepted(const QString& userId);