diff --git a/editor/editor.pro b/editor/editor.pro new file mode 100644 index 0000000000..2bf57aa6e5 --- /dev/null +++ b/editor/editor.pro @@ -0,0 +1,17 @@ +# Editor specific things. + +TARGET = editor +TEMPLATE = lib +CONFIG += staticlib warn_on +INCLUDEPATH += ../3party/opening_hours/src + +ROOT_DIR = .. + +include($$ROOT_DIR/common.pri) + +SOURCES += \ + ui2oh.cpp + +HEADERS += \ + opening_hours_ui.hpp \ + ui2oh.hpp \ diff --git a/editor/opening_hours_ui.hpp b/editor/opening_hours_ui.hpp new file mode 100644 index 0000000000..e466ed0c28 --- /dev/null +++ b/editor/opening_hours_ui.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include "std/set.hpp" +#include "std/vector.hpp" + +#include "3party/opening_hours/opening_hours.hpp" + +namespace editor +{ +namespace ui +{ + +struct Time +{ + int hours; + int minutes; +}; + +struct Timespan +{ + Time from; + Time to; +}; + +enum class OpeningHoursTemplates +{ + TwentyFourHours, + Weekdays, + AllDays +}; + +using TOpeningDays = set; + +struct TimeTable +{ + bool isAllDay; + TOpeningDays weekday; + Timespan openingTime; + vector excludeTime; +}; + +using TTimeTables = vector; + +} // namespace ui +} // namespace editor diff --git a/editor/ui2oh.cpp b/editor/ui2oh.cpp new file mode 100644 index 0000000000..1e402b98f3 --- /dev/null +++ b/editor/ui2oh.cpp @@ -0,0 +1,46 @@ +#include "editor/ui2oh.hpp" + +#include "std/array.hpp" + + +namespace +{ +// osmoh::TWeekdayRanges DaysSetToRange( const & days) +// { + +// TWeekdayRanges ragnes; +// Weekday previous = Weekday::None; +// for (auto const & wd : days) +// { +// auto & range = ranges.back(); +// if (previous == Weekday::None) +// { +// ranges.push_back(WeekdayRange()); +// range.SetStart(wd); +// } +// else if (static_cast(wd) - static_cast(previous) > 1) +// { +// ranges.push_back(WeekdayRange()); +// range.SetStart(wd); +// } +// } +// return {}; +// } +} // namespace + +namespace editor +{ +// osmoh::OpeningHours ConvertOpeningkHours(ui::TTimeTables const & oh) +// { +// using namespace osmoh; + +// // TRuleSequences rule; +// // TWeekdayRanges weekdayRanges; +// return {}; +// } + +ui::TTimeTables ConvertOpeningkHours(osmoh::OpeningHours const & oh) +{ + return {}; +} +} // namespace diff --git a/editor/ui2oh.hpp b/editor/ui2oh.hpp new file mode 100644 index 0000000000..e629eb5063 --- /dev/null +++ b/editor/ui2oh.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "editor/opening_hours_ui.hpp" + +#include "3party/opening_hours/opening_hours.hpp" + + +namespace editor +{ +osmoh::OpeningHours ConvertOpeningHours(ui::TTimeTables const & tt); +ui::TTimeTables ConvertOpeningHours(osmoh::OpeningHours const & oh); +} // namespace editor diff --git a/omim.pro b/omim.pro index b8446fdc45..4c949c4bc7 100644 --- a/omim.pro +++ b/omim.pro @@ -23,7 +23,7 @@ HEADERS += defines.hpp CONFIG *= desktop } -SUBDIRS = 3party base coding geometry indexer search routing +SUBDIRS = 3party base coding geometry indexer search routing editor !CONFIG(osrm) { SUBDIRS *= platform stats storage