From 0163d181d41483d400f6ed6dfec58f193d2c5e97 Mon Sep 17 00:00:00 2001 From: Andreas Butti Date: Fri, 23 Nov 2018 13:15:35 +0100 Subject: [PATCH] Add audio folder to settings --- src/control/settings/Settings.cpp | 27 +++++++++++ src/control/settings/Settings.h | 8 ++++ src/gui/dialog/SettingsDialog.cpp | 9 ++-- ui/pixmaps/object-play.svg | 56 +++++++++++++++++----- ui/pixmaps/object-select.svg | 18 +++---- ui/settings.glade | 78 +++++++++++++++++++++++++++++-- 6 files changed, 170 insertions(+), 26 deletions(-) diff --git a/src/control/settings/Settings.cpp b/src/control/settings/Settings.cpp index 02ad46d6..cfe24974 100644 --- a/src/control/settings/Settings.cpp +++ b/src/control/settings/Settings.cpp @@ -344,6 +344,10 @@ void Settings::parseItem(xmlDocPtr doc, xmlNodePtr cur) { this->sizeUnit = (const char*) value; } + else if (xmlStrcmp(name, (const xmlChar*) "audioFolder") == 0) + { + this->audioFolder = (const char*) value; + } else if (xmlStrcmp(name, (const xmlChar*) "autosaveEnabled") == 0) { this->autosaveEnabled = xmlStrcmp(value, (const xmlChar*) "true") ? false : true; @@ -735,6 +739,8 @@ void Settings::save() WRITE_STRING_PROP(sizeUnit); + WRITE_STRING_PROP(audioFolder); + xmlNodePtr xmlFont; xmlFont = xmlNewChild(root, NULL, (const xmlChar*) "property", NULL); xmlSetProp(xmlFont, (const xmlChar*) "name", (const xmlChar*) "font"); @@ -1095,6 +1101,27 @@ void Settings::setPageTemplate(string pageTemplate) save(); } +string Settings::getAudioFolder() +{ + XOJ_CHECK_TYPE(Settings); + + return this->audioFolder; +} + +void Settings::setAudioFolder(string audioFolder) +{ + XOJ_CHECK_TYPE(Settings); + + if (this->audioFolder == audioFolder) + { + return; + } + + this->audioFolder = audioFolder; + + save(); +} + string Settings::getSizeUnit() { XOJ_CHECK_TYPE(Settings); diff --git a/src/control/settings/Settings.h b/src/control/settings/Settings.h index b012cab4..1fba7916 100644 --- a/src/control/settings/Settings.h +++ b/src/control/settings/Settings.h @@ -265,6 +265,9 @@ public: string getPageTemplate(); void setPageTemplate(string pageTemplate); + string getAudioFolder(); + void setAudioFolder(string audioFolder); + /** * Get name, e.g. "cm" */ @@ -503,6 +506,11 @@ private: */ string sizeUnit; + /** + * Audio folder for audio recording + */ + string audioFolder; + /** * "Transaction" running, do not save until the end is reached */ diff --git a/src/gui/dialog/SettingsDialog.cpp b/src/gui/dialog/SettingsDialog.cpp index 9eae4a74..ed150927 100644 --- a/src/gui/dialog/SettingsDialog.cpp +++ b/src/gui/dialog/SettingsDialog.cpp @@ -156,6 +156,8 @@ void SettingsDialog::load() string txt = settings->getDefaultSaveName(); gtk_entry_set_text(GTK_ENTRY(txtDefaultSaveName), txt.c_str()); + gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(get("fcAudioPath")), settings->getAudioFolder().c_str()); + GtkWidget* spAutosaveTimeout = get("spAutosaveTimeout"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spAutosaveTimeout), settings->getAutosaveTimeout()); @@ -325,9 +327,10 @@ void SettingsDialog::save() updateHideString(settings->getPresentationHideElements(), hidePresentationMenubar, hidePresentationSidebar)); - GtkWidget* txtDefaultSaveName = get("txtDefaultSaveName"); - const char* txt = gtk_entry_get_text(GTK_ENTRY(txtDefaultSaveName)); - settings->setDefaultSaveName(txt); + settings->setDefaultSaveName(gtk_entry_get_text(GTK_ENTRY(get("txtDefaultSaveName")))); + char* uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(get("fcAudioPath"))); + settings->setAudioFolder(uri); + g_free(uri); GtkWidget* spAutosaveTimeout = get("spAutosaveTimeout"); int autosaveTimeout = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spAutosaveTimeout)); diff --git a/ui/pixmaps/object-play.svg b/ui/pixmaps/object-play.svg index ddc58536..7e0b942b 100644 --- a/ui/pixmaps/object-play.svg +++ b/ui/pixmaps/object-play.svg @@ -56,7 +56,7 @@ y2="43.877998" gradientUnits="userSpaceOnUse" x2="18.037001" - gradientTransform="matrix(0.39361236,0,0,0.33555353,-8.5232687,-0.07301647)" + gradientTransform="matrix(0.61021244,0,0,0.51936283,-21.290976,-16.216856)" y1="14.511" x1="18.037001"> + + + + + + + + diff --git a/ui/pixmaps/object-select.svg b/ui/pixmaps/object-select.svg index 9321ee24..1e03cc96 100644 --- a/ui/pixmaps/object-select.svg +++ b/ui/pixmaps/object-select.svg @@ -13,7 +13,7 @@ viewBox="0 0 17.6 17.6" preserveAspectRatio="xMidYMid meet" id="svg2" - inkscape:version="0.48.4 r9939" + inkscape:version="0.91 r13725" sodipodi:docname="object-select.svg"> @@ -26,13 +26,13 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1280" - inkscape:window-height="1000" + inkscape:window-width="1920" + inkscape:window-height="1176" id="namedview10" showgrid="false" - inkscape:zoom="16.68772" - inkscape:cx="-8.8740851" - inkscape:cy="9.1658497" + inkscape:zoom="11.313709" + inkscape:cx="4.109418" + inkscape:cy="10.757146" inkscape:window-x="0" inkscape:window-y="24" inkscape:window-maximized="1" @@ -50,8 +50,8 @@ Created by potrace 1.11, written by Peter Selinger 2001-2013 diff --git a/ui/settings.glade b/ui/settings.glade index 9585bced..6886d2a1 100644 --- a/ui/settings.glade +++ b/ui/settings.glade @@ -1593,9 +1593,6 @@ Here you can disable your touchscreen.</i> - - - True @@ -1619,6 +1616,81 @@ Here you can disable your touchscreen.</i> False + + + True + False + vertical + 10 + + + True + False + <i>If audio recording is running the time possitions are stored to the written Text and can be replayed. +The Audio track is recorded to a separate folder, and liked to there.</i> + True + 0 + + + False + True + 0 + + + + + True + False + 10 + 10 + + + True + False + Audio Folder + 0 + + + 0 + 0 + + + + + True + False + True + select-folder + Select Folder + + + 1 + 0 + + + + + False + True + 1 + + + + + 7 + + + + + True + False + Audio Recording + + + 7 + False + + True