summaryrefslogtreecommitdiff
path: root/gtk2_ardour/session_archive_dialog.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-10-03 02:20:33 +0200
committerRobin Gareus <robin@gareus.org>2017-10-03 02:24:19 +0200
commitf9710f4624bd4147ab6ab846301bcdbd65ddf2a6 (patch)
tree7084408722dc90acc3857c0659b7a4b6034a2917 /gtk2_ardour/session_archive_dialog.cc
parent0802a0872f07df44dfacffe4aec2ebe8aa7d9a7d (diff)
Update Session-Archive Dialog: add compression-option
Diffstat (limited to 'gtk2_ardour/session_archive_dialog.cc')
-rw-r--r--gtk2_ardour/session_archive_dialog.cc92
1 files changed, 69 insertions, 23 deletions
diff --git a/gtk2_ardour/session_archive_dialog.cc b/gtk2_ardour/session_archive_dialog.cc
index 9e2df17eba..77f7da4933 100644
--- a/gtk2_ardour/session_archive_dialog.cc
+++ b/gtk2_ardour/session_archive_dialog.cc
@@ -19,8 +19,7 @@
*/
#include <gtkmm/stock.h>
-
-#include "ardour/session.h"
+#include <gtkmm/table.h>
#include "session_archive_dialog.h"
@@ -39,9 +38,6 @@ SessionArchiveDialog::SessionArchiveDialog ()
vbox->set_spacing (6);
- HBox* hbox;
- Label* label;
-
format_selector.append_text (".tar.xz");
format_selector.set_active_text (".tar.xz");
@@ -50,34 +46,56 @@ SessionArchiveDialog::SessionArchiveDialog ()
encode_selector.append_text (_("FLAC 24bit"));
encode_selector.set_active_text ("FLAC 16bit"); // TODO remember
- hbox = manage (new HBox);
+ compression_selector.append_text (_("None"));
+ compression_selector.append_text (_("Fast"));
+ compression_selector.append_text (_("Good"));
+ compression_selector.set_active_text ("Good"); // TODO remember
+
+ Gtk::Table* table = manage (new Gtk::Table ());
+ table->set_col_spacings (10);
+ table->set_row_spacings (8);
+
+ Label* label;
+ int row = 0;
+
+ label = manage (new Label (_("Archive Name:"), Gtk::ALIGN_END, Gtk::ALIGN_CENTER, false));
+ table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
+
+ HBox* hbox = manage (new HBox);
hbox->set_spacing (6);
- label = manage (new Label (_("Archive Name")));
- hbox->pack_start (*label, false, false);
hbox->pack_start (name_entry, true, true);
hbox->pack_start (format_selector, false, false);
- vbox->pack_start (*hbox, false, false);
+ table->attach (*hbox, 1, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
- hbox = manage (new HBox);
- hbox->set_spacing (6);
- label = manage (new Label (_("Target directory/folder")));
- hbox->pack_start (*label, false, false);
- hbox->pack_start (target_folder_selector, true, true);
- vbox->pack_start (*hbox, false, false);
+ ++row;
- hbox = manage (new HBox);
- hbox->set_spacing (6);
- label = manage (new Label (_("Audio Compression")));
- hbox->pack_start (*label, false, false);
- hbox->pack_start (encode_selector, true, true);
- vbox->pack_start (*hbox, false, false);
+ label = manage (new Label (_("Target directory/folder:"), Gtk::ALIGN_END, Gtk::ALIGN_CENTER, false));
+ table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
+ table->attach (target_folder_selector, 1, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
+
+ ++row;
+
+ label = manage (new Label (_("Audio Compression:"), Gtk::ALIGN_END, Gtk::ALIGN_CENTER, false));
+ table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
+ table->attach (encode_selector, 1, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
+
+ ++row;
+
+ label = manage (new Label (_("Archive Compression:"), Gtk::ALIGN_END, Gtk::ALIGN_CENTER, false));
+ table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
+ table->attach (compression_selector, 1, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
+
+ ++row;
- vbox->pack_start (only_used_checkbox, false, false);
+ table->attach (only_used_checkbox, 0, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
+
+ ++row;
label = manage (new Label (_("Note: This archives only the current session state, snapshots are not included."), ALIGN_START));
label->set_line_wrap (true);
- vbox->pack_start (*label, false, false);
+ table->attach (*label, 0, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
+ vbox->pack_start (*table, false, false);
vbox->pack_start (progress_bar, true, true, 12);
vbox->show_all ();
@@ -180,6 +198,34 @@ SessionArchiveDialog::set_encode_option (ARDOUR::Session::ArchiveEncode e)
}
}
+PBD::FileArchive::CompressionLevel
+SessionArchiveDialog::compression_level () const
+{
+ string codec = compression_selector.get_active_text ();
+ if (codec == _("Fast")) {
+ return PBD::FileArchive::CompressFast;
+ } else if (codec == _("None")) {
+ return PBD::FileArchive::CompressNone;
+ }
+ return PBD::FileArchive::CompressGood;
+}
+
+void
+SessionArchiveDialog::set_compression_level (PBD::FileArchive::CompressionLevel l)
+{
+ switch (l) {
+ case PBD::FileArchive::CompressFast:
+ encode_selector.set_active_text (_("Fast"));
+ break;
+ case PBD::FileArchive::CompressNone:
+ encode_selector.set_active_text (_("None"));
+ break;
+ case PBD::FileArchive::CompressGood:
+ encode_selector.set_active_text (_("Good"));
+ break;
+ }
+}
+
void
SessionArchiveDialog::update_progress_gui (float p)
{