Text message improvements

* css (text message style sheet)
* settings/send to group boxes NOT checked at beginning
* qss
* string concat with %
This commit is contained in:
Klaus Basan
2019-01-19 18:03:54 +01:00
committed by Mat Sutcliffe
parent 77e642d42d
commit 27b9c5e8c8
5 changed files with 20 additions and 55 deletions

View File

@@ -107,6 +107,10 @@ namespace BlackGui
if (!myself || !sGui || sGui->isShuttingDown()) { return; } if (!myself || !sGui || sGui->isShuttingDown()) { return; }
this->onSettingsChanged(); this->onSettingsChanged();
this->onChangedAircraftCockpit(); this->onChangedAircraftCockpit();
// hde for the beginning
ui->gb_Settings->setChecked(false);
ui->gb_MessageTo->setChecked(false);
}); });
} }
@@ -397,6 +401,7 @@ namespace BlackGui
if (w) { return w; } if (w) { return w; }
const QString tabName = callsign.asString(); const QString tabName = callsign.asString();
const QString style = this->getStyleSheet();
const bool supervisor = callsign.isSupervisorCallsign(); const bool supervisor = callsign.isSupervisorCallsign();
QWidget *newTabWidget = new QWidget(this); QWidget *newTabWidget = new QWidget(this);
newTabWidget->setObjectName("Tab widget " + tabName); newTabWidget->setObjectName("Tab widget " + tabName);
@@ -412,6 +417,7 @@ namespace BlackGui
newTabWidget->setLayout(layout); newTabWidget->setLayout(layout);
textEdit->setContextMenuPolicy(Qt::CustomContextMenu); textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
textEdit->setProperty("supervisormsg", supervisor); textEdit->setProperty("supervisormsg", supervisor);
textEdit->setStyleSheetForContent(style);
const int index = ui->tw_TextMessages->addTab(newTabWidget, tabName); const int index = ui->tw_TextMessages->addTab(newTabWidget, tabName);
QToolButton *closeButtonInTab = new QToolButton(newTabWidget); QToolButton *closeButtonInTab = new QToolButton(newTabWidget);

View File

@@ -31,12 +31,6 @@
</property> </property>
<item> <item>
<widget class="QTabWidget" name="tw_TextMessages"> <widget class="QTabWidget" name="tw_TextMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
@@ -62,12 +56,6 @@
</property> </property>
<item> <item>
<widget class="BlackGui::Views::CTextMessageView" name="tvp_TextMessagesAll"> <widget class="BlackGui::Views::CTextMessageView" name="tvp_TextMessagesAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>

View File

@@ -86,12 +86,6 @@ BlackGui--Components--CCopyConfigurationComponent {
} }
*/ */
/* setup load dialog */
BlackGui--Components--CSetupLoadingDialog {
background: black; /* background is background color here */
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
/* setup load dialog details frame */ /* setup load dialog details frame */
/* /*
BlackGui--Components--CSetupLoadingDialog #fr_Details { BlackGui--Components--CSetupLoadingDialog #fr_Details {
@@ -100,12 +94,6 @@ BlackGui--Components--CSetupLoadingDialog #fr_Details {
} }
*/ */
/** dialog for airports **/
BlackGui--Components--CAirportDialog {
background: black; /* background is background color here */
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
/* core settings */ /* core settings */
/* needed for CCoreSettingsDialog */ /* needed for CCoreSettingsDialog */
/* BlackGui::Components::CSettingsComponent */ /* BlackGui::Components::CSettingsComponent */
@@ -198,6 +186,10 @@ BlackGui--Components--CAircraftModelSetValidationDialog,
BlackGui--Components--CCoreSettingsDialog, BlackGui--Components--CCoreSettingsDialog,
BlackGui--Views--CAircraftModelValidationDialog, BlackGui--Views--CAircraftModelValidationDialog,
BlackGui--Views--CAircraftModelStatisticsDialog, BlackGui--Views--CAircraftModelStatisticsDialog,
BlackGui--Components--CSettingsFontDialog,
BlackGui--Components--CAirportDialog,
BlackGui--Components--CTextEditDialog,
BlackGui--Components--CSetupLoadingDialog,
BlackGui--Components--CDownloadComponent, BlackGui--Components--CDownloadComponent,
BlackGui--Components--CDownloadDialog, BlackGui--Components--CDownloadDialog,
BlackGui--Components--CRawFsdMessagesComponent, BlackGui--Components--CRawFsdMessagesComponent,

View File

@@ -1,3 +1,4 @@
/** default style from testmessage.css **/
/** style sheet for content !!! **/ /** style sheet for content !!! **/
/** does not(!) affect text edit **/ /** does not(!) affect text edit **/
/** http://doc.qt.io/qt-5/richtext-html-subset.html **/ /** http://doc.qt.io/qt-5/richtext-html-subset.html **/
@@ -6,7 +7,7 @@ table { font-size: 8pt; }
tr { } tr { }
td { vertical-align: middle; } td { vertical-align: middle; }
td.timestamp { color: green; } td.timestamp { color: lightgreen; }
td.message{ } td.message{ }
/** recipient info normal/supervisor **/ /** recipient info normal/supervisor **/
@@ -16,5 +17,5 @@ td.recipient{ color: yellow; }
/** sent info normal/supervisor **/ /** sent info normal/supervisor **/
td.sender{ color: yellow; } td.sender{ color: yellow; }
.sent td.sender{ color: blue; } .sent td.sender{ color: magenta; }
.supervisor td.sender{ background-color: red; } .supervisor td.sender{ background-color: red; }

View File

@@ -103,7 +103,7 @@ namespace BlackGui
QString html("<table>"); QString html("<table>");
for (const CTextMessage &msg : messages) for (const CTextMessage &msg : messages)
{ {
html += toHtml(msg, withFrom, withTo); html += CTextMessageTextEdit::toHtml(msg, withFrom, withTo);
} }
html += "</table>"; html += "</table>";
return html; return html;
@@ -111,45 +111,23 @@ namespace BlackGui
QString CTextMessageTextEdit::toHtml(const CTextMessage &message, bool withFrom, bool withTo) QString CTextMessageTextEdit::toHtml(const CTextMessage &message, bool withFrom, bool withTo)
{ {
QString html; QString rowClass(message.wasSent() ? "sent" : "received");
QString rowClass;
if (message.isSupervisorMessage()) { rowClass += " supervisor"; } if (message.isSupervisorMessage()) { rowClass += " supervisor"; }
if (message.wasSent()) { rowClass += " sent"; }
else { rowClass += " received"; }
if (rowClass.isEmpty()) QString html(u"<tr class=\"" % rowClass.trimmed() %
{ u"\"><td class=\"timestamp\">" % message.getFormattedUtcTimestampHms() % u"</td>");
html += "<tr>";
}
else
{
html += "<tr class=\"";
html += rowClass.trimmed();
html += "\">";
}
html += "<td class=\"timestamp\">";
html += message.getFormattedUtcTimestampHms();
html += "</td>";
if (withFrom) if (withFrom)
{ {
html += "<td class=\"sender\">"; html += u"<td class=\"sender\">" % message.getSenderCallsign().asString() % u"</td>";
html += message.getSenderCallsign().asString();
html += "</td>";
} }
if (withTo) if (withTo)
{ {
html += "<td class=\"recipient\">"; html += u"<td class=\"recipient\">" % message.getRecipientCallsignOrFrequency() % u"</td>";
html += message.getRecipientCallsignOrFrequency();
html += "</td>";
} }
html += "<td class=\"message\">"; html += u"<td class=\"message\">" % message.getMessage() % u"</td></tr>";
html += message.getMessage();
html += "</td>";
html += "</tr>";
return html; return html;
} }