+weightgraph (1.0.1) unstable; urgency=low
+
+ * Few bugfixes.
+ * Improved edit window a bit.
+
+ -- Visa Putkinen <visa.putkinen@iki.fi> Wed, 02 Mar 2011 01:30:53 +0200
+
weightgraph (1.0.0) unstable; urgency=low
* Initial Release.
build-stamp: builddir/Makefile
dh_testdir
# compile commands go here
- cd builddir && $(MAKE) -j4
+ cd builddir && $(MAKE) -j6
touch $@
clean:
extern WeightDataModel *wdm;
EditWindow::EditWindow(QWidget *parent) :
- QMainWindow(parent)
+ QMainWindow(parent), shown(false)
{
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
return;
}
wdm->setWeightForDate(dw);
+ weightView.scrollTo(wdm->indexOfDate(dw.date), QAbstractItemView::PositionAtCenter);
}
}
if (indexes.size() == 1)
weightView.edit(wdm->index(indexes.first().row(), 1));
}
+
+void EditWindow::show()
+{
+ QMainWindow::show();
+ // scrollToBottom must be here: it will not scroll all the way
+ // to the bottom when called in the constructor because it'll
+ // receive the wrong window geometry while hidden.
+ if (!shown) {
+ weightView.scrollToBottom();
+ shown = true;
+ }
+}
void addWeight();
void removeSelected();
void editSelected();
+ void show();
private:
WeightView weightView;
QPushButton addButton, removeButton, editButton;
+ bool shown;
};
class AddWeightDialog : public QDialog
return i;
return -1;
}
+QModelIndex WeightDataModel::indexOfDate(const QDate &date) const
+{
+ return index(rowOfDate(date), 0);
+}
bool WeightDataModel::dateExists(const QDate &date) const
{
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
int rowOfDate(const QDate &date) const;
+ QModelIndex indexOfDate(const QDate &date) const;
bool dateExists(const QDate &date) const;
int rowForNewDate(const QDate &date) const;
void clear();
updateStats();
}
+static const char* wdays[] = {"Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday", "Sunday"};
QString dateString(QDate date)
{
int days = date.daysTo(QDate::currentDate());
else if (days == 1)
return "Yesterday";
else if (days < 7)
- return date.toString("dddd");
+ // return date.toString("dddd"); (Use this with l10n!)
+ // The following is used because the system locale might not be English
+ return wdays[date.dayOfWeek()-1];
else
return date.toString(Qt::ISODate);
}