pick your export filename; better file save defaults
parent
8f55ef577b
commit
70da8cefd6
1
notes
1
notes
|
@ -32,7 +32,6 @@ parameters {
|
|||
|
||||
TODO {
|
||||
immediate frontburner {
|
||||
non-hardcoded export path
|
||||
reimplement sample import to IPC from standalone ffmpeg since QAudioDecoder is partially broken on arch and completely broken on macOS
|
||||
|
||||
distortion effect
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Xybrid::Data {
|
|||
QString comment;
|
||||
|
||||
QString fileName;
|
||||
QString exportFileName;
|
||||
|
||||
double tempo = 140.0;
|
||||
TimeSignature time;
|
||||
|
|
|
@ -38,8 +38,10 @@ namespace {
|
|||
constexpr const uint32_t XYBRID_VERSION = packedVersion(0,0,0,1);
|
||||
}
|
||||
|
||||
const QString FileOps::Filter::project = u8"Xybrid project (*.xyp);;All files (*)";
|
||||
const QString FileOps::Filter::node = u8"Xybrid node (*.xyn);;All files (*)";
|
||||
const QString FileOps::Filter::project = qs("Xybrid project (*.xyp);;All files (*)");
|
||||
const QString FileOps::Filter::node = qs("Xybrid node (*.xyn);;All files (*)");
|
||||
|
||||
const QString FileOps::Filter::audio = qs("MPEG Layer 3 (*.mp3);;All files (*)");
|
||||
|
||||
QString FileOps::showOpenDialog(QWidget* parent, const QString& caption, const QString& directory, const QString& filter) {
|
||||
return QFileDialog::getOpenFileName(parent, caption, directory, filter); // just a wrapper for now
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace Xybrid::FileOps {
|
|||
namespace Filter {
|
||||
extern const QString project;
|
||||
extern const QString node;
|
||||
|
||||
extern const QString audio;
|
||||
}
|
||||
QString showOpenDialog(QWidget* parent = nullptr, const QString& caption = QString(), const QString& directory = QString(), const QString& filter = QString());
|
||||
QString showSaveAsDialog(QWidget* parent = nullptr, const QString& caption = QString(), const QString& directory = QString(), const QString& filter = QString(), const QString& suffix = QString());
|
||||
|
|
|
@ -121,11 +121,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
}
|
||||
});
|
||||
|
||||
// TODO: temp: render shortcut
|
||||
connect(new QShortcut(QKeySequence("Ctrl+E"), this), &QShortcut::activated, this, [this]() {
|
||||
audioEngine->render(project, Config::Directories::projects % "/testOut.mp3");
|
||||
});
|
||||
|
||||
//ui->menuBar->setStyleSheet("QMenuBar { background: transparent; vertical-align: center; } QMenuBar::item { } QMenuBar::item:!pressed { background: transparent; }");
|
||||
}
|
||||
|
||||
|
@ -483,13 +478,37 @@ void MainWindow::menuFileSave() {
|
|||
}
|
||||
|
||||
void MainWindow::menuFileSaveAs() {
|
||||
if (auto fileName = FileOps::showSaveAsDialog(this, "Save project as...", Config::Directories::projects, FileOps::Filter::project, "xyp"); !fileName.isEmpty()) {
|
||||
QString saveDir = Config::Directories::projects;
|
||||
if (!project->fileName.isEmpty()) {
|
||||
QFileInfo f(project->fileName);
|
||||
saveDir = f.dir().filePath(f.baseName());
|
||||
}
|
||||
if (auto fileName = FileOps::showSaveAsDialog(this, "Save project as...", saveDir, FileOps::Filter::project, "xyp"); !fileName.isEmpty()) {
|
||||
FileOps::saveProject(project, fileName);
|
||||
undoStack->setClean();
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::menuFileExport() {
|
||||
if (project->exportFileName.isEmpty()) menuFileExportAs();
|
||||
else {
|
||||
audioEngine->render(project, project->exportFileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::menuFileExportAs() {
|
||||
QString saveDir = Config::Directories::projects;
|
||||
if (!project->fileName.isEmpty()) {
|
||||
QFileInfo f(project->fileName);
|
||||
saveDir = f.dir().filePath(f.baseName());
|
||||
}
|
||||
if (auto fileName = FileOps::showSaveAsDialog(this, "Save project as...", saveDir, FileOps::Filter::audio, "mp3"); !fileName.isEmpty()) {
|
||||
project->exportFileName = fileName;
|
||||
audioEngine->render(project, project->exportFileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::menuFileNewWindow() {
|
||||
auto w = new MainWindow();
|
||||
w->show();
|
||||
|
|
|
@ -65,6 +65,9 @@ namespace Xybrid {
|
|||
void menuFileSave();
|
||||
void menuFileSaveAs();
|
||||
|
||||
void menuFileExport();
|
||||
void menuFileExportAs();
|
||||
|
||||
void menuFileNewWindow();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -835,6 +835,9 @@
|
|||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExport"/>
|
||||
<addaction name="actionExport_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNew_Window"/>
|
||||
<addaction name="actionClose_Window"/>
|
||||
</widget>
|
||||
|
@ -898,7 +901,7 @@
|
|||
</action>
|
||||
<action name="actionNew_Window">
|
||||
<property name="text">
|
||||
<string>New Window</string>
|
||||
<string>New &Window</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+N</string>
|
||||
|
@ -906,12 +909,28 @@
|
|||
</action>
|
||||
<action name="actionClose_Window">
|
||||
<property name="text">
|
||||
<string>Close Window</string>
|
||||
<string>&Close Window</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport_As">
|
||||
<property name="text">
|
||||
<string>E&xport As...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+E</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
@ -1032,6 +1051,38 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionExport</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>menuFileExport()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>459</x>
|
||||
<y>305</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionExport_As</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>menuFileExportAs()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>459</x>
|
||||
<y>305</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>menuFileNew()</slot>
|
||||
|
@ -1039,5 +1090,7 @@
|
|||
<slot>menuFileSave()</slot>
|
||||
<slot>menuFileSaveAs()</slot>
|
||||
<slot>menuFileNewWindow()</slot>
|
||||
<slot>menuFileExport()</slot>
|
||||
<slot>menuFileExportAs()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in New Issue