diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-08-21 18:32:25 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-08-21 18:38:00 (GMT) |
commit | 6dc34a78b9e392b7a089dc4ec5100b0061fd88eb (patch) | |
tree | afca700aa53736e18e095d2a1592777812e3ab4b /Swift/QtUI/QtChatWindow.cpp | |
parent | 8d6a78665b79a382dc1871852ed7bd150263db79 (diff) | |
download | swift-contrib-6dc34a78b9e392b7a089dc4ec5100b0061fd88eb.zip swift-contrib-6dc34a78b9e392b7a089dc4ec5100b0061fd88eb.tar.bz2 |
Colour alert messages.
Resolves: #964
Resolves: #966
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index c7a6fa8..d7ffc65 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -37,35 +37,37 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt unreadCount_ = 0; inputEnabled_ = true; completer_ = NULL; theme_ = theme; isCorrection_ = false; correctionEnabled_ = Maybe; updateTitleWithUnreadCount(); QtSettingsProvider settings; + alertStyleSheet_ = "background: rgb(255, 255, 153); color: black"; + QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(2); alertWidget_ = new QWidget(this); QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget_); layout->addWidget(alertWidget_); alertLabel_ = new QLabel(this); alertLayout->addWidget(alertLabel_); alertButton_ = new QPushButton(this); connect (alertButton_, SIGNAL(clicked()), this, SLOT(handleAlertButtonClicked())); alertLayout->addWidget(alertButton_); QPalette palette = alertWidget_->palette(); palette.setColor(QPalette::Window, QColor(Qt::yellow)); palette.setColor(QPalette::WindowText, QColor(Qt::black)); - alertWidget_->setPalette(palette); - alertLabel_->setPalette(palette); + alertWidget_->setStyleSheet(alertStyleSheet_); + alertLabel_->setStyleSheet(alertStyleSheet_); alertWidget_->hide(); logRosterSplitter_ = new QSplitter(this); logRosterSplitter_->setAutoFillBackground(true); layout->addWidget(logRosterSplitter_); messageLog_ = new QtChatView(theme, this); logRosterSplitter_->addWidget(messageLog_); treeWidget_ = new QtTreeWidget(eventStream_); @@ -108,18 +110,20 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt connect(input_, SIGNAL(textChanged()), this, SLOT(handleInputChanged())); setFocusProxy(input_); logRosterSplitter_->setFocusProxy(input_); midBar->setFocusProxy(input_); messageLog_->setFocusProxy(input_); connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(qAppFocusChanged(QWidget*, QWidget*))); connect(messageLog_, SIGNAL(gotFocus()), input_, SLOT(setFocus())); resize(400,300); connect(messageLog_, SIGNAL(fontResized(int)), this, SIGNAL(fontResized(int))); + + } QtChatWindow::~QtChatWindow() { } void QtChatWindow::handleFontResized(int fontSizeSteps) { messageLog_->resizeFont(fontSizeSteps); @@ -188,27 +192,29 @@ void QtChatWindow::beginCorrection() { setAlert(Q2PSTRING(tr("This chat does not support message correction. If you send a correction anyway, it will appear as a duplicate message"))); } QTextCursor cursor = input_->textCursor(); cursor.select(QTextCursor::Document); cursor.beginEditBlock(); cursor.insertText(QString(lastSentMessage_)); cursor.endEditBlock(); isCorrection_ = true; correctingLabel_->show(); + input_->setStyleSheet(alertStyleSheet_); } void QtChatWindow::cancelCorrection() { cancelAlert(); QTextCursor cursor = input_->textCursor(); cursor.select(QTextCursor::Document); cursor.removeSelectedText(); isCorrection_ = false; correctingLabel_->hide(); + input_->setStyleSheet(qApp->styleSheet()); } QByteArray QtChatWindow::getSplitterState() { return logRosterSplitter_->saveState(); } void QtChatWindow::handleChangeSplitterState(QByteArray state) { logRosterSplitter_->restoreState(state); } |