mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr1303'
This commit is contained in:
commit
50601b4049
|
@ -20,6 +20,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
#include "src/misc/smileypack.h"
|
#include "src/misc/smileypack.h"
|
||||||
#include "src/widget/emoticonswidget.h"
|
#include "src/widget/emoticonswidget.h"
|
||||||
|
@ -42,7 +43,6 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
, audioOutputFlag(false)
|
, audioOutputFlag(false)
|
||||||
{
|
{
|
||||||
curRow = 0;
|
curRow = 0;
|
||||||
|
|
||||||
headWidget = new QWidget();
|
headWidget = new QWidget();
|
||||||
|
|
||||||
nameLabel = new CroppingLabel();
|
nameLabel = new CroppingLabel();
|
||||||
|
@ -169,10 +169,24 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
|
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
|
||||||
connect(chatWidget, &ChatLog::customContextMenuRequested, this, &GenericChatForm::onChatContextMenuRequested);
|
connect(chatWidget, &ChatLog::customContextMenuRequested, this, &GenericChatForm::onChatContextMenuRequested);
|
||||||
|
|
||||||
|
new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact()));
|
||||||
|
new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact()));
|
||||||
|
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L, this, SLOT(clearChatArea()));
|
||||||
|
|
||||||
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
|
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
|
||||||
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
|
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::previousContact()
|
||||||
|
{
|
||||||
|
parent->previousContact();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::nextContact()
|
||||||
|
{
|
||||||
|
parent->nextContact();
|
||||||
|
}
|
||||||
|
|
||||||
bool GenericChatForm::isEmpty()
|
bool GenericChatForm::isEmpty()
|
||||||
{
|
{
|
||||||
return chatWidget->isEmpty();
|
return chatWidget->isEmpty();
|
||||||
|
@ -322,6 +336,11 @@ void GenericChatForm::addSystemInfoMessage(const QString &message, ChatMessage::
|
||||||
insertChatMessage(ChatMessage::createChatInfoMessage(message, type, datetime));
|
insertChatMessage(ChatMessage::createChatInfoMessage(message, type, datetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::clearChatArea()
|
||||||
|
{
|
||||||
|
clearChatArea(true);
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::clearChatArea(bool notinform)
|
void GenericChatForm::clearChatArea(bool notinform)
|
||||||
{
|
{
|
||||||
chatWidget->clear();
|
chatWidget->clear();
|
||||||
|
|
|
@ -34,6 +34,7 @@ class CroppingLabel;
|
||||||
class ChatTextEdit;
|
class ChatTextEdit;
|
||||||
class ChatLog;
|
class ChatLog;
|
||||||
class MaskablePixmapWidget;
|
class MaskablePixmapWidget;
|
||||||
|
class Widget;
|
||||||
struct ToxID;
|
struct ToxID;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -73,13 +74,17 @@ protected slots:
|
||||||
void onSaveLogClicked();
|
void onSaveLogClicked();
|
||||||
void onCopyLogClicked();
|
void onCopyLogClicked();
|
||||||
void clearChatArea(bool);
|
void clearChatArea(bool);
|
||||||
|
void clearChatArea();
|
||||||
void onSelectAllClicked();
|
void onSelectAllClicked();
|
||||||
|
void previousContact();
|
||||||
|
void nextContact();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString resolveToxID(const ToxID &id);
|
QString resolveToxID(const ToxID &id);
|
||||||
void insertChatMessage(ChatMessage::Ptr msg);
|
void insertChatMessage(ChatMessage::Ptr msg);
|
||||||
|
|
||||||
ToxID previousId;
|
ToxID previousId;
|
||||||
|
Widget *parent;
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
int curRow;
|
int curRow;
|
||||||
CroppingLabel *nameLabel;
|
CroppingLabel *nameLabel;
|
||||||
|
|
|
@ -710,6 +710,7 @@ void Widget::onFriendUsernameChanged(int friendId, const QString& username)
|
||||||
|
|
||||||
void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
|
void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
|
||||||
{
|
{
|
||||||
|
qDebug() << "active chat";
|
||||||
hideMainForms();
|
hideMainForms();
|
||||||
widget->setChatForm(*ui);
|
widget->setChatForm(*ui);
|
||||||
if (activeChatroomWidget != nullptr)
|
if (activeChatroomWidget != nullptr)
|
||||||
|
@ -1209,3 +1210,14 @@ void Widget::reloadTheme()
|
||||||
for (Group* g : GroupList::getAllGroups())
|
for (Group* g : GroupList::getAllGroups())
|
||||||
g->getGroupWidget()->reloadTheme();
|
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";
|
||||||
|
}
|
||||||
|
|
|
@ -104,6 +104,8 @@ public slots:
|
||||||
void onGroupTitleChanged(int groupnumber, const QString& author, const QString& title);
|
void onGroupTitleChanged(int groupnumber, const QString& author, const QString& title);
|
||||||
void playRingtone();
|
void playRingtone();
|
||||||
void onFriendTypingChanged(int friendId, bool isTyping);
|
void onFriendTypingChanged(int friendId, bool isTyping);
|
||||||
|
void nextContact();
|
||||||
|
void previousContact();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendRequestAccepted(const QString& userId);
|
void friendRequestAccepted(const QString& userId);
|
||||||
|
@ -142,7 +144,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void hideMainForms();
|
void hideMainForms();
|
||||||
virtual bool event(QEvent * e);
|
virtual bool event(QEvent * e);
|
||||||
Group* createGroup(int groupId);
|
Group *createGroup(int groupId);
|
||||||
void removeFriend(Friend* f, bool fake = false);
|
void removeFriend(Friend* f, bool fake = false);
|
||||||
void removeGroup(Group* g, bool fake = false);
|
void removeGroup(Group* g, bool fake = false);
|
||||||
void saveWindowGeometry();
|
void saveWindowGeometry();
|
||||||
|
@ -157,17 +159,17 @@ private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QSplitter *centralLayout;
|
QSplitter *centralLayout;
|
||||||
QPoint dragPosition;
|
QPoint dragPosition;
|
||||||
AddFriendForm* addFriendForm;
|
AddFriendForm *addFriendForm;
|
||||||
SettingsWidget* settingsWidget;
|
SettingsWidget *settingsWidget;
|
||||||
FilesForm* filesForm;
|
FilesForm *filesForm;
|
||||||
static Widget* instance;
|
static Widget *instance;
|
||||||
GenericChatroomWidget* activeChatroomWidget;
|
GenericChatroomWidget *activeChatroomWidget;
|
||||||
FriendListWidget* contactListWidget;
|
FriendListWidget *contactListWidget;
|
||||||
MaskablePixmapWidget* profilePicture;
|
MaskablePixmapWidget *profilePicture;
|
||||||
bool notify(QObject *receiver, QEvent *event);
|
bool notify(QObject *receiver, QEvent *event);
|
||||||
bool autoAwayActive = false;
|
bool autoAwayActive = false;
|
||||||
Status beforeDisconnect = Status::Offline;
|
Status beforeDisconnect = Status::Offline;
|
||||||
QTimer* timer, *offlineMsgTimer;
|
QTimer *timer, *offlineMsgTimer;
|
||||||
QTranslator* translator;
|
QTranslator* translator;
|
||||||
QRegExp nameMention, sanitizedNameMention;
|
QRegExp nameMention, sanitizedNameMention;
|
||||||
bool eventFlag;
|
bool eventFlag;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user