Speed-up the BrowseDialog
This commit is contained in:
parent
95ff470248
commit
2756d57390
3 changed files with 11 additions and 6 deletions
|
@ -11,20 +11,22 @@
|
|||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QTreeView>
|
||||
|
||||
BrowseDialog::BrowseDialog (QWidget *parent) : QDialog (parent)
|
||||
{
|
||||
setSizeGripEnabled(true);
|
||||
QGridLayout *grid = new QGridLayout (this);
|
||||
|
||||
m_list = new QListView (this);
|
||||
m_list = new QTreeView (this);
|
||||
|
||||
m_model = new BrowseModel (this);
|
||||
m_list->setModel (m_model);
|
||||
m_list->setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
m_list->setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||
m_list->setWrapping (true);
|
||||
m_list->setResizeMode (QListView::Adjust);
|
||||
// m_list->setWrapping (true);
|
||||
m_list->setIndentation (0);
|
||||
//m_list->setResizeMode (QListView::Adjust);
|
||||
m_list->setEditTriggers (QAbstractItemView::EditKeyPressed);
|
||||
m_list->setContextMenuPolicy (Qt::CustomContextMenu);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "BrowseModel.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTreeView>
|
||||
#include <QListView>
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
|
@ -27,7 +28,7 @@ class BrowseDialog : public QDialog
|
|||
QStringList getFiles ();
|
||||
|
||||
private:
|
||||
QListView *m_list;
|
||||
QTreeView *m_list;
|
||||
QComboBox *m_lookInCombo;
|
||||
QLineEdit *m_lookInEdit;
|
||||
QLineEdit *m_fileNameEdit;
|
||||
|
|
|
@ -86,12 +86,12 @@ BrowseModel::list_cb (const Xmms::List< Xmms::Dict > &res)
|
|||
|
||||
QString name;
|
||||
if (d.contains ("name")) {
|
||||
name = QString::fromStdString ((*res).get<std::string> ("name"));
|
||||
name = QString::fromStdString (d.get<std::string> ("name"));
|
||||
} else {
|
||||
name = path.mid (path.lastIndexOf ("/")+1);
|
||||
}
|
||||
|
||||
bool isdir = (*res).get<int32_t> ("isdir");
|
||||
bool isdir = d.get<int32_t> ("isdir");
|
||||
|
||||
if (m_filter_dot && name.startsWith ("."))
|
||||
// skip these files
|
||||
|
@ -104,6 +104,8 @@ BrowseModel::list_cb (const Xmms::List< Xmms::Dict > &res)
|
|||
|
||||
emit dirChanged (m_current_dir);
|
||||
|
||||
qDebug ("done");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue