mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
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:
committed by
Mat Sutcliffe
parent
77e642d42d
commit
27b9c5e8c8
@@ -107,6 +107,10 @@ namespace BlackGui
|
||||
if (!myself || !sGui || sGui->isShuttingDown()) { return; }
|
||||
this->onSettingsChanged();
|
||||
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; }
|
||||
|
||||
const QString tabName = callsign.asString();
|
||||
const QString style = this->getStyleSheet();
|
||||
const bool supervisor = callsign.isSupervisorCallsign();
|
||||
QWidget *newTabWidget = new QWidget(this);
|
||||
newTabWidget->setObjectName("Tab widget " + tabName);
|
||||
@@ -412,6 +417,7 @@ namespace BlackGui
|
||||
newTabWidget->setLayout(layout);
|
||||
textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
textEdit->setProperty("supervisormsg", supervisor);
|
||||
textEdit->setStyleSheetForContent(style);
|
||||
|
||||
const int index = ui->tw_TextMessages->addTab(newTabWidget, tabName);
|
||||
QToolButton *closeButtonInTab = new QToolButton(newTabWidget);
|
||||
|
||||
@@ -31,12 +31,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<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">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -62,12 +56,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<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">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
|
||||
@@ -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 */
|
||||
/*
|
||||
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 */
|
||||
/* needed for CCoreSettingsDialog */
|
||||
/* BlackGui::Components::CSettingsComponent */
|
||||
@@ -198,6 +186,10 @@ BlackGui--Components--CAircraftModelSetValidationDialog,
|
||||
BlackGui--Components--CCoreSettingsDialog,
|
||||
BlackGui--Views--CAircraftModelValidationDialog,
|
||||
BlackGui--Views--CAircraftModelStatisticsDialog,
|
||||
BlackGui--Components--CSettingsFontDialog,
|
||||
BlackGui--Components--CAirportDialog,
|
||||
BlackGui--Components--CTextEditDialog,
|
||||
BlackGui--Components--CSetupLoadingDialog,
|
||||
BlackGui--Components--CDownloadComponent,
|
||||
BlackGui--Components--CDownloadDialog,
|
||||
BlackGui--Components--CRawFsdMessagesComponent,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** default style from testmessage.css **/
|
||||
/** style sheet for content !!! **/
|
||||
/** does not(!) affect text edit **/
|
||||
/** http://doc.qt.io/qt-5/richtext-html-subset.html **/
|
||||
@@ -6,7 +7,7 @@ table { font-size: 8pt; }
|
||||
|
||||
tr { }
|
||||
td { vertical-align: middle; }
|
||||
td.timestamp { color: green; }
|
||||
td.timestamp { color: lightgreen; }
|
||||
td.message{ }
|
||||
|
||||
/** recipient info normal/supervisor **/
|
||||
@@ -16,5 +17,5 @@ td.recipient{ color: yellow; }
|
||||
|
||||
/** sent info normal/supervisor **/
|
||||
td.sender{ color: yellow; }
|
||||
.sent td.sender{ color: blue; }
|
||||
.sent td.sender{ color: magenta; }
|
||||
.supervisor td.sender{ background-color: red; }
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace BlackGui
|
||||
QString html("<table>");
|
||||
for (const CTextMessage &msg : messages)
|
||||
{
|
||||
html += toHtml(msg, withFrom, withTo);
|
||||
html += CTextMessageTextEdit::toHtml(msg, withFrom, withTo);
|
||||
}
|
||||
html += "</table>";
|
||||
return html;
|
||||
@@ -111,45 +111,23 @@ namespace BlackGui
|
||||
|
||||
QString CTextMessageTextEdit::toHtml(const CTextMessage &message, bool withFrom, bool withTo)
|
||||
{
|
||||
QString html;
|
||||
QString rowClass;
|
||||
QString rowClass(message.wasSent() ? "sent" : "received");
|
||||
if (message.isSupervisorMessage()) { rowClass += " supervisor"; }
|
||||
if (message.wasSent()) { rowClass += " sent"; }
|
||||
else { rowClass += " received"; }
|
||||
|
||||
if (rowClass.isEmpty())
|
||||
{
|
||||
html += "<tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
html += "<tr class=\"";
|
||||
html += rowClass.trimmed();
|
||||
html += "\">";
|
||||
}
|
||||
html += "<td class=\"timestamp\">";
|
||||
html += message.getFormattedUtcTimestampHms();
|
||||
html += "</td>";
|
||||
QString html(u"<tr class=\"" % rowClass.trimmed() %
|
||||
u"\"><td class=\"timestamp\">" % message.getFormattedUtcTimestampHms() % u"</td>");
|
||||
|
||||
if (withFrom)
|
||||
{
|
||||
html += "<td class=\"sender\">";
|
||||
html += message.getSenderCallsign().asString();
|
||||
html += "</td>";
|
||||
html += u"<td class=\"sender\">" % message.getSenderCallsign().asString() % u"</td>";
|
||||
}
|
||||
|
||||
if (withTo)
|
||||
{
|
||||
html += "<td class=\"recipient\">";
|
||||
html += message.getRecipientCallsignOrFrequency();
|
||||
html += "</td>";
|
||||
html += u"<td class=\"recipient\">" % message.getRecipientCallsignOrFrequency() % u"</td>";
|
||||
}
|
||||
|
||||
html += "<td class=\"message\">";
|
||||
html += message.getMessage();
|
||||
html += "</td>";
|
||||
|
||||
html += "</tr>";
|
||||
html += u"<td class=\"message\">" % message.getMessage() % u"</td></tr>";
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user