History

Merge remote-tracking branch 'upstream/master' into 19765

Mohammed Nafees committed 12 years ago

Commit d5d21072 parents 7271f85 c38790d28 files · +882 −153Browse files

Showing the changes to interface/src/ui/ChatWindow.cpp (1 of 28 files). Show all

Unified · Split

interface/src/ui/ChatWindow.cpp+13−1
@@ -30,6 +30,9 @@ · 29 unmodified lines
3030
3131 const int NUM_MESSAGES_TO_TIME_STAMP = 20;
3232
33+const float OPACITY_ACTIVE = 1.0;
34+const float OPACITY_INACTIVE = 0.8;
35+
3336 const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?)|(?:hifi))://\\S+)");
3437 const QRegularExpression regexHifiLinks("([#@]\\S+)");
3538 const QString mentionSoundsPath("/mention-sounds/");
@@ -108,7 +111,7 @@ ChatWindow::~ChatWindow() { · 72 unmodified lines
108111
109112 void ChatWindow::keyPressEvent(QKeyEvent* event) {
110113 if (event->key() == Qt::Key_Escape) {
111− hide();
114+ Application::getInstance()->getWindow()->activateWindow();
112115 } else {
113116 FramelessDialog::keyPressEvent(event);
114117 }
@@ -383,3 +386,12 @@ void ChatWindow::scrollToBottom() { · 268 unmodified lines
383386 QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar();
384387 verticalScrollBar->setValue(verticalScrollBar->maximum());
385388 }
389+
390+bool ChatWindow::event(QEvent* event) {
391+ if (event->type() == QEvent::WindowActivate) {
392+ setWindowOpacity(OPACITY_ACTIVE);
393+ } else if (event->type() == QEvent::WindowDeactivate) {
394+ setWindowOpacity(OPACITY_INACTIVE);
395+ }
396+ return FramelessDialog::event(event);
397+}