Skip to content

Commit 7908f02

Browse files
committed
Print time-stamps in an output window
1 parent fd8caa7 commit 7908f02

7 files changed

Lines changed: 33 additions & 18 deletions

File tree

src/Config.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
set(PROJECT_VERSION "1.0.1")
2-
set(PROJECT_YEAR "2025")
3-
set(PROJECT_RELEASE_DATE "2025-12-21")
1+
set(PROJECT_VERSION "1.0.2")
2+
set(PROJECT_YEAR "2026")
3+
set(PROJECT_RELEASE_DATE "2026-01-31")
44
set(PROJECT_PACKAGE_NAME "range-cloud-client")
55
set(PROJECT_TARGET_NAME "cloud-client")
66
set(PROJECT_HUMAN_NAME "Range Cloud Client")

src/cloud-client/doc/RELEASE_NOTES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
------------------------------------------------------------------
2+
Version 1.0.2
3+
4+
* GUI: Print time-stamps in output window
5+
6+
Bug fixes:
7+
18
------------------------------------------------------------------
29
Version 1.0.1
310

src/cloud-client/src/central_widget.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ void CentralWidget::setTabTitle(TabType tabType, RMessage::Type messageType, con
9595
this->tabWidget->setTabText(tabPosition,defaultText);
9696
}
9797

98-
void CentralWidget::onInfoPrinted(const QString &message)
98+
QString CentralWidget::messageToString(const RMessage &message)
99+
{
100+
return QString("[%1] %2").arg(RMessage::aTimeToString(message.getAtime()),message);
101+
}
102+
103+
void CentralWidget::onInfoPrinted(const RMessage &message)
99104
{
100105
QScrollBar *sb = this->applicationOutputBrowser->verticalScrollBar();
101106
int scrollBarValue = sb->value();
@@ -104,7 +109,7 @@ void CentralWidget::onInfoPrinted(const QString &message)
104109
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
105110
this->applicationOutputBrowser->setTextBackgroundColor(QApplication::palette().base().color());
106111
this->applicationOutputBrowser->setTextColor(QApplication::palette().text().color());
107-
this->applicationOutputBrowser->insertPlainText(message);
112+
this->applicationOutputBrowser->insertPlainText(CentralWidget::messageToString(message));
108113
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
109114
if (scrollBarAtMax)
110115
{
@@ -114,19 +119,19 @@ void CentralWidget::onInfoPrinted(const QString &message)
114119
this->setTabTitle(CentralWidget::Output,RMessage::Type::Info);
115120
}
116121

117-
void CentralWidget::onNoticePrinted(const QString &message)
122+
void CentralWidget::onNoticePrinted(const RMessage &message)
118123
{
119-
RMessageBox::information(this,tr("Notice"),QString(message).replace("NOTICE: ",""));
124+
RMessageBox::information(this,tr("Notice"),QString(CentralWidget::messageToString(message)).replace("NOTICE: ",""));
120125
}
121126

122-
void CentralWidget::onWarningPrinted(const QString &message)
127+
void CentralWidget::onWarningPrinted(const RMessage &message)
123128
{
124129
QTextCharFormat charFormat = this->applicationOutputBrowser->currentCharFormat();
125130

126131
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
127132
this->applicationOutputBrowser->setTextBackgroundColor(QApplication::palette().base().color());
128133
this->applicationOutputBrowser->setTextColor(QColor(170,0,0));
129-
this->applicationOutputBrowser->insertPlainText(message);
134+
this->applicationOutputBrowser->insertPlainText(CentralWidget::messageToString(message));
130135
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
131136
this->applicationOutputBrowser->setTextColor(QApplication::palette().text().color());
132137
this->applicationOutputBrowser->setCurrentCharFormat(charFormat);
@@ -135,14 +140,14 @@ void CentralWidget::onWarningPrinted(const QString &message)
135140
this->setTabTitle(CentralWidget::Output,RMessage::Type::Warning);
136141
}
137142

138-
void CentralWidget::onErrorPrinted(const QString &message)
143+
void CentralWidget::onErrorPrinted(const RMessage &message)
139144
{
140145
QTextCharFormat charFormat = this->applicationOutputBrowser->currentCharFormat();
141146

142147
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
143148
this->applicationOutputBrowser->setTextBackgroundColor(QColor(170,0,0));
144149
this->applicationOutputBrowser->setTextColor(QColor(255,255,255));
145-
this->applicationOutputBrowser->insertPlainText(message);
150+
this->applicationOutputBrowser->insertPlainText(CentralWidget::messageToString(message));
146151
this->applicationOutputBrowser->moveCursor(QTextCursor::End);
147152
this->applicationOutputBrowser->setTextBackgroundColor(QApplication::palette().base().color());
148153
this->applicationOutputBrowser->setTextColor(QApplication::palette().text().color());

src/cloud-client/src/central_widget.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,22 @@ class CentralWidget : public QWidget
4343
//! Set text and icon for given tab.
4444
void setTabTitle(CentralWidget::TabType tabType, RMessage::Type messageType = RMessage::Type::None, const QString &additionalText = QString());
4545

46+
//! Convert message to string.
47+
static QString messageToString(const RMessage &message);
48+
4649
private slots:
4750

4851
//! Print application info message.
49-
void onInfoPrinted(const QString &message);
52+
void onInfoPrinted(const RMessage &message);
5053

5154
//! Print application notice message.
52-
void onNoticePrinted(const QString &message);
55+
void onNoticePrinted(const RMessage &message);
5356

5457
//! Print application warning message.
55-
void onWarningPrinted(const QString &message);
58+
void onWarningPrinted(const RMessage &message);
5659

5760
//! Print application error message.
58-
void onErrorPrinted(const QString &message);
61+
void onErrorPrinted(const RMessage &message);
5962

6063
//! Central tab widget current changed.
6164
void onCurrentChanged(int tabPosition);

0 commit comments

Comments
 (0)