Skip to content

Commit

Permalink
Seems to be working well.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvansickle committed Dec 15, 2017
1 parent 15fd511 commit a2efa91
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 1 addition & 2 deletions gui/CollectionDockWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class PlaylistItem: public QStandardItem
public:
PlaylistItem(MDIPlaylistView* view)
{
//playlist_model: PlaylistModel = model;
playlist_view = view;

setData(QIcon::fromTheme("folder"), Qt::DecorationRole);
Expand All @@ -83,7 +82,7 @@ class PlaylistItem: public QStandardItem
// Get the data we need from the model we're connected to
if(role == Qt::EditRole || role == Qt::DisplayRole)
{
return QVariant(playlist_view->userFriendlyCurrentFile());
return QVariant(playlist_view->getDisplayName());
}
else if(role == Qt::ToolTipRole)
{
Expand Down
5 changes: 5 additions & 0 deletions gui/MDINowPlayingView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ MDINowPlayingView::MDINowPlayingView(QWidget *parent) : MDIPlaylistView(parent)
{

}

QString MDINowPlayingView::getDisplayName() const
{
return "Now Playing";
}
2 changes: 2 additions & 0 deletions gui/MDINowPlayingView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class MDINowPlayingView : public MDIPlaylistView

public:
MDINowPlayingView(QWidget *parent);

QString getDisplayName() const override;
};


Expand Down
11 changes: 8 additions & 3 deletions gui/MDITreeViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ static qint64 sequenceNumber = 0;
m_current_url = QUrl(getNewFilenameTemplate().arg(sequenceNumber));
sequenceNumber += 1;

// Set the window title to the default filename, plus the Qt "is modified" placeholder.
setWindowTitle(userFriendlyCurrentFile() + "[*]");
// Set the window title to the Display Name, which defaults to the filename, plus the Qt "is modified" placeholder.
setWindowTitle(getDisplayName() + "[*]");

/// @todo Connect a contentsChanged signal to a docWasModified slot here?
}
Expand Down Expand Up @@ -196,7 +196,12 @@ void MDITreeViewBase::setCurrentFile(QUrl url)
m_isUntitled = false;
setWindowFilePath(url.toString());
setWindowModified(false);
setWindowTitle(userFriendlyCurrentFile() + "[*]");
setWindowTitle(getDisplayName() + "[*]");
}

QString MDITreeViewBase::getDisplayName() const
{
return userFriendlyCurrentFile();
}

void MDITreeViewBase::closeEvent(QCloseEvent* event)
Expand Down
4 changes: 4 additions & 0 deletions gui/MDITreeViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class MDITreeViewBase : public QTreeView
/// Returns the full URL of this window's backing file.
QUrl getCurrentUrl() const;

/// Returns the name to be displayed as this view's windowTitle(), e.g. in tabs.
/// Default implementation returns userFriendlyCurrentFile().
virtual QString getDisplayName() const;

protected:

QUrl m_current_url;
Expand Down

0 comments on commit a2efa91

Please sign in to comment.