Make Daily sidepanel and right side bar size changes persistent

This commit is contained in:
Mark Watkins 2014-10-02 21:22:30 +10:00
parent 1ade0e7b04
commit bc09382916
11 changed files with 63 additions and 37 deletions

View File

@ -462,9 +462,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
} }
} }
bool mouseover = false; //bool mouseover = false;
if (rect.contains(w.graphView()->currentMousePos())) { if (rect.contains(w.graphView()->currentMousePos())) {
mouseover = true; //mouseover = true;
painter.fillRect(rect, QBrush(QColor(255,255,245,128))); painter.fillRect(rect, QBrush(QColor(255,255,245,128)));
} }
@ -501,7 +501,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
int idx; int idx;
bool done; bool done;
double x0, xL; double x0, xL;
double sr; double sr = 0.0;
int sam; int sam;
int minz, maxz; int minz, maxz;

View File

@ -434,7 +434,7 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion &regio
if ((daylist.size() == 0) || (it == dayindex.end())) return; if ((daylist.size() == 0) || (it == dayindex.end())) return;
Day * lastday = nullptr; //Day * lastday = nullptr;
// int dc = 0; // int dc = 0;
// for (int i=idx; i<=idx_end; ++i) { // for (int i=idx; i<=idx_end; ++i) {
@ -527,11 +527,11 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion &regio
lastx1 += barw; lastx1 += barw;
it++; it++;
nousedays++; nousedays++;
lastday = day; //lastday = day;
continue; continue;
} }
lastday = day; //lastday = day;
float x1 = lastx1 + barw; float x1 = lastx1 + barw;
@ -986,13 +986,13 @@ void gSessionTimesChart::paint(QPainter &painter, gGraph &graph, const QRegion &
float x1 = lastx1 + barw; float x1 = lastx1 + barw;
bool hl = false; //bool hl = false;
QRect rec2(lastx1, rect.top(), barw, rect.height()); QRect rec2(lastx1, rect.top(), barw, rect.height());
if (rec2.contains(mouse)) { if (rec2.contains(mouse)) {
QColor col2(255,0,0,64); QColor col2(255,0,0,64);
painter.fillRect(rec2, QBrush(col2)); painter.fillRect(rec2, QBrush(col2));
hl = true; //hl = true;
} }
if (cit != cache.end()) { if (cit != cache.end()) {

View File

@ -70,7 +70,8 @@ void SummaryChart::SetDay(Day * nullday)
if (mididx == 0) { mid = ST_PERC; } if (mididx == 0) { mid = ST_PERC; }
else if (mididx == 1) { mid = ST_WAVG; } else if (mididx == 1) { mid = ST_WAVG; }
else if (mididx == 2) { mid = ST_AVG; } else mid = ST_AVG;
if (cpapmode >= MODE_ASV) { if (cpapmode >= MODE_ASV) {
addSlice(CPAP_EPAP, QColor("green"), ST_SETMIN); addSlice(CPAP_EPAP, QColor("green"), ST_SETMIN);
@ -94,7 +95,7 @@ void SummaryChart::SetDay(Day * nullday)
addSlice(CPAP_IPAPHi, QColor("blue"), ST_SETMAX); addSlice(CPAP_IPAPHi, QColor("blue"), ST_SETMAX);
} else if (cpapmode >= MODE_APAP) { } else if (cpapmode >= MODE_APAP) {
addSlice(CPAP_PressureMin, QColor("orange"), ST_SETMIN); addSlice(CPAP_PressureMin, QColor("orange"), ST_SETMIN);
addSlice(CPAP_Pressure, QColor("dark green"), mid, 0.5); addSlice(CPAP_Pressure, QColor("dark green"), mid, 0.5f);
addSlice(CPAP_Pressure, QColor("grey"), ST_PERC, perc); addSlice(CPAP_Pressure, QColor("grey"), ST_PERC, perc);
addSlice(CPAP_PressureMax, QColor("red"), ST_SETMAX); addSlice(CPAP_PressureMax, QColor("red"), ST_SETMAX);
} else { } else {

View File

@ -320,6 +320,8 @@ const QString STR_IS_LockSummarySessions = "LockSummarySessions";
// AppearanceSettings Strings // AppearanceSettings Strings
const QString STR_AS_GraphHeight = "GraphHeight"; const QString STR_AS_GraphHeight = "GraphHeight";
const QString STR_AS_DailyPanelWidth = "DailyPanelWidth";
const QString STR_AS_RightPanelWidth = "RightPanelWidth";
const QString STR_AS_AntiAliasing = "UseAntiAliasing"; const QString STR_AS_AntiAliasing = "UseAntiAliasing";
const QString STR_AS_GraphSnapshots = "EnableGraphSnapshots"; const QString STR_AS_GraphSnapshots = "EnableGraphSnapshots";
const QString STR_AS_Animations = "AnimationsAndTransitions"; const QString STR_AS_Animations = "AnimationsAndTransitions";
@ -696,6 +698,8 @@ class AppearanceSettings : public ProfileSettings
: ProfileSettings(profile) : ProfileSettings(profile)
{ {
initPref(STR_AS_GraphHeight, 180.0); initPref(STR_AS_GraphHeight, 180.0);
initPref(STR_AS_DailyPanelWidth, 350.0);
initPref(STR_AS_RightPanelWidth, 230.0);
initPref(STR_AS_AntiAliasing, true); initPref(STR_AS_AntiAliasing, true);
initPref(STR_AS_GraphSnapshots, true); initPref(STR_AS_GraphSnapshots, true);
initPref(STR_AS_Animations, true); initPref(STR_AS_Animations, true);
@ -713,6 +717,10 @@ class AppearanceSettings : public ProfileSettings
//! \brief Returns the normal (unscaled) height of a graph //! \brief Returns the normal (unscaled) height of a graph
int graphHeight() const { return getPref(STR_AS_GraphHeight).toInt(); } int graphHeight() const { return getPref(STR_AS_GraphHeight).toInt(); }
//! \brief Returns the normal (unscaled) height of a graph
int dailyPanelWidth() const { return getPref(STR_AS_DailyPanelWidth).toInt(); }
//! \brief Returns the normal (unscaled) height of a graph
int rightPanelWidth() const { return getPref(STR_AS_RightPanelWidth).toInt(); }
//! \brief Returns true if AntiAliasing (the graphical smoothing method) is enabled //! \brief Returns true if AntiAliasing (the graphical smoothing method) is enabled
bool antiAliasing() const { return getPref(STR_AS_AntiAliasing).toBool(); } bool antiAliasing() const { return getPref(STR_AS_AntiAliasing).toBool(); }
//! \brief Returns true if renderPixmap function is in use, which takes snapshots of graphs //! \brief Returns true if renderPixmap function is in use, which takes snapshots of graphs
@ -748,6 +756,10 @@ class AppearanceSettings : public ProfileSettings
//! \brief Set the normal (unscaled) height of a graph. //! \brief Set the normal (unscaled) height of a graph.
void setGraphHeight(int height) { setPref(STR_AS_GraphHeight, height); } void setGraphHeight(int height) { setPref(STR_AS_GraphHeight, height); }
//! \brief Set the normal (unscaled) height of a graph.
void setDailyPanelWidth(int width) { setPref(STR_AS_DailyPanelWidth, width); }
//! \brief Set the normal (unscaled) height of a graph.
void setRightPanelWidth(int width) { setPref(STR_AS_RightPanelWidth, width); }
//! \brief Set to true to turn on AntiAliasing (the graphical smoothing method) //! \brief Set to true to turn on AntiAliasing (the graphical smoothing method)
void setAntiAliasing(bool aa) { setPref(STR_AS_AntiAliasing, aa); } void setAntiAliasing(bool aa) { setPref(STR_AS_AntiAliasing, aa); }
//! \brief Set to true if renderPixmap functions are in use, which takes snapshots of graphs. //! \brief Set to true if renderPixmap functions are in use, which takes snapshots of graphs.

View File

@ -59,7 +59,7 @@ void Daily::setSidebarVisible(bool visible)
{ {
QList<int> a; QList<int> a;
int panel_width = visible ? 370 : 0; int panel_width = visible ? p_profile->appearance->dailyPanelWidth() : 0;
a.push_back(panel_width); a.push_back(panel_width);
a.push_back(this->width() - panel_width); a.push_back(this->width() - panel_width);
ui->splitter_2->setStretchFactor(1,1); ui->splitter_2->setStretchFactor(1,1);
@ -2561,3 +2561,10 @@ void Daily::on_toggleEvents_clicked(bool checked)
// // ui->sessionWidget->setCurrentItem(item); // // ui->sessionWidget->setCurrentItem(item);
// } // }
//} //}
void Daily::on_splitter_2_splitterMoved(int, int)
{
int size = ui->splitter_2->sizes()[0];
if (size == 0) return;
p_profile->appearance->setDailyPanelWidth(size);
}

View File

@ -281,6 +281,8 @@ private slots:
//void on_sessionWidget_itemSelectionChanged(); //void on_sessionWidget_itemSelectionChanged();
void on_splitter_2_splitterMoved(int pos, int index);
protected: protected:
virtual void closeEvent(QCloseEvent *); virtual void closeEvent(QCloseEvent *);
virtual void showEvent(QShowEvent *); virtual void showEvent(QShowEvent *);

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1211</width> <width>551</width>
<height>674</height> <height>441</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -331,6 +331,15 @@ MainWindow::MainWindow(QWidget *parent) :
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(on_aboutToQuit())); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(on_aboutToQuit()));
QList<int> a;
int panel_width = p_profile->appearance->rightPanelWidth();
a.push_back(this->width() - panel_width);
a.push_back(panel_width);
ui->splitter_2->setStretchFactor(1,1);
ui->splitter_2->setSizes(a);
ui->splitter_2->setStretchFactor(1,1);
} }
void MainWindow::on_changeWarningMessage() void MainWindow::on_changeWarningMessage()
@ -2714,3 +2723,8 @@ void MainWindow::on_actionExport_Review_triggered()
{ {
QMessageBox::information(nullptr, STR_MessageBox_Information, QObject::tr("Sorry, this feature is not implemented yet"), QMessageBox::Ok); QMessageBox::information(nullptr, STR_MessageBox_Information, QObject::tr("Sorry, this feature is not implemented yet"), QMessageBox::Ok);
} }
void MainWindow::on_splitter_2_splitterMoved(int, int)
{
p_profile->appearance->setRightPanelWidth(ui->splitter_2->sizes()[1]);
}

View File

@ -332,6 +332,8 @@ class MainWindow : public QMainWindow
void on_actionExport_Review_triggered(); void on_actionExport_Review_triggered();
void on_splitter_2_splitterMoved(int pos, int index);
private: private:
void importCPAPBackups(); void importCPAPBackups();
void finishCPAPImport(); void finishCPAPImport();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1005</width> <width>687</width>
<height>849</height> <height>361</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -926,7 +926,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<property name="documentMode"> <property name="documentMode">
<bool>false</bool> <bool>false</bool>
@ -1332,18 +1332,6 @@ color: yellow;</string>
</widget> </widget>
</widget> </widget>
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
@ -1494,8 +1482,8 @@ QToolBox::tab:selected {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>240</width> <width>223</width>
<height>724</height> <height>582</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
@ -1909,7 +1897,7 @@ border: 2px solid #56789a; border-radius: 30px;
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>240</width> <width>240</width>
<height>724</height> <height>237</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
@ -3056,8 +3044,8 @@ border-radius: 10px;
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>240</width> <width>69</width>
<height>724</height> <height>237</height>
</rect> </rect>
</property> </property>
<property name="mouseTracking"> <property name="mouseTracking">
@ -3118,8 +3106,8 @@ border-radius: 10px;
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1005</width> <width>687</width>
<height>22</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -1124,12 +1124,12 @@ QString Statistics::GenerateHTML()
periods.push_back(Period(last,last,tr("Last Session"))); periods.push_back(Period(last,last,tr("Last Session")));
bool done=false; //bool done=false;
int j=0; int j=0;
do { do {
s=QDate(l.year(), l.month(), 1); s=QDate(l.year(), l.month(), 1);
if (s < first) { if (s < first) {
done = true; //done = true;
s = first; s = first;
} }
if (p_profile->countDays(row.type, s, l) > 0) { if (p_profile->countDays(row.type, s, l) > 0) {