|
|
@@ -29,6 +29,7 @@ MainWindow::MainWindow(const std::vector<std::string>& dirList)
|
|
|
OnListViewDoubleClick(fileIter->second);
|
|
|
}
|
|
|
});
|
|
|
+ connect(ui->breadcrumb, &craftlab::ui::Breadcrumb::SelectionChanged, this, &MainWindow::OnBreadcrumbSelection);
|
|
|
window->show();
|
|
|
|
|
|
if (dirList.empty() || !TryOpenningDir(dirList))
|
|
|
@@ -53,10 +54,25 @@ bool MainWindow::PathExists(const IEngine& engine) const
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+void MainWindow::OnBreadcrumbSelection(int index)
|
|
|
+{
|
|
|
+ std::vector<std::string> path;
|
|
|
+ const std::deque<std::string> currenPath = engine->GetCurrentDir();
|
|
|
+
|
|
|
+ window->setEnabled(false);
|
|
|
+ for (int i = 1; i <= index; ++i)
|
|
|
+ path.push_back(currenPath[i -1]);
|
|
|
+ if (engine->SetWorkingDirectory(path))
|
|
|
+ OnEngineUpdated();
|
|
|
+}
|
|
|
+
|
|
|
void MainWindow::UpdateBreadcrumb()
|
|
|
{
|
|
|
craftlab::ui::Breadcrumb* breadcrumb = ui->breadcrumb;
|
|
|
breadcrumb->clear();
|
|
|
+ breadcrumb->addItem("/");
|
|
|
+ for (const std::string& path : engine->GetCurrentDir())
|
|
|
+ breadcrumb->addItem(path.c_str());
|
|
|
}
|
|
|
|
|
|
void MainWindow::UpdateFileList()
|
|
|
@@ -91,7 +107,7 @@ void MainWindow::FileEdit(const File& file)
|
|
|
// FIXME
|
|
|
}
|
|
|
|
|
|
-bool MainWindow::IsFileCorrent(const File& file) const
|
|
|
+bool MainWindow::IsFileCorrect(const File& file) const
|
|
|
{
|
|
|
return std::find_if(
|
|
|
currentDiffResult->correctFiles.begin(),
|
|
|
@@ -105,7 +121,7 @@ bool MainWindow::IsFileCorrent(const File& file) const
|
|
|
|
|
|
void MainWindow::OnListViewDoubleClick(const FileAndSum& file)
|
|
|
{
|
|
|
- if (IsFileCorrent(file))
|
|
|
+ if (IsFileCorrect(file))
|
|
|
{
|
|
|
if (file.isDir)
|
|
|
{
|
|
|
@@ -150,7 +166,9 @@ void MainWindow::OnListViewDoubleClick(const FileAndSum& file)
|
|
|
|
|
|
void MainWindow::OnEngineUpdated()
|
|
|
{
|
|
|
+ window->setEnabled(false);
|
|
|
ListFiles();
|
|
|
+ window->setEnabled(true);
|
|
|
}
|
|
|
|
|
|
bool MainWindow::TryOpenningDir(const std::vector<std::string>& folders)
|