Skip to content

Commit

Permalink
Refactor to QScopedPointer for HtmlEditor.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Jun 17, 2016
1 parent 36aa34b commit 1df44d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ MainWindow::MainWindow()
, m_keyerGroup(0)
, m_keyerMenu(0)
, m_isPlaylistLoaded(false)
, m_htmlEditor(0)
, m_exitCode(EXIT_SUCCESS)
, m_navigationPosition(0)
{
Expand Down Expand Up @@ -493,7 +492,6 @@ MainWindow& MainWindow::singleton()

MainWindow::~MainWindow()
{
delete m_htmlEditor;
delete ui;
Mlt::Controller::destroy();
}
Expand Down Expand Up @@ -2382,8 +2380,8 @@ void MainWindow::onGpuNotSupported()
void MainWindow::editHTML(const QString &fileName)
{
bool isNew = !m_htmlEditor;
if (!m_htmlEditor) {
m_htmlEditor = new HtmlEditor;
if (isNew) {
m_htmlEditor.reset(new HtmlEditor);
m_htmlEditor->setWindowIcon(windowIcon());
}
m_htmlEditor->load(fileName);
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MainWindow : public QMainWindow
static void changeTheme(const QString& theme);
PlaylistDock* playlistDock() const { return m_playlistDock; }
FilterController* filterController() const { return m_filterController; }
HtmlEditor* htmlEditor() const { return m_htmlEditor; }
HtmlEditor* htmlEditor() const { return m_htmlEditor.data(); }
Mlt::Playlist* playlist() const;
Mlt::Producer* multitrack() const;
void doAutosave();
Expand Down Expand Up @@ -133,7 +133,7 @@ class MainWindow : public QMainWindow
QStringList m_multipleFiles;
bool m_isPlaylistLoaded;
QActionGroup* m_languagesGroup;
HtmlEditor* m_htmlEditor;
QScopedPointer<HtmlEditor> m_htmlEditor;
QSharedPointer<AutoSaveFile> m_autosaveFile;
QMutex m_autosaveMutex;
QTimer m_autosaveTimer;
Expand Down

0 comments on commit 1df44d0

Please sign in to comment.