Commit ec75fed9 authored by Jason Wood's avatar Jason Wood

Was previously persisting the popup menu across shows - this kind of cacheing...

Was previously persisting the popup menu across shows - this kind of cacheing is dangerous, as the menu may become invlidated if, for example, the interface is rebuilt. Now, the popup menu is requested on demand.

svn path=/trunk/kdenlive/; revision=271
parent e4939610
......@@ -36,36 +36,35 @@
#include <map>
ProjectList::ProjectList(KdenliveApp *app, KdenliveDoc *document, QWidget *parent, const char *name) :
ProjectList_UI(parent,name)
ProjectList_UI(parent,name),
m_app(app),
m_document(document)
{
if(!document) {
kdError() << "ProjectList created with no document - expect a crash shortly" << endl;
}
m_document = document;
m_listView->setDocument(document);
connect (m_listView, SIGNAL(dragDropOccured(QDropEvent *)), this, SIGNAL(dragDropOccured(QDropEvent *)));
m_menu = (QPopupMenu *)app->factory()->container("projectlist_context", app);
connect(m_listView, SIGNAL(rightButtonPressed ( QListViewItem *, const QPoint &, int )),
this, SLOT(rightButtonPressed ( QListViewItem *, const QPoint &, int )));
this, SLOT(rightButtonPressed ( QListViewItem *, const QPoint &, int )));
connect(m_listView, SIGNAL(executed(QListViewItem *)), this, SLOT(projectListSelectionChanged(QListViewItem *)));
connect(m_listView, SIGNAL(dragStarted(QListViewItem *)), this, SLOT(projectListSelectionChanged(QListViewItem *)));
connect(m_listView, SIGNAL(executed(QListViewItem *)), this, SLOT(projectListSelectionChanged(QListViewItem *)));
connect(m_listView, SIGNAL(dragStarted(QListViewItem *)), this, SLOT(projectListSelectionChanged(QListViewItem *)));
}
ProjectList::~ProjectList()
{
delete m_menu;
}
/** No descriptions */
void ProjectList::rightButtonPressed ( QListViewItem *listViewItem, const QPoint &pos, int column) {
if(m_menu) {
m_menu->popup(QCursor::pos());
}
QPopupMenu *menu = contextMenu();
if(menu) {
menu->popup(QCursor::pos());
}
}
/** Get a fresh copy of files from KdenliveDoc and display them. */
......@@ -105,3 +104,9 @@ const AVFile *ProjectList::currentSelection() const
return 0;
}
QPopupMenu *ProjectList::contextMenu()
{
QPopupMenu *menu = (QPopupMenu *)m_app->factory()->container("projectlist_context", m_app);
return menu;
}
......@@ -42,29 +42,30 @@ class ProjectList : public ProjectList_UI {
public:
ProjectList(KdenliveApp *app, KdenliveDoc *document, QWidget *parent=0, const char *name=0);
~ProjectList();
/** Returns the currently selected clip in the project list. */
const AVFile *currentSelection() const;
/** Returns the currently selected clip in the project list. */
const AVFile *currentSelection() const;
private: // Private methods
/** Holds the document that this projectlist makes use of. */
KdenliveDoc * m_document;
/** The popup menu */
QPopupMenu *m_menu;
/** Holds the document that this projectlist makes use of. */
KdenliveDoc * m_document;
/** Holds a pointer to the application. FIXME: Is this necessary? */
KdenliveApp *m_app;
/** return a popup menu. Must be deleted by owner.*/
QPopupMenu *contextMenu();
public slots: // Public slots
/** No descriptions */
void rightButtonPressed ( QListViewItem *listViewItem, const QPoint &pos, int column) ;
/** Get a fresh copy of files and clips from KdenliveDoc and display them. */
void slot_UpdateList();
/** The AVFile specified has changed - update the display.
*/
void slot_avFileChanged(AVFile *file);
/** No descriptions */
void rightButtonPressed ( QListViewItem *listViewItem, const QPoint &pos, int column) ;
/** Get a fresh copy of files and clips from KdenliveDoc and display them. */
void slot_UpdateList();
/** The AVFile specified has changed - update the display. */
void slot_avFileChanged(AVFile *file);
signals: // Signals
/** this signal is called when a number of clips have been dropped onto the project list view. */
void dragDropOccured(QDropEvent *drop);
/** This signal is emitted when an AVFile is selected in the project list. */
void AVFileSelected(AVFile *file);
/** this signal is called when a number of clips have been dropped onto the project list view. */
void dragDropOccured(QDropEvent *drop);
/** This signal is emitted when an AVFile is selected in the project list. */
void AVFileSelected(AVFile *file);
private slots: // Private slots
/** Called when the project list changes. */
void projectListSelectionChanged(QListViewItem *item);
/** Called when the project list changes. */
void projectListSelectionChanged(QListViewItem *item);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment