Commit d9ea3df1 authored by scuq's avatar scuq

more blinking

parent 9c69a3f4
Pipeline #369 passed with stage
in 1 minute and 7 seconds
......@@ -100,7 +100,9 @@ void dialogChat::setUnread()
this->m_unreadBlinkTimer->start((int)this->m_unreadBlinkInterval);
qApp->alert(this);
}
void dialogChat::setRead()
......@@ -339,6 +341,13 @@ void dialogChat::slChannelPosted(const QJsonDocument &replyJson, const QString &
QString dialogChat::formatChannelUser(const QString &username)
{
QString style = QString("color=\"rgb(%1, %2, %3)\"").arg( this->getColorChatNick().red(), this->getColorChatNick().green(), this->getColorChatNick().blue() );
qDebug() << this->getColorChatNick();
//QString style = "background: rgb(%1, %2, %3);";
// style = style.arg(colorChannel.red()).arg(colorChannel.green()).arg(colorChannel.blue());
QString formatedUsername;
//formatedUsername = QString("< %1 >").arg(username);
......@@ -347,7 +356,7 @@ formatedUsername = username;
// formatedUsername = username.rightJustified(this->longestUsernameLen+1, ' ', false);
formatedUsername.replace(" ","&nbsp;");
formatedUsername += "> ";
formatedUsername.prepend("<font color=\"DeepPink\">");
formatedUsername.prepend(QString("<font %1>").arg(style));
formatedUsername.append("</font>");
return formatedUsername;
}
......@@ -475,7 +484,8 @@ void dialogChat::insertText(QString datetime, QString text, QString usernamestr)
QRegExp regExp("((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@\\.\\w]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)");
QRegExp regExp("((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@()\\.\\w]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)");
QString textout;
......@@ -484,7 +494,7 @@ void dialogChat::insertText(QString datetime, QString text, QString usernamestr)
int datewidth = fm.averageCharWidth() *1.4 * datetime.length() ;
text.replace(regExp, "<a href='\\1'>\\1</a>");
textout = QString("<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\" width=\"100%\">" \
" <tr>" \
......@@ -495,7 +505,7 @@ void dialogChat::insertText(QString datetime, QString text, QString usernamestr)
"</table>" \
).arg(
datetime,
text,
text.toHtmlEscaped().replace("\n","<br>").replace(regExp, "<a href='\\1'>\\1</a>"),
usernamestr,
QString::number(this->longestUsernameLen),
QString::number(datewidth)
......@@ -668,6 +678,7 @@ void dialogChat::slChatSettingsChanged(QMap<QString, QVariant> chatsettings)
this->setChatFont( qvariant_cast<QFont>(chatsettings.value("chat_font")) );
this->setChatDateTimeFormat(chatsettings.value("chat_datetimeformat").toString());
this->setColorChatLink(QColor::fromRgba((unsigned)chatsettings.value("chat_color_link").toInt()));
this->setColorChatNick(QColor::fromRgba((unsigned)chatsettings.value("chat_color_nick").toInt()));
}
......@@ -753,6 +764,16 @@ void dialogChat::slOnBlinkTimerRefresh()
}
QColor dialogChat::getColorChatNick() const
{
return m_colorchatnick;
}
void dialogChat::setColorChatNick(const QColor &colorchatnick)
{
m_colorchatnick = colorchatnick;
}
QFont dialogChat::getChatFontInternal() const
{
return chatFont;
......
......@@ -54,6 +54,9 @@ public:
QFont getChatFontInternal() const;
void setChatFontInternal(QFont font);
QColor getColorChatNick() const;
void setColorChatNick(const QColor &colorchatnick);
private slots:
void on_plainTextEditChatInput_textChanged();
//void slChannelPostsReceived(const QJsonDocument &replyJson, const QString &channelid);
......@@ -73,6 +76,7 @@ private slots:
signals:
void siOnRead(QString channelid);
private:
Ui::dialogChat *ui;
ImSession *session;
......@@ -81,6 +85,7 @@ private:
manipulator *m_mp;
account *m_account;
QColor m_colorchatlink;
QColor m_colorchatnick;
int historicMsgPrintCount;
QFont chatFont;
QMap<QString, ImContact*> m_contacts;
......
......@@ -6,13 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
<width>1020</width>
<height>524</height>
<width>649</width>
<height>521</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="windowIcon">
<iconset resource="res.qrc">
<normaloff>:/images/aic.png</normaloff>:/images/aic.png</iconset>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
......@@ -34,8 +38,17 @@
<property name="spacing">
<number>1</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QTextBrowser" name="textBrowserChatOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
......@@ -56,7 +69,7 @@
<item>
<widget class="QPlainTextEdit" name="plainTextEditChatInput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -70,7 +83,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
<height>40</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
......@@ -88,6 +101,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="res.qrc"/>
</resources>
<connections/>
</ui>
......@@ -100,6 +100,20 @@ void DialogPreferences::loadThemes()
}
QColor DialogPreferences::getColorChatNick() const
{
return colorChatNick;
}
void DialogPreferences::setColorChatNick(const QColor &value)
{
colorChatNick = value;
QString style = "background: rgb(%1, %2, %3);";
style = style.arg(colorChatNick.red()).arg(colorChatNick.green()).arg(colorChatNick.blue());
this->ui->labelColorChatNickSample->setStyleSheet(style);
}
QColor DialogPreferences::getColorUnread2() const
{
return colorUnread2;
......@@ -457,6 +471,8 @@ void DialogPreferences::slChatSettingsChanged(QMap<QString, QVariant> chatSettin
this->setColorChatLink( QColor::fromRgba((unsigned)chatSettings.value("chat_color_link").toInt()) );
this->setColorChatNick( QColor::fromRgba((unsigned)chatSettings.value("chat_color_nick").toInt()) );
}
......@@ -557,3 +573,13 @@ void DialogPreferences::on_pushButtonChooseUnreadcolor2_clicked()
this->m_mp->setGlobalColorUnread2(unsigned(color.rgba()));
}
}
void DialogPreferences::on_pushButtonChooseChatnickcolor_clicked()
{
QColor color = QColorDialog::getColor(this->getColorChatNick(), this );
if ( color.isValid() )
{
this->setColorChatNick(color);
this->m_mp->setChatColorNick(unsigned(color.rgba()));
}
}
......@@ -84,6 +84,9 @@ public:
QColor getColorUnread2() const;
void setColorUnread2(const QColor &value);
QColor getColorChatNick() const;
void setColorChatNick(const QColor &value);
private slots:
......@@ -145,6 +148,8 @@ private slots:
void on_pushButtonChooseUnreadcolor2_clicked();
void on_pushButtonChooseChatnickcolor_clicked();
private:
Ui::DialogPreferences *ui;
manipulator *m_mp;
......@@ -159,6 +164,7 @@ private:
QColor colorUnread2;
QColor colorChannel;
QColor colorChatLink;
QColor colorChatNick;
QFont chatFont;
QString chatDateTimeFormat;
QFont rosterFont;
......
......@@ -30,9 +30,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-564</y>
<width>444</width>
<height>1058</height>
<height>1106</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -80,62 +80,129 @@
<string>Roster</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnminimumwidth="0,10,100">
<item row="9" column="0">
<widget class="QLabel" name="labelUnreadColor">
<item row="22" column="0">
<widget class="QLabel" name="labelHideOffline">
<property name="text">
<string>Unread color</string>
<string>Hide &quot;Offline&quot;</string>
</property>
</widget>
</item>
<item row="21" column="2">
<widget class="QCheckBox" name="checkBoxHideStatusText">
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonChooseAwaycolor">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
<item row="20" column="2">
<widget class="QComboBox" name="comboBoxChannelShape">
<item>
<property name="text">
<string>Triangle</string>
</property>
</item>
<item>
<property name="text">
<string>Ellipse</string>
</property>
</item>
<item>
<property name="text">
<string>Rectangle</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelRosterStatusShapeBaseSize">
<property name="text">
<string>Shape base size</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelColorChannelSample">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="22" column="0">
<item row="0" column="0">
<widget class="QLabel" name="labelRosterStatusShape">
<property name="text">
<string>Roster status shape</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="labelUnreadColor">
<property name="text">
<string>Unread color</string>
</property>
</widget>
</item>
<item row="24" column="0">
<widget class="QLabel" name="labelRosterFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QTextEdit" name="textEditRosterSample">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user1&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user2&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<item row="12" column="2">
<widget class="QPushButton" name="pushButtonChooseUnreadcolor2">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelColorChannelSample">
<item row="1" column="2">
<widget class="QSpinBox" name="spinBoxStatusShapeBaseSize">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelAwayColor">
<property name="text">
<string/>
<string>Away color</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelColorAwaySample">
<item row="11" column="0">
<widget class="QLabel" name="labelUnreadColor2">
<property name="text">
<string/>
<string>Unread color 2</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButtonChooseOfflinecolor">
<item row="14" column="2">
<widget class="QPushButton" name="pushButtonChooseChannelcolor">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
<item row="19" column="2">
<item row="25" column="0">
<widget class="QTextEdit" name="textEditRosterSample">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user1&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user2&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;user3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="21" column="2">
<widget class="QSpinBox" name="spinBoxChannelShapeBaseSize">
<property name="minimum">
<number>5</number>
......@@ -148,10 +215,17 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelOnlineColor">
<item row="13" column="0">
<widget class="QLabel" name="labelChannelColor">
<property name="text">
<string>Online Color</string>
<string>Channel color</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButtonChooseOfflinecolor">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
......@@ -174,20 +248,6 @@ p, li { white-space: pre-wrap; }
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelRosterStatusShape">
<property name="text">
<string>Roster status shape</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelOfflineColor">
<property name="text">
<string>Offline color</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelColorOfflineSample">
<property name="text">
......@@ -195,58 +255,20 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="labelChannelShapeBaseSize">
<property name="text">
<string>Shape base size</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelColorOnlineSample">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<item row="6" column="0">
<widget class="QLabel" name="labelColorAwaySample">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="20" column="2">
<widget class="QCheckBox" name="checkBoxHideOffline">
<item row="23" column="2">
<widget class="QCheckBox" name="checkBoxHideStatusText">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelChannelColor">
<property name="text">
<string>Channel color</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="labelHideOffline">
<property name="text">
<string>Hide &quot;Offline&quot;</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonChooseOnlinecolor">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="labelUnreadColor2">
<property name="text">
<string>Unread color 2</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QPushButton" name="pushButtonChooseUnreadcolor">
<property name="text">
......@@ -254,14 +276,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelAwayColor">
<property name="text">
<string>Away color</string>
</property>
</widget>
</item>
<item row="23" column="1">
<item row="25" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -274,63 +289,48 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonChooseAwaycolor">
<item row="23" column="0">
<widget class="QLabel" name="labelHideStatusText">
<property name="text">
<string>Choose ...</string>
<string>Hide &quot;Status Text&quot;</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QPushButton" name="pushButtonChooseChannelcolor">
<item row="25" column="2">
<widget class="QPushButton" name="pushButtonRosterFont">
<property name="text">
<string>Choose ...</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBoxStatusShapeBaseSize">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>30</number>
<item row="3" column="0">
<widget class="QLabel" name="labelColorOnlineSample">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="singleStep">
<number>5</number>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="18" column="2">
<widget class="QComboBox" name="comboBoxChannelShape">
<item>
<property name="text">
<string>Triangle</string>
</property>
</item>
<item>
<property name="text">
<string>Ellipse</string>
</property>
</item>
<item>
<property name="text">
<string>Rectangle</string>
</property>
</item>
<item row="20" column="0">
<widget class="QLabel" name="labelChannelShape">
<property name="text">
<string>Channel shape</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelRosterStatusShapeBaseSize">
<item row="22" column="2">
<widget class="QCheckBox" name="checkBoxHideOffline">
<property name="text">
<string>Shape base size</string>
<string/>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="labelHideStatusText">
<item row="2" column="0">
<widget class="QLabel" name="labelOnlineColor">
<property name="text">
<string>Hide &quot;Status Text&quot;</string>
<string>Online Color</string>
</property>
</widget>
</item>
......@@ -341,29 +341,29 @@ p, li { white-space: pre-wrap; }
</property>