void CoreInfoDlg::coreInfoAvailable() {
ui.labelCoreVersion->setText(_coreInfo["quasselVersion"].toString());
- ui.labelUptime->setText(_coreInfo["startTime"].toString());
+ ui.labelCoreBuildDate->setText(_coreInfo["quasselBuildDate"].toString());
ui.labelClientCount->setNum(_coreInfo["sessionConnectedClients"].toInt());
- // data["quasselBuildDate"] = Global::quasselBuildDate;
+ updateUptime();
+ startTimer(1000);
+}
+
+void CoreInfoDlg::updateUptime() {
+ QDateTime startTime = _coreInfo["startTime"].toDateTime();
+
+ int uptime = startTime.secsTo(QDateTime::currentDateTime());
+ int updays = uptime / 86400; uptime %= 86400;
+ int uphours = uptime / 3600; uptime %= 3600;
+ int upmins = uptime / 60; uptime %= 60;
+
+ QString uptimeText = QString("%1 Day(s) %2:%3:%4 (since %5)").arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(uptime,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
+ ui.labelUptime->setText(uptimeText);
}
<rect>
<x>0</x>
<y>0</y>
- <width>284</width>
- <height>137</height>
+ <width>282</width>
+ <height>174</height>
</rect>
</property>
<property name="windowTitle" >
</property>
</widget>
</item>
- <item row="1" column="0" >
+ <item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Uptime:</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
+ <item row="3" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Connected Clients:</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
+ <item row="3" column="1" >
<widget class="QLabel" name="labelClientCount" >
<property name="text" >
<string><connected clients></string>
</property>
</widget>
</item>
- <item row="1" column="1" >
+ <item row="2" column="1" >
<widget class="QLabel" name="labelUptime" >
<property name="text" >
<string><core uptime></string>
</property>
</widget>
</item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Build date:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="labelCoreBuildDate" >
+ <property name="text" >
+ <string><build date></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="0" column="1" >
+ <widget class="QPushButton" name="closeButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="2" >
+ <spacer name="horizontalSpacer_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
- <height>28</height>
+ <height>0</height>
</size>
</property>
</spacer>