1
0
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:
tux3 2015-03-04 20:11:53 +01:00
commit 50601b4049
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
4 changed files with 48 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,24 @@ GenericChatForm::GenericChatForm(QWidget *parent)
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
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"));
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
}
void GenericChatForm::previousContact()
{
parent->previousContact();
}
void GenericChatForm::nextContact()
{
parent->nextContact();
}
bool GenericChatForm::isEmpty()
{
return chatWidget->isEmpty();
@ -322,6 +336,11 @@ void GenericChatForm::addSystemInfoMessage(const QString &message, ChatMessage::
insertChatMessage(ChatMessage::createChatInfoMessage(message, type, datetime));
}
void GenericChatForm::clearChatArea()
{
clearChatArea(true);
}
void GenericChatForm::clearChatArea(bool notinform)
{
chatWidget->clear();

View File

@ -34,6 +34,7 @@ class CroppingLabel;
class ChatTextEdit;
class ChatLog;
class MaskablePixmapWidget;
class Widget;
struct ToxID;
namespace Ui {
@ -73,13 +74,17 @@ protected slots:
void onSaveLogClicked();
void onCopyLogClicked();
void clearChatArea(bool);
void clearChatArea();
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

@ -710,6 +710,7 @@ void Widget::onFriendUsernameChanged(int friendId, const QString& username)
void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
{
qDebug() << "active chat";
hideMainForms();
widget->setChatForm(*ui);
if (activeChatroomWidget != nullptr)
@ -1209,3 +1210,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);
@ -142,7 +144,7 @@ private slots:
private:
void hideMainForms();
virtual bool event(QEvent * e);
Group* createGroup(int groupId);
Group *createGroup(int groupId);
void removeFriend(Friend* f, bool fake = false);
void removeGroup(Group* g, bool fake = false);
void saveWindowGeometry();
@ -157,17 +159,17 @@ private:
Ui::MainWindow *ui;
QSplitter *centralLayout;
QPoint dragPosition;
AddFriendForm* addFriendForm;
SettingsWidget* settingsWidget;
FilesForm* filesForm;
static Widget* instance;
GenericChatroomWidget* activeChatroomWidget;
FriendListWidget* contactListWidget;
MaskablePixmapWidget* profilePicture;
AddFriendForm *addFriendForm;
SettingsWidget *settingsWidget;
FilesForm *filesForm;
static Widget *instance;
GenericChatroomWidget *activeChatroomWidget;
FriendListWidget *contactListWidget;
MaskablePixmapWidget *profilePicture;
bool notify(QObject *receiver, QEvent *event);
bool autoAwayActive = false;
Status beforeDisconnect = Status::Offline;
QTimer* timer, *offlineMsgTimer;
QTimer *timer, *offlineMsgTimer;
QTranslator* translator;
QRegExp nameMention, sanitizedNameMention;
bool eventFlag;