const QString& so we don't need to copy that. :)
On Wed, Jul 16, 2014 at 1:35 PM, Sergey Starosek <[email protected]> wrote: > - set application-wide locale from preferences > - use custom date format for display > > Signed-off-by: Sergey Starosek <[email protected]> > --- > helpers.h | 1 + > qt-gui.cpp | 6 ++++++ > qt-ui/diveplanner.cpp | 1 + > qt-ui/maintab.cpp | 1 + > 4 files changed, 9 insertions(+) > > diff --git a/helpers.h b/helpers.h > index d2f6e23..f74d449 100644 > --- a/helpers.h > +++ b/helpers.h > @@ -34,6 +34,7 @@ QString get_short_dive_date_string(timestamp_t when); > QString get_trip_date_string(timestamp_t when, int nr); > QString uiLanguage(QLocale *callerLoc); > QLocale getLocale(); > +QString getDateFormat(); > void selectedDivesGasUsed(QVector<QPair<QString, int> > &gasUsed); > > #if defined __APPLE__ > diff --git a/qt-gui.cpp b/qt-gui.cpp > index 4dc21e8..68f65e7 100644 > --- a/qt-gui.cpp > +++ b/qt-gui.cpp > @@ -108,6 +108,11 @@ QLocale getLocale() > return loc; > } > > +QString getDateFormat() > +{ > + return dateFormat; > +} > + > void init_ui(void) > { > // tell Qt to use system proxies > @@ -135,6 +140,7 @@ void init_ui(void) > > QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); > QLocale loc; > QString uiLang = uiLanguage(&loc); > + QLocale::setDefault(loc); > > // we don't have translations for English - if we don't check for this > // Qt will proceed to load the second language in preference order - > not what we want > diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp > index fe08d70..2bde25a 100644 > --- a/qt-ui/diveplanner.cpp > +++ b/qt-ui/diveplanner.cpp > @@ -252,6 +252,7 @@ void > DiveHandler::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) > DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : > QWidget(parent, f) > { > ui.setupUi(this); > + ui.dateEdit->setDisplayFormat(getDateFormat()); > ui.tableWidget->setTitle(tr("Dive planner points")); > ui.tableWidget->setModel(DivePlannerPointsModel::instance()); > DivePlannerPointsModel::instance()->setRecalc(true); > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp > index 4ec3941..6721780 100644 > --- a/qt-ui/maintab.cpp > +++ b/qt-ui/maintab.cpp > @@ -36,6 +36,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), > divePictureModel(DivePictureModel::instance()) > { > ui.setupUi(this); > + ui.dateEdit->setDisplayFormat(getDateFormat()); > > memset(&displayed_dive, 0, sizeof(displayed_dive)); > > -- > 1.8.5.5 > > _______________________________________________ > subsurface mailing list > [email protected] > http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
