diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 4341a515a..3813ee347 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -22,6 +22,7 @@ set(OLIVE_SOURCES ) add_subdirectory(common) +add_subdirectory(config) add_subdirectory(decoder) add_subdirectory(dialog) add_subdirectory(node) diff --git a/app/config/CMakeLists.txt b/app/config/CMakeLists.txt new file mode 100644 index 000000000..11783b764 --- /dev/null +++ b/app/config/CMakeLists.txt @@ -0,0 +1,21 @@ +# Olive - Non-Linear Video Editor +# Copyright (C) 2019 Olive Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set(OLIVE_SOURCES + ${OLIVE_SOURCES} + config/config.h + PARENT_SCOPE +) diff --git a/app/config/config.h b/app/config/config.h new file mode 100644 index 000000000..79e1072c6 --- /dev/null +++ b/app/config/config.h @@ -0,0 +1,12 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "common/timecodefunctions.h" + +/** + * @brief Temporary variables that will definitely be configurable but aren't yet + */ + +const olive::TimecodeDisplay kTimecodeDisplay = olive::kTimecodeFrames; + +#endif // CONFIG_H diff --git a/app/widget/playbackcontrols/playbackcontrols.cpp b/app/widget/playbackcontrols/playbackcontrols.cpp index a2390730c..a7921c653 100644 --- a/app/widget/playbackcontrols/playbackcontrols.cpp +++ b/app/widget/playbackcontrols/playbackcontrols.cpp @@ -24,6 +24,7 @@ #include #include "common/timecodefunctions.h" +#include "config/config.h" #include "ui/icons/icons.h" PlaybackControls::PlaybackControls(QWidget *parent) : @@ -124,5 +125,5 @@ void PlaybackControls::SetTime(const int64_t &r) { Q_ASSERT(time_base_.denominator() != 0); - cur_tc_lbl_->setText(olive::timestamp_to_timecode(r, time_base_, olive::kMilliseconds)); + cur_tc_lbl_->setText(olive::timestamp_to_timecode(r, time_base_, kTimecodeDisplay)); } diff --git a/app/widget/timeruler/timeruler.cpp b/app/widget/timeruler/timeruler.cpp index 13b76e282..6c9fde241 100644 --- a/app/widget/timeruler/timeruler.cpp +++ b/app/widget/timeruler/timeruler.cpp @@ -7,12 +7,13 @@ #include "common/timecodefunctions.h" #include "common/qtversionabstraction.h" +#include "config/config.h" TimeRuler::TimeRuler(bool text_visible, QWidget* parent) : QWidget(parent), scroll_(0), centered_text_(true), - scale_(16.0), + scale_(16.0), // FIXME: Temporary value time_(0) { QFontMetrics fm = fontMetrics(); @@ -109,8 +110,6 @@ void TimeRuler::paintEvent(QPaintEvent *e) int loop_start = - playhead_width_; int loop_end = width() + playhead_width_; - olive::TimecodeDisplay display_type = olive::kTimecodeSeconds; - // Determine where it can draw text int text_skip = 1; int half_average_text_width = 0; @@ -118,7 +117,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) if (text_visible_) { QFontMetrics fm = p.fontMetrics(); double width_of_second = time_base_.flipped().ToDouble() * scale_; - int average_text_width = QFontMetricsWidth(&fm, olive::timestamp_to_timecode(0, time_base_, display_type)); + int average_text_width = QFontMetricsWidth(&fm, olive::timestamp_to_timecode(0, time_base_, kTimecodeDisplay)); half_average_text_width = average_text_width/2; while (width_of_second * text_skip < average_text_width) { text_skip++; @@ -171,7 +170,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) // Try to draw text here if (text_visible_ && sec%text_skip == 0) { - QString timecode_string = olive::timestamp_to_timecode(sec, time_base_, display_type); + QString timecode_string = olive::timestamp_to_timecode(sec, time_base_, kTimecodeDisplay); int text_x = i;