Merge pull request #3054 from huffman/19723

Code Review for Job #19723
This commit is contained in:
Clément Brisset 2014-06-22 16:37:02 -07:00
commit 1992f624ad
3 changed files with 15 additions and 1 deletions

View file

@ -1293,6 +1293,7 @@ void Menu::showChat() {
if (_chatWindow->isHidden()) { if (_chatWindow->isHidden()) {
_chatWindow->show(); _chatWindow->show();
} }
_chatWindow->activateWindow();
} else { } else {
Application::getInstance()->getTrayIcon()->showMessage("Interface", "You need to login to be able to chat with others on this domain."); Application::getInstance()->getTrayIcon()->showMessage("Interface", "You need to login to be able to chat with others on this domain.");
} }

View file

@ -30,6 +30,9 @@
const int NUM_MESSAGES_TO_TIME_STAMP = 20; const int NUM_MESSAGES_TO_TIME_STAMP = 20;
const float OPACITY_ACTIVE = 1.0;
const float OPACITY_INACTIVE = 0.8;
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?)|(?:hifi))://\\S+)"); const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?)|(?:hifi))://\\S+)");
const QRegularExpression regexHifiLinks("([#@]\\S+)"); const QRegularExpression regexHifiLinks("([#@]\\S+)");
const QString mentionSoundsPath("/mention-sounds/"); const QString mentionSoundsPath("/mention-sounds/");
@ -108,7 +111,7 @@ ChatWindow::~ChatWindow() {
void ChatWindow::keyPressEvent(QKeyEvent* event) { void ChatWindow::keyPressEvent(QKeyEvent* event) {
if (event->key() == Qt::Key_Escape) { if (event->key() == Qt::Key_Escape) {
hide(); Application::getInstance()->getWindow()->activateWindow();
} else { } else {
FramelessDialog::keyPressEvent(event); FramelessDialog::keyPressEvent(event);
} }
@ -383,3 +386,12 @@ void ChatWindow::scrollToBottom() {
QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar();
verticalScrollBar->setValue(verticalScrollBar->maximum()); verticalScrollBar->setValue(verticalScrollBar->maximum());
} }
bool ChatWindow::event(QEvent* event) {
if (event->type() == QEvent::WindowActivate) {
setWindowOpacity(OPACITY_ACTIVE);
} else if (event->type() == QEvent::WindowDeactivate) {
setWindowOpacity(OPACITY_INACTIVE);
}
return FramelessDialog::event(event);
}

View file

@ -50,6 +50,7 @@ protected:
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
virtual void showEvent(QShowEvent* event); virtual void showEvent(QShowEvent* event);
virtual bool event(QEvent* event);
private: private:
#ifdef HAVE_QXMPP #ifdef HAVE_QXMPP