From 44ee1966fb400dca1085e1e63d6305a5878414b7 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 16 Dec 2018 19:10:13 +0100 Subject: [PATCH] Fix a Clang error. --- futatabi/mainwindow.cpp | 30 +++++++++++++++--------------- futatabi/mainwindow.h | 4 ++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/futatabi/mainwindow.cpp b/futatabi/mainwindow.cpp index 9e21294..23840ff 100644 --- a/futatabi/mainwindow.cpp +++ b/futatabi/mainwindow.cpp @@ -32,17 +32,6 @@ static PlayList *playlist_clips; extern int64_t current_pts; -template -void replace_model(QTableView *view, Model **model, Model *new_model, MainWindow *main_window) -{ - QItemSelectionModel *old_selection_model = view->selectionModel(); - view->setModel(new_model); - delete *model; - delete old_selection_model; - *model = new_model; - main_window->connect(new_model, &Model::any_content_changed, main_window, &MainWindow::content_changed); -} - MainWindow::MainWindow() : ui(new Ui::MainWindow), db(global_flags.working_directory + "/futatabi.db") @@ -943,8 +932,8 @@ void MainWindow::undo_triggered() StateProto state = undo_stack.back(); ui->undo_action->setEnabled(undo_stack.size() > 1); - replace_model(ui->clip_list, &cliplist_clips, new ClipList(state.clip_list()), this); - replace_model(ui->playlist, &playlist_clips, new PlayList(state.play_list()), this); + replace_model(ui->clip_list, &cliplist_clips, new ClipList(state.clip_list())); + replace_model(ui->playlist, &playlist_clips, new PlayList(state.play_list())); db.store_state(state); } @@ -962,8 +951,8 @@ void MainWindow::redo_triggered() ui->redo_action->setEnabled(!redo_stack.empty()); const StateProto &state = undo_stack.back(); - replace_model(ui->clip_list, &cliplist_clips, new ClipList(state.clip_list()), this); - replace_model(ui->playlist, &playlist_clips, new PlayList(state.play_list()), this); + replace_model(ui->clip_list, &cliplist_clips, new ClipList(state.clip_list())); + replace_model(ui->playlist, &playlist_clips, new PlayList(state.play_list())); db.store_state(state); } @@ -1023,3 +1012,14 @@ pair MainWindow::get_queue_status() const { lock_guard lock(queue_status_mu); return {queue_status, "text/plain"}; } + +template +void MainWindow::replace_model(QTableView *view, Model **model, Model *new_model) +{ + QItemSelectionModel *old_selection_model = view->selectionModel(); + view->setModel(new_model); + delete *model; + delete old_selection_model; + *model = new_model; + connect(new_model, &Model::any_content_changed, this, &MainWindow::content_changed); +} diff --git a/futatabi/mainwindow.h b/futatabi/mainwindow.h index 9e77d62..7987456 100644 --- a/futatabi/mainwindow.h +++ b/futatabi/mainwindow.h @@ -20,6 +20,7 @@ class MainWindow; } // namespace Ui class Player; +class QTableView; class MainWindow : public QMainWindow { Q_OBJECT @@ -118,6 +119,9 @@ private: void highlight_camera_input(int stream_idx); + template + void replace_model(QTableView *view, Model **model, Model *new_model); + private slots: void relayout(); }; -- 2.39.2