diff --git a/effects/audio/toneeffect.cpp b/effects/audio/toneeffect.cpp index 69bc0b8ec..7ca123a51 100644 --- a/effects/audio/toneeffect.cpp +++ b/effects/audio/toneeffect.cpp @@ -30,7 +30,7 @@ ToneEffect::ToneEffect(Clip* c) : Effect(c, EFFECT_TYPE_AUDIO, AUDIO_TONE_EFFECT connect(mix_val, SIGNAL(changed()), this, SLOT(field_changed())); } -void ToneEffect::process_audio(double timecode_start, double timecode_end, quint8 *samples, int nb_bytes, int channel_count) { +void ToneEffect::process_audio(double timecode_start, double timecode_end, quint8 *samples, int nb_bytes, int) { double interval = (timecode_end - timecode_start)/nb_bytes; for (int i=0;i +#include +#include + +QString get_data_path() { + QString app_path = QCoreApplication::applicationFilePath(); + QString app_dir = app_path.left(app_path.lastIndexOf('/')); + + if (QFileInfo::exists(app_dir + "/portable")) { + return app_dir; + } else { + return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + } +} diff --git a/io/path.h b/io/path.h new file mode 100644 index 000000000..f11fc206f --- /dev/null +++ b/io/path.h @@ -0,0 +1,8 @@ +#ifndef PATH_H +#define PATH_H + +#include + +QString get_data_path(); + +#endif // PATH_H diff --git a/io/previewgenerator.cpp b/io/previewgenerator.cpp index 2eb9b6c5e..5be60b80a 100644 --- a/io/previewgenerator.cpp +++ b/io/previewgenerator.cpp @@ -4,7 +4,7 @@ #include "panels/viewer.h" #include "panels/project.h" #include "io/config.h" -#include "io/crc32.h" +#include "io/path.h" #include "debug.h" #include @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #define WAVEFORM_RESOLUTION 64 @@ -38,7 +38,7 @@ PreviewGenerator::PreviewGenerator(QTreeWidgetItem* i, Media* m, bool r) : replace(r), cancelled(false) { - data_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/previews"; + data_path = get_data_path() + "/previews"; QDir data_dir(data_path); if (!data_dir.exists()) { data_dir.mkpath("."); diff --git a/mainwindow.cpp b/mainwindow.cpp index cc5461cd1..a813f2c6c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2,6 +2,7 @@ #include "ui_mainwindow.h" #include "io/config.h" +#include "io/path.h" #include "project/sequence.h" @@ -33,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -120,7 +120,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(editMenu_About_To_Be_Shown())); connect(ui->menu_File, SIGNAL(aboutToShow()), this, SLOT(fileMenu_About_To_Be_Shown())); - QString data_dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + QString data_dir = get_data_path(); if (!data_dir.isEmpty()) { QDir dir(data_dir); dir.mkpath("."); @@ -198,7 +198,7 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { set_sequence(NULL); - QString data_dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + QString data_dir = get_data_path(); if (!data_dir.isEmpty() && !autorecovery_filename.isEmpty()) { if (QFile::exists(autorecovery_filename)) { QFile::rename(autorecovery_filename, autorecovery_filename + "." + QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss")); diff --git a/olive.pro b/olive.pro index 04c0bc627..dd4495482 100644 --- a/olive.pro +++ b/olive.pro @@ -87,7 +87,8 @@ SOURCES += \ effects/video/temperatureeffect.cpp \ io/crc32.cpp \ dialogs/loaddialog.cpp \ - debug.cpp + debug.cpp \ + io/path.cpp HEADERS += \ mainwindow.h \ @@ -153,7 +154,8 @@ HEADERS += \ effects/video/temperatureeffect.h \ io/crc32.h \ dialogs/loaddialog.h \ - debug.h + debug.h \ + io/path.h FORMS += \ mainwindow.ui \ diff --git a/panels/effectcontrols.cpp b/panels/effectcontrols.cpp index 883d6afb8..fc944f1fa 100644 --- a/panels/effectcontrols.cpp +++ b/panels/effectcontrols.cpp @@ -263,7 +263,7 @@ void EffectControls::on_add_audio_transition_button_clicked() show_effect_menu(false, true); } -void EffectControls::resizeEvent(QResizeEvent *event) { +void EffectControls::resizeEvent(QResizeEvent*) { ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->height() - ui->keyframeView->height() - ui->headers->height())); } diff --git a/playback/audio.cpp b/playback/audio.cpp index 74ed5e8d3..da96cba23 100644 --- a/playback/audio.cpp +++ b/playback/audio.cpp @@ -319,6 +319,6 @@ void stop_recording() { } } -const QString& get_recorded_audio_filename() { +QString get_recorded_audio_filename() { return output_recording.fileName(); } diff --git a/playback/audio.h b/playback/audio.h index 9fb47b91d..be96ed74b 100644 --- a/playback/audio.h +++ b/playback/audio.h @@ -48,7 +48,7 @@ int get_buffer_offset_from_frame(Sequence *s, long frame); bool start_recording(); void stop_recording(); -const QString& get_recorded_audio_filename(); +QString get_recorded_audio_filename(); extern bool recording; #endif // AUDIO_H diff --git a/playback/playback.cpp b/playback/playback.cpp index 4f66e1f36..d88ad52ab 100644 --- a/playback/playback.cpp +++ b/playback/playback.cpp @@ -114,8 +114,7 @@ void get_clip_frame(Clip* c, long playhead) { MediaStream* ms = static_cast(c->media)->get_stream_from_file_index(c->track < 0, c->media_stream); int64_t target_pts = playhead_to_timestamp(c, playhead); - int64_t second_pts = qRound64(av_q2d(av_inv_q(c->stream->time_base))); - int64_t quarter_pts = second_pts >> 2; + int64_t second_pts = qRound64(av_q2d(av_inv_q(c->stream->time_base))); if (ms->video_interlacing != VIDEO_PROGRESSIVE) { target_pts *= 2; second_pts *= 2;