Appearance tweaks to Statistics page

This commit is contained in:
Mark Watkins 2014-05-27 05:29:01 +10:00
parent a2305e4569
commit d049c4f0fa
5 changed files with 219 additions and 195 deletions

View File

@ -512,11 +512,8 @@ void Done()
PREF.Save();
LAYOUT.Save();
Q_FOREACH(Profile * profile, profiles) {
// TODO: only save open profiles.. (maybe add an open bit?)
profile->Save();
delete profile;
}
p_profile->Save();
delete p_profile;
profiles.clear();
delete p_pref;

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<width>614</width>
<height>395</height>
</rect>
</property>
@ -40,7 +40,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="welcomePage">
<layout class="QVBoxLayout" name="verticalLayout_8">
@ -91,19 +91,19 @@
<widget class="QWidget" name="userPage">
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="spacing">
<number>0</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
@ -114,17 +114,20 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="spacing">
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@ -140,66 +143,64 @@
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="passwordGroupBox">
<property name="toolTip">
<string>Keep the kids out.. Nothing more.. This isn't meant to be uber security.</string>
</property>
<property name="title">
<string>Password Protect Profile</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>8</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="passwordGroupBox">
<property name="toolTip">
<string>Keep the kids out.. Nothing more.. This isn't meant to be uber security.</string>
<item row="0" column="1">
<widget class="QLineEdit" name="passwordEdit1">
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
<property name="title">
<string>Password Protect Profile</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="passwordEdit1">
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>...twice...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="passwordEdit2">
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>...twice...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="passwordEdit2">
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
</widget>
</item>
@ -213,23 +214,65 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>0</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>8</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>4</number>
<property name="spacing">
<number>-1</number>
</property>
<item row="4" column="0">
<widget class="QCheckBox" name="DSTcheckbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DST Zone</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TimeZone</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="timezoneCombo"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_25">
<property name="sizePolicy">
@ -249,58 +292,6 @@
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="countryCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TimeZone</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="timezoneCombo"/>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="3">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="DSTcheckbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DST Zone</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -309,19 +300,19 @@
<widget class="QWidget" name="personalPage">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_6">
@ -330,22 +321,22 @@
</property>
<layout class="QFormLayout" name="formLayout_6">
<property name="horizontalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="verticalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
@ -484,22 +475,22 @@
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="verticalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
@ -559,19 +550,19 @@
<widget class="QWidget" name="cpapPage">
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>0</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_4">
@ -583,22 +574,22 @@
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="verticalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_16">
@ -676,20 +667,13 @@
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QPlainTextEdit" name="cpapNotes">
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -698,19 +682,19 @@
<widget class="QWidget" name="doctorPage">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_5">
@ -722,22 +706,22 @@
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="verticalSpacing">
<number>4</number>
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_17">
@ -919,6 +903,21 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>16</number>
</property>
<property name="leftMargin">
<number>8</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>8</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -73,7 +73,9 @@ ProfileSelect::ProfileSelect(QWidget *parent) :
ui->listView->setModel(proxy);
ui->listView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->listView->setSelectionMode(QAbstractItemView::SingleSelection);
if (sel >= 0) { ui->listView->setCurrentIndex(model->item(sel)->index()); }
if (sel >= 0) { ui->listView->setCurrentIndex(proxy->index(sel,0)); } //model->item(sel)->index()); }
m_tries = 0;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>354</height>
<width>418</width>
<height>272</height>
</rect>
</property>
<property name="windowTitle">
@ -22,6 +22,20 @@
background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(220, 220, 220, 255));
}
QGroupBox {
background-color: white;
border: 1px solid gray;
border-radius: 5px;
margin-top: 3ex; /* leave space at the top for the title */
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top center; /* position at the top center */
padding: 2px;
background-color: white;
}
QFrame {
background: white;
border: 1px solid gray;
@ -30,6 +44,7 @@ border-radius: 10px;
QLabel {
background: transparent;
border: 0px;
}
QPushButton {
@ -50,12 +65,10 @@ QPushButton:pressed {
background: gray;
}
QLineEdit {
border-radius: 5px;
border: 1px solid gray;
background: #cccccc;
background: white;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">

View File

@ -136,6 +136,19 @@ QString htmlHeader()
"<style type='text/css'>"
"<!--h1,p,a,td,body { font-family: 'FreeSans', 'Sans Serif' } --/>"
"p,a,td,body { font-size: 14px }"
"table.curved {"
"border: 1px solid gray;"
"border-radius:10px;"
"-moz-border-radius:10px;"
"-webkit-border-radius:10px;"
"width: 95%"
"}"
"tr.datarow:nth-child(even) {"
"background-color: #f8f8f8;"
"}"
"</style>"
"<link rel='stylesheet' type='text/css' href='qrc:/docs/tooltips.css' />"
"<script type='text/javascript'>"
@ -145,7 +158,7 @@ QString htmlHeader()
"</script>"
"</head>"
"<body leftmargin=0 topmargin=0 rightmargin=0>"
"<div align=center><table cellpadding=3 cellspacing=0 border=0 width=100%>"
"<div align=center><table class=curved>" // cellpadding=3 cellspacing=0 border=0
"<td>"+userinfo+"</td>"
"<td align='right'>"
"<h1>" + STR_TR_SleepyHead + "</h1><br/>"
@ -154,7 +167,7 @@ QString htmlHeader()
"<td align='right' width=170px><img src='qrc:/icons/bob-v3.0.png' height=140px><br/>"
"</td></tr></table>"
"</div>"
"<hr/>");
"<br/>");
}
QString htmlFooter()
{
@ -488,7 +501,7 @@ QString Statistics::GenerateHTML()
{
QString heading_color="#ffffff";
QString subheading_color="#efefef";
QString subheading_color="#e0e0e0";
QString html = htmlHeader();
@ -515,7 +528,7 @@ QString Statistics::GenerateHTML()
if (mach.size() == 0) {
html += "<table cellpadding=2 cellspacing=0 border=0 width=100% height=60%>";
html += "<table class=curved height=60%>"; //cellpadding=2 cellspacing=0 border=0
html += "<tr><td align=center><h1>" + tr("Please Import Some Data") + "</h1><i>" +
tr("SleepyHead is pretty much useless without it.") + "</i><br/><p>" +
tr("It might be a good idea to check preferences first,</br>as there are some options that affect import.")
@ -547,7 +560,7 @@ QString Statistics::GenerateHTML()
int decimals = 2;
html += "<div align=center>";
html += QString("<table cellpadding=2 cellspacing=0 border=1 width=90%>");
html += QString("<table class=curved>"); //cellpadding=2 cellspacing=0 border=0
int number_periods = 0;
if (p_profile->general->statReportMode() == 1) {
@ -655,7 +668,7 @@ QString Statistics::GenerateHTML()
name = calcnames[row.calc].arg(schema::channel[id].fullname());
}
QString line;
line += QString("<tr><td>%1</td>").arg(name);
line += QString("<tr class=datarow><td>%1</td>").arg(name);
for (int j=0; j < periods.size(); j++) {
QString val=row.value(periods.at(j).start,periods.at(j).end);
line += QString("<td>%2</td>")
@ -1024,7 +1037,7 @@ QString Statistics::GenerateHTML()
RXorder=true;
qSort(rxchange.begin(),rxchange.end());*/
html += "<div align=center><br/>";
html += QString("<table cellpadding=2 cellspacing=0 border=1 width=90%>");
html += QString("<table class=curved>"); //cellpadding=2 cellspacing=0 border=1
html += "<tr bgcolor='"+heading_color+"'><td colspan=10 align=center><font size=+3>" + tr("Changes to Prescription Settings") + "</font></td></tr>";
QString extratxt;
@ -1078,7 +1091,7 @@ QString Statistics::GenerateHTML()
}
mode = rx.mode;
extratxt = "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr>";
extratxt = "<table border=0 width=100%><tr>"; //cellpadding=0 cellspacing=0
// tooltip=QString("%1 %2% ").arg(machstr).arg(percentile*100.0)+STR_TR_EPAP+
// QString("=%1<br/>%2% ").arg(rx.per1,0,'f',decimals).arg(percentile*100.0)+
@ -1148,7 +1161,7 @@ QString Statistics::GenerateHTML()
tooltiphide = "tooltip.hide();";
}
html += QString("<tr bgcolor='%1' onmouseover='ChangeColor(this, \"#eeeeee\"); %2' onmouseout='ChangeColor(this, \"%1\"); %3' onclick='alert(\"overview=%4,%5\");'>")
html += QString("<tr class=datarow bgcolor='%1' onmouseover='ChangeColor(this, \"#eeeeee\"); %2' onmouseout='ChangeColor(this, \"%1\"); %3' onclick='alert(\"overview=%4,%5\");'>")
.arg(color)
.arg(tooltipshow)
.arg(tooltiphide)
@ -1182,7 +1195,7 @@ QString Statistics::GenerateHTML()
if (mach.size() > 0) {
html += "<div align=center><br/>";
html += QString("<table cellpadding=2 cellspacing=0 border=1 width=90%>");
html += QString("<table class=curved>"); // cellpadding=2 cellspacing=0 border=1 width=90%>");
html += "<tr bgcolor='"+heading_color+"'><td colspan=5 align=center><font size=+3>" + tr("Machine Information") + "</font></td></tr>";
html += QString("<tr><td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td><td><b>%4</b></td><td><b>%5</b></td></tr>")
@ -1200,7 +1213,7 @@ QString Statistics::GenerateHTML()
QString mn = m->properties[STR_PROP_ModelNumber];
//if (mn.isEmpty())
html += QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td></tr>")
html += QString("<tr class=datarow><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td></tr>")
.arg(m->properties[STR_PROP_Brand])
.arg(m->properties[STR_PROP_Model] + " " + m->properties[STR_PROP_SubModel] +
(mn.isEmpty() ? "" : QString(" (") + mn + QString(")")))