Commit 11b4b53b authored by Jarek Kobus's avatar Jarek Kobus
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 9049b6bb 57a1a4d6
......@@ -248,6 +248,7 @@ void CMakeRunPage::initWidgets()
fl->addWidget(m_runCMake);
m_output = new QPlainTextEdit(this);
m_output->setReadOnly(true);
fl->addRow(m_output);
}
......
......@@ -63,7 +63,7 @@ void GenericProjectNode::refresh()
removeFileNodes(fileNodes(), this);
removeFolderNodes(subFolderNodes(), this);
ProjectExplorerPlugin::instance()->setCurrentNode(0); // ### remove me
//ProjectExplorerPlugin::instance()->setCurrentNode(0); // ### remove me
FileNode *projectFilesNode = new FileNode(m_project->filesFileName(),
ProjectFileType,
......
......@@ -119,6 +119,13 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_autoSync(false)
{
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
NodesWatcher *watcher = new NodesWatcher(this);
m_explorer->session()->sessionNode()->registerWatcher(watcher);
connect(watcher, SIGNAL(foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*> &)),
this, SLOT(foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*> &)));
connect(watcher, SIGNAL(filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &)),
this, SLOT(filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &)));
m_view = new ProjectTreeView;
m_view->setModel(m_model);
......@@ -165,6 +172,29 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
setAutoSynchronization(true);
}
void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*> &list)
{
Node *n = m_explorer->currentNode();
while(n) {
if (FolderNode *fn = qobject_cast<FolderNode *>(n)) {
if (list.contains(fn)) {
m_explorer->setCurrentNode(n->projectNode());
break;
}
}
n = n->parentFolderNode();
}
}
void ProjectTreeWidget::filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &list)
{
if (FileNode *fileNode = qobject_cast<FileNode *>(m_explorer->currentNode())) {
if (list.contains(fileNode)) {
m_explorer->setCurrentNode(fileNode->projectNode());
}
}
}
QToolButton *ProjectTreeWidget::toggleSync()
{
return m_toggleSync;
......
......@@ -40,6 +40,8 @@ namespace ProjectExplorer {
class ProjectExplorerPlugin;
class Project;
class Node;
class FolderNode;
class FileNode;
namespace Internal {
......@@ -73,6 +75,9 @@ private slots:
void startupProjectChanged(ProjectExplorer::Project *project);
void initView();
void foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*> &);
void filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &);
private:
ProjectExplorerPlugin *m_explorer;
QTreeView *m_view;
......
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