Commit 4dd828a3 authored by con's avatar con
Browse files

QuickOpenModel --> LocatorModel

parent 21f0f5ad
...@@ -74,10 +74,10 @@ namespace QuickOpen { ...@@ -74,10 +74,10 @@ namespace QuickOpen {
namespace Internal { namespace Internal {
/*! A model to represent the QuickOpen results. */ /*! A model to represent the QuickOpen results. */
class QuickOpenModel : public QAbstractListModel class LocatorModel : public QAbstractListModel
{ {
public: public:
QuickOpenModel(QObject *parent = 0) LocatorModel(QObject *parent = 0)
: QAbstractListModel(parent) : QAbstractListModel(parent)
// , mDisplayCount(64) // , mDisplayCount(64)
{} {}
...@@ -124,12 +124,12 @@ QT_END_NAMESPACE ...@@ -124,12 +124,12 @@ QT_END_NAMESPACE
// =========== QuickOpenModel =========== // =========== QuickOpenModel ===========
int QuickOpenModel::rowCount(const QModelIndex & /* parent */) const int LocatorModel::rowCount(const QModelIndex & /* parent */) const
{ {
return mEntries.size(); return mEntries.size();
} }
int QuickOpenModel::columnCount(const QModelIndex &parent) const int LocatorModel::columnCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : 2; return parent.isValid() ? 0 : 2;
} }
...@@ -140,7 +140,7 @@ int QuickOpenModel::columnCount(const QModelIndex &parent) const ...@@ -140,7 +140,7 @@ int QuickOpenModel::columnCount(const QModelIndex &parent) const
* FilterEntry::resolveFileIcon is true. FilterEntry::internalData is assumed * FilterEntry::resolveFileIcon is true. FilterEntry::internalData is assumed
* to be the filename. * to be the filename.
*/ */
QVariant QuickOpenModel::data(const QModelIndex &index, int role) const QVariant LocatorModel::data(const QModelIndex &index, int role) const
{ {
if (!index.isValid() || index.row() >= mEntries.size()) if (!index.isValid() || index.row() >= mEntries.size())
return QVariant(); return QVariant();
...@@ -168,7 +168,7 @@ QVariant QuickOpenModel::data(const QModelIndex &index, int role) const ...@@ -168,7 +168,7 @@ QVariant QuickOpenModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
void QuickOpenModel::setEntries(const QList<FilterEntry> &entries) void LocatorModel::setEntries(const QList<FilterEntry> &entries)
{ {
mEntries = entries; mEntries = entries;
reset(); reset();
...@@ -248,7 +248,7 @@ void CompletionList::updatePreferredSize() ...@@ -248,7 +248,7 @@ void CompletionList::updatePreferredSize()
LocatorWidget::LocatorWidget(LocatorPlugin *qop) : LocatorWidget::LocatorWidget(LocatorPlugin *qop) :
m_locatorPlugin(qop), m_locatorPlugin(qop),
m_quickOpenModel(new QuickOpenModel(this)), m_locatorModel(new LocatorModel(this)),
m_completionList(new CompletionList(this)), m_completionList(new CompletionList(this)),
m_filterMenu(new QMenu(this)), m_filterMenu(new QMenu(this)),
m_refreshAction(new QAction(tr("Refresh"), this)), m_refreshAction(new QAction(tr("Refresh"), this)),
...@@ -283,7 +283,7 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) : ...@@ -283,7 +283,7 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) :
m_fileLineEdit->installEventFilter(this); m_fileLineEdit->installEventFilter(this);
this->installEventFilter(this); this->installEventFilter(this);
m_completionList->setModel(m_quickOpenModel); m_completionList->setModel(m_locatorModel);
m_completionList->header()->resizeSection(0, 300); m_completionList->header()->resizeSection(0, 300);
m_completionList->updatePreferredSize(); m_completionList->updatePreferredSize();
m_completionList->resize(m_completionList->preferredSize()); m_completionList->resize(m_completionList->preferredSize());
...@@ -412,9 +412,9 @@ void LocatorWidget::updateCompletionList(const QString &text) ...@@ -412,9 +412,9 @@ void LocatorWidget::updateCompletionList(const QString &text)
alreadyAdded.insert(entry); alreadyAdded.insert(entry);
} }
} }
m_quickOpenModel->setEntries(entries); m_locatorModel->setEntries(entries);
if (m_quickOpenModel->rowCount() > 0) { if (m_locatorModel->rowCount() > 0) {
m_completionList->setCurrentIndex(m_quickOpenModel->index(0, 0)); m_completionList->setCurrentIndex(m_locatorModel->index(0, 0));
} }
#if 0 #if 0
m_completionList->updatePreferredSize(); m_completionList->updatePreferredSize();
...@@ -428,7 +428,7 @@ void LocatorWidget::acceptCurrentEntry() ...@@ -428,7 +428,7 @@ void LocatorWidget::acceptCurrentEntry()
const QModelIndex index = m_completionList->currentIndex(); const QModelIndex index = m_completionList->currentIndex();
if (!index.isValid()) if (!index.isValid())
return; return;
const FilterEntry entry = m_quickOpenModel->data(index, Qt::UserRole).value<FilterEntry>(); const FilterEntry entry = m_locatorModel->data(index, Qt::UserRole).value<FilterEntry>();
m_completionList->hide(); m_completionList->hide();
entry.filter->accept(entry); entry.filter->accept(entry);
} }
......
...@@ -50,7 +50,7 @@ namespace Utils { ...@@ -50,7 +50,7 @@ namespace Utils {
namespace QuickOpen { namespace QuickOpen {
namespace Internal { namespace Internal {
class QuickOpenModel; class LocatorModel;
class CompletionList; class CompletionList;
class LocatorWidget class LocatorWidget
...@@ -82,7 +82,7 @@ private: ...@@ -82,7 +82,7 @@ private:
QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText); QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
LocatorPlugin *m_locatorPlugin; LocatorPlugin *m_locatorPlugin;
QuickOpenModel *m_quickOpenModel; LocatorModel *m_locatorModel;
CompletionList *m_completionList; CompletionList *m_completionList;
QMenu *m_filterMenu; QMenu *m_filterMenu;
......
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