From ae4822fd8dbfc51db9a3dda4fc251fefb33508a5 Mon Sep 17 00:00:00 2001 From: Vescrity Date: Tue, 14 May 2024 10:21:32 +0800 Subject: [PATCH] Status bar & File save --- workspace/editor.cpp | 14 ++++++++++++-- workspace/editor.ui | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/workspace/editor.cpp b/workspace/editor.cpp index a039174..7b2724c 100644 --- a/workspace/editor.cpp +++ b/workspace/editor.cpp @@ -1,6 +1,6 @@ #include "editor.h" #include "ui_editor.h" - +#include Editor::Editor(QWidget *parent, const NoteList &l) : QMainWindow(parent), ui(new Ui::Editor), current_list(l) { @@ -11,6 +11,9 @@ Editor::Editor(QWidget *parent, const NoteList &l) current_list.set_bpm(100); } ui->bpmSpinBox->setValue(current_list.get_bpm()); + numerator = ui->numeratorSpinBox->value(); + power2 = ui->power2Box->currentIndex(); + ui->statusBar->showMessage(tr("初始化已完成")); } Editor::~Editor() @@ -25,7 +28,14 @@ void Editor::set_list(const NoteList &l) void Editor::on_actionMidi_triggered() { - current_list.save_midi("temp.mid", numerator, power2); + QString fname=QFileDialog::getSaveFileName(this,tr("保存文件"),QDir::currentPath(),tr("MIDI 文件(*.mid)")); + if(!fname.isEmpty()){ + current_list.save_midi(fname.toStdString(), numerator, power2); + ui->statusBar->showMessage(tr("文件已导出")); + } + else{ + ui->statusBar->showMessage(tr("导出已取消")); + } } void Editor::on_power2Box_currentIndexChanged(int index) diff --git a/workspace/editor.ui b/workspace/editor.ui index bbd4023..2b4ca6d 100644 --- a/workspace/editor.ui +++ b/workspace/editor.ui @@ -19,6 +19,9 @@ + + <html><head/><body><p>拍数/分钟。</p><p>改变此值只会影响 midi 的 bpm 信息而不会影响实际播放速度。</p></body></html> + bpm: @@ -110,12 +113,13 @@ - 摆设 + 关于 + Midi