work save
This commit is contained in:
parent
b70144532e
commit
c920a98d85
|
@ -3047,3 +3047,31 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionRemove_from_project_triggered()
|
||||||
|
{
|
||||||
|
if (!mProject)
|
||||||
|
return;
|
||||||
|
if (!ui->projectView->selectionModel()->hasSelection())
|
||||||
|
return;
|
||||||
|
mProject->model()->beginUpdate();
|
||||||
|
QSet<int> selected;
|
||||||
|
foreach (const QModelIndex& index, ui->projectView->selectionModel()->selectedIndexes()){
|
||||||
|
if (!index.isValid())
|
||||||
|
continue;
|
||||||
|
FolderNode * node = static_cast<FolderNode*>(index.internalPointer());
|
||||||
|
PFolderNode folderNode = mProject->pointerToNode(node);
|
||||||
|
if (folderNode)
|
||||||
|
continue;
|
||||||
|
selected.insert(folderNode->unitIndex);
|
||||||
|
};
|
||||||
|
for (int i=mProject->units().count()-1;i>=0;i--) {
|
||||||
|
if (selected.contains(i)) {
|
||||||
|
mProject->removeEditor(i,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mProject->model()->endUpdate();
|
||||||
|
updateProjectView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,8 @@ private slots:
|
||||||
|
|
||||||
void on_actionAdd_to_project_triggered();
|
void on_actionAdd_to_project_triggered();
|
||||||
|
|
||||||
|
void on_actionRemove_from_project_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
EditorList *mEditorList;
|
EditorList *mEditorList;
|
||||||
|
|
|
@ -109,6 +109,9 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="projectView">
|
<widget class="QTreeView" name="projectView">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::MultiSelection</enum>
|
||||||
|
</property>
|
||||||
<attribute name="headerVisible">
|
<attribute name="headerVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
|
@ -191,6 +191,9 @@ void Project::setModified(bool value)
|
||||||
PFolderNode Project::makeNewFileNode(const QString &s, bool isFolder, PFolderNode newParent)
|
PFolderNode Project::makeNewFileNode(const QString &s, bool isFolder, PFolderNode newParent)
|
||||||
{
|
{
|
||||||
PFolderNode node = std::make_shared<FolderNode>();
|
PFolderNode node = std::make_shared<FolderNode>();
|
||||||
|
if (!newParent) {
|
||||||
|
newParent = mNode;
|
||||||
|
}
|
||||||
newParent->children.append(node);
|
newParent->children.append(node);
|
||||||
node->parent = newParent;
|
node->parent = newParent;
|
||||||
node->text = s;
|
node->text = s;
|
||||||
|
|
|
@ -22,7 +22,7 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) :
|
||||||
QString location;
|
QString location;
|
||||||
while (true) {
|
while (true) {
|
||||||
i++;
|
i++;
|
||||||
projectName = tr("Project %1").arg(i);
|
projectName = tr("Project%1").arg(i);
|
||||||
location = includeTrailingPathDelimiter(pSettings->dirs().projectDir()) + projectName;
|
location = includeTrailingPathDelimiter(pSettings->dirs().projectDir()) + projectName;
|
||||||
if (!QDir(location).exists())
|
if (!QDir(location).exists())
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue