mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-06 13:24:16 -04:00
Fixed Q_ASSERT in SharedFilesDialog on Windows.
Load and save the view type (flat or tree) in SharedFilesDialog. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4127 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
85aad4c75b
commit
c21e13e68d
1 changed files with 81 additions and 76 deletions
|
@ -90,20 +90,20 @@ private:
|
||||||
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||||
: RsAutoUpdatePage(1000,parent)
|
: RsAutoUpdatePage(1000,parent)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
connect(ui.checkButton, SIGNAL(clicked()), this, SLOT(forceCheck()));
|
connect(ui.checkButton, SIGNAL(clicked()), this, SLOT(forceCheck()));
|
||||||
connect(ui.localButton, SIGNAL(toggled(bool)), this, SLOT(showFrame(bool)));
|
connect(ui.localButton, SIGNAL(toggled(bool)), this, SLOT(showFrame(bool)));
|
||||||
connect(ui.remoteButton, SIGNAL(toggled(bool)), this, SLOT(showFrameRemote(bool)));
|
connect(ui.remoteButton, SIGNAL(toggled(bool)), this, SLOT(showFrameRemote(bool)));
|
||||||
connect(ui.splittedButton, SIGNAL(toggled(bool)), this, SLOT(showFrameSplitted(bool)));
|
connect(ui.splittedButton, SIGNAL(toggled(bool)), this, SLOT(showFrameSplitted(bool)));
|
||||||
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
||||||
|
|
||||||
connect( ui.localDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sharedDirTreeWidgetContextMenu( QPoint ) ) );
|
connect( ui.localDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sharedDirTreeWidgetContextMenu( QPoint ) ) );
|
||||||
connect( ui.remoteDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirtreeviewCostumPopupMenu( QPoint ) ) );
|
connect( ui.remoteDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirtreeviewCostumPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
// connect( ui.remoteDirTreeView, SIGNAL( doubleClicked(const QModelIndex&)), this, SLOT( downloadRemoteSelected()));
|
// connect( ui.remoteDirTreeView, SIGNAL( doubleClicked(const QModelIndex&)), this, SLOT( downloadRemoteSelected()));
|
||||||
connect( ui.downloadButton, SIGNAL( clicked()), this, SLOT( downloadRemoteSelected()));
|
connect( ui.downloadButton, SIGNAL( clicked()), this, SLOT( downloadRemoteSelected()));
|
||||||
|
|
||||||
connect(ui.indicatorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indicatorChanged(int)));
|
connect(ui.indicatorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indicatorChanged(int)));
|
||||||
|
|
||||||
|
@ -115,54 +115,46 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||||
this, SLOT( checkForRemoteDirRequest( QTreeWidgetItem * ) ) );
|
this, SLOT( checkForRemoteDirRequest( QTreeWidgetItem * ) ) );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
tree_model = new TreeStyle_RDM(true);
|
||||||
|
flat_model = new FlatStyle_RDM(true);
|
||||||
|
|
||||||
tree_model = new TreeStyle_RDM(true);
|
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
|
||||||
flat_model = new FlatStyle_RDM(true);
|
tree_proxyModel->setDynamicSortFilter(true);
|
||||||
|
tree_proxyModel->setSourceModel(tree_model);
|
||||||
|
tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
tree_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
||||||
|
tree_proxyModel->sort(0);
|
||||||
|
|
||||||
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
|
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
|
||||||
tree_proxyModel->setDynamicSortFilter(true);
|
flat_proxyModel->setDynamicSortFilter(true);
|
||||||
tree_proxyModel->setSourceModel(tree_model);
|
flat_proxyModel->setSourceModel(flat_model);
|
||||||
tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
flat_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
tree_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
||||||
tree_proxyModel->sort(0);
|
flat_proxyModel->sort(0);
|
||||||
|
|
||||||
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
|
localModel = new TreeStyle_RDM(false);
|
||||||
flat_proxyModel->setDynamicSortFilter(true);
|
|
||||||
flat_proxyModel->setSourceModel(flat_model);
|
|
||||||
flat_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
|
||||||
flat_proxyModel->sort(0);
|
|
||||||
|
|
||||||
localModel = new TreeStyle_RDM(false);
|
localProxyModel = new SFDSortFilterProxyModel(localModel, this);
|
||||||
|
localProxyModel->setDynamicSortFilter(true);
|
||||||
|
localProxyModel->setSourceModel(localModel);
|
||||||
|
localProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
localProxyModel->setSortRole(RetroshareDirModel::SortRole);
|
||||||
|
localProxyModel->sort(0);
|
||||||
|
|
||||||
localProxyModel = new SFDSortFilterProxyModel(localModel, this);
|
ui.localDirTreeView->setModel(localProxyModel);
|
||||||
localProxyModel->setDynamicSortFilter(true);
|
|
||||||
localProxyModel->setSourceModel(localModel);
|
|
||||||
localProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
localProxyModel->setSortRole(RetroshareDirModel::SortRole);
|
|
||||||
localProxyModel->sort(0);
|
|
||||||
|
|
||||||
ui.localDirTreeView->setModel(localProxyModel);
|
connect( ui.localDirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), localModel, SLOT( collapsed(const QModelIndex & ) ) );
|
||||||
|
connect( ui.localDirTreeView, SIGNAL( expanded(const QModelIndex & ) ), localModel, SLOT( expanded(const QModelIndex & ) ) );
|
||||||
|
|
||||||
connect( ui.localDirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), localModel, SLOT( collapsed(const QModelIndex & ) ) );
|
connect( localModel, SIGNAL( layoutAboutToBeChanged() ), ui.localDirTreeView, SLOT( reset() ) );
|
||||||
connect( ui.localDirTreeView, SIGNAL( expanded(const QModelIndex & ) ), localModel, SLOT( expanded(const QModelIndex & ) ) );
|
connect( localModel, SIGNAL( layoutChanged() ), ui.localDirTreeView, SLOT( update() ) );
|
||||||
|
|
||||||
connect( localModel, SIGNAL( layoutAboutToBeChanged() ), ui.localDirTreeView, SLOT( reset() ) );
|
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||||
connect( localModel, SIGNAL( layoutChanged() ), ui.localDirTreeView, SLOT( update() ) );
|
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
|
||||||
|
connect(ui.filterPatternLineEdit, SIGNAL(returnPressed()), this, SLOT(startFilter()));
|
||||||
|
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
||||||
|
|
||||||
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
/* Set header resize modes and initial section sizes */
|
||||||
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
|
|
||||||
connect(ui.filterPatternLineEdit, SIGNAL(returnPressed()), this, SLOT(startFilter()));
|
|
||||||
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
|
||||||
|
|
||||||
// load settings
|
|
||||||
processSettings(true);
|
|
||||||
|
|
||||||
ui.remoteDirTreeView->setColumnHidden(3,false) ;
|
|
||||||
ui.remoteDirTreeView->setColumnHidden(4,true) ;
|
|
||||||
ui.localDirTreeView->setColumnHidden(4,true) ;
|
|
||||||
|
|
||||||
/* Set header resize modes and initial section sizes */
|
|
||||||
QHeaderView * l_header = ui.localDirTreeView->header () ;
|
QHeaderView * l_header = ui.localDirTreeView->header () ;
|
||||||
// l_header->setResizeMode (0, QHeaderView::Interactive);
|
// l_header->setResizeMode (0, QHeaderView::Interactive);
|
||||||
// l_header->setResizeMode (1, QHeaderView::Fixed);
|
// l_header->setResizeMode (1, QHeaderView::Fixed);
|
||||||
|
@ -176,41 +168,48 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||||
l_header->resizeSection ( 3, 100 );
|
l_header->resizeSection ( 3, 100 );
|
||||||
// l_header->resizeSection ( 4, 100 );
|
// l_header->resizeSection ( 4, 100 );
|
||||||
|
|
||||||
|
l_header->setStretchLastSection(false);
|
||||||
|
// l_header->setHighlightSections(false);
|
||||||
|
|
||||||
|
// Setup the current view model.
|
||||||
|
//
|
||||||
|
changeCurrentViewModel(ui.viewType_CB->currentIndex()) ;
|
||||||
|
|
||||||
/* Set header resize modes and initial section sizes */
|
/* Set header resize modes and initial section sizes */
|
||||||
QHeaderView * r_header = ui.remoteDirTreeView->header () ;
|
QHeaderView * r_header = ui.remoteDirTreeView->header () ;
|
||||||
|
|
||||||
r_header->setResizeMode (0, QHeaderView::Interactive);
|
r_header->setResizeMode (0, QHeaderView::Interactive);
|
||||||
r_header->setStretchLastSection(false);
|
r_header->setStretchLastSection(false);
|
||||||
l_header->setStretchLastSection(false);
|
|
||||||
|
|
||||||
// r_header->setResizeMode (1, QHeaderView::Fixed);
|
// r_header->setResizeMode (1, QHeaderView::Fixed);
|
||||||
// // r_header->setResizeMode (2, QHeaderView::Interactive);
|
// // r_header->setResizeMode (2, QHeaderView::Interactive);
|
||||||
// r_header->setResizeMode (3, QHeaderView::Fixed);
|
// r_header->setResizeMode (3, QHeaderView::Fixed);
|
||||||
// // r_header->setResizeMode (4, QHeaderView::Interactive);
|
// // r_header->setResizeMode (4, QHeaderView::Interactive);
|
||||||
|
|
||||||
|
|
||||||
r_header->resizeSection ( 0, 490 );
|
r_header->resizeSection ( 0, 490 );
|
||||||
r_header->resizeSection ( 1, 70 );
|
r_header->resizeSection ( 1, 70 );
|
||||||
r_header->resizeSection ( 2, 80 );
|
r_header->resizeSection ( 2, 80 );
|
||||||
r_header->resizeSection ( 3, 100 );
|
r_header->resizeSection ( 3, 100 );
|
||||||
r_header->resizeSection ( 4, 80 );
|
r_header->resizeSection ( 4, 80 );
|
||||||
|
|
||||||
// l_header->setHighlightSections(false);
|
|
||||||
// r_header->setHighlightSections(false);
|
// r_header->setHighlightSections(false);
|
||||||
|
|
||||||
|
/* Set Multi Selection */
|
||||||
/* Set Multi Selection */
|
ui.remoteDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
ui.remoteDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
ui.localDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
ui.localDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
||||||
|
|
||||||
//#ifdef RS_RELEASE_VERSION
|
//#ifdef RS_RELEASE_VERSION
|
||||||
// ui.filterLabel->hide();
|
// ui.filterLabel->hide();
|
||||||
// ui.filterPatternLineEdit->hide();
|
// ui.filterPatternLineEdit->hide();
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// Setup the current view model.
|
// load settings
|
||||||
//
|
processSettings(true);
|
||||||
changeCurrentViewModel(ui.viewType_CB->currentIndex()) ;
|
|
||||||
|
// Hide columns after loading the settings
|
||||||
|
ui.remoteDirTreeView->setColumnHidden(3,false) ;
|
||||||
|
ui.remoteDirTreeView->setColumnHidden(4,true) ;
|
||||||
|
ui.localDirTreeView->setColumnHidden(4,true) ;
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
@ -244,29 +243,35 @@ SharedFilesDialog::~SharedFilesDialog()
|
||||||
|
|
||||||
void SharedFilesDialog::processSettings(bool bLoad)
|
void SharedFilesDialog::processSettings(bool bLoad)
|
||||||
{
|
{
|
||||||
Settings->beginGroup("SharedFilesDialog");
|
Settings->beginGroup("SharedFilesDialog");
|
||||||
|
|
||||||
if (bLoad) {
|
if (bLoad) {
|
||||||
// load settings
|
// load settings
|
||||||
|
|
||||||
// state of the trees
|
// state of the trees
|
||||||
ui.localDirTreeView->header()->restoreState(Settings->value("LocalDirTreeView").toByteArray());
|
ui.localDirTreeView->header()->restoreState(Settings->value("LocalDirTreeView").toByteArray());
|
||||||
ui.remoteDirTreeView->header()->restoreState(Settings->value("RemoteDirTreeView").toByteArray());
|
ui.remoteDirTreeView->header()->restoreState(Settings->value("RemoteDirTreeView").toByteArray());
|
||||||
|
|
||||||
// state of splitter
|
// state of splitter
|
||||||
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
|
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
|
||||||
} else {
|
|
||||||
// save settings
|
|
||||||
|
|
||||||
// state of trees
|
// view type
|
||||||
Settings->setValue("LocalDirTreeView", ui.localDirTreeView->header()->saveState());
|
ui.viewType_CB->setCurrentIndex(Settings->value("ViewType").toInt());
|
||||||
Settings->setValue("RemoteDirTreeView", ui.remoteDirTreeView->header()->saveState());
|
} else {
|
||||||
|
// save settings
|
||||||
|
|
||||||
// state of splitter
|
// state of trees
|
||||||
Settings->setValue("Splitter", ui.splitter->saveState());
|
Settings->setValue("LocalDirTreeView", ui.localDirTreeView->header()->saveState());
|
||||||
}
|
Settings->setValue("RemoteDirTreeView", ui.remoteDirTreeView->header()->saveState());
|
||||||
|
|
||||||
Settings->endGroup();
|
// state of splitter
|
||||||
|
Settings->setValue("Splitter", ui.splitter->saveState());
|
||||||
|
|
||||||
|
// view type
|
||||||
|
Settings->setValue("ViewType", ui.viewType_CB->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedFilesDialog::changeCurrentViewModel(int c)
|
void SharedFilesDialog::changeCurrentViewModel(int c)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue