void FileSystemScanner::rescanWithEXIF()
{
    tracer->sinvoked(__func__) << "scanning with EXIF..." << endl;

    reset();
    rescanFolders(m_engine->m_sourceDirs, true);
}
void FileSystemScanner::rescan()
{
    tracer->sinvoked(__func__) << "scanning..." << endl;

    reset();
    rescanFolders(m_engine->m_sourceDirs, false);
}
Example #3
0
SaveSection::SaveSection(String name) : Component(name) {
  listener_ = nullptr;
  folders_model_ = new FileListBoxModel();
  folders_view_ = new ListBox("folders", folders_model_);
  rescanFolders();
  folders_view_->setColour(ListBox::backgroundColourId, Colour(0xff323232));
  addAndMakeVisible(folders_view_);

  patch_name_ = new TextEditor("Patch Name");
  patch_name_->addListener(this);
  patch_name_->setTextToShowWhenEmpty(TRANS("Patch Name"), Colour(0xff777777));
  patch_name_->setFont(Fonts::instance()->monospace().withPointHeight(16.0f));
  patch_name_->setColour(CaretComponent::caretColourId, Colour(0xff888888));
  patch_name_->setColour(TextEditor::textColourId, Colour(0xff03a9f4));
  patch_name_->setColour(TextEditor::highlightedTextColourId, Colour(0xff03a9f4));
  patch_name_->setColour(TextEditor::highlightColourId, Colour(0xff888888));
  patch_name_->setColour(TextEditor::backgroundColourId, Colour(0xff323232));
  patch_name_->setColour(TextEditor::outlineColourId, Colour(0xff888888));
  patch_name_->setColour(TextEditor::focusedOutlineColourId, Colour(0xff888888));
  addAndMakeVisible(patch_name_);

  author_ = new TextEditor("Author");
  author_->addListener(this);
  author_->setTextToShowWhenEmpty(TRANS("Author"), Colour(0xff777777));
  author_->setFont(Fonts::instance()->monospace().withPointHeight(16.0f));
  author_->setColour(CaretComponent::caretColourId, Colour(0xff888888));
  author_->setColour(TextEditor::textColourId, Colour(0xffcccccc));
  author_->setColour(TextEditor::highlightedTextColourId, Colour(0xffcccccc));
  author_->setColour(TextEditor::highlightColourId, Colour(0xff888888));
  author_->setColour(TextEditor::backgroundColourId, Colour(0xff323232));
  author_->setColour(TextEditor::outlineColourId, Colour(0xff888888));
  author_->setColour(TextEditor::focusedOutlineColourId, Colour(0xff888888));
  addAndMakeVisible(author_);

  add_folder_name_ = new TextEditor("Add Folder");
  add_folder_name_->addListener(this);
  add_folder_name_->setTextToShowWhenEmpty(TRANS("New Folder"), Colour(0xff777777));
  add_folder_name_->setFont(Fonts::instance()->monospace().withPointHeight(12.0f));
  add_folder_name_->setColour(CaretComponent::caretColourId, Colour(0xff888888));
  add_folder_name_->setColour(TextEditor::textColourId, Colour(0xffcccccc));
  add_folder_name_->setColour(TextEditor::highlightedTextColourId, Colour(0xffcccccc));
  add_folder_name_->setColour(TextEditor::highlightColourId, Colour(0xff888888));
  add_folder_name_->setColour(TextEditor::backgroundColourId, Colour(0xff323232));
  add_folder_name_->setColour(TextEditor::outlineColourId, Colour(0xff888888));
  add_folder_name_->setColour(TextEditor::focusedOutlineColourId, Colour(0xff888888));
  addAndMakeVisible(add_folder_name_);

  save_button_ = new TextButton(TRANS("Save"));
  save_button_->addListener(this);
  addAndMakeVisible(save_button_);

  cancel_button_ = new TextButton(TRANS("Cancel"));
  cancel_button_->addListener(this);
  addAndMakeVisible(cancel_button_);

  add_folder_button_ = new TextButton("+");
  add_folder_button_->addListener(this);
  addAndMakeVisible(add_folder_button_);
}
Example #4
0
void SaveSection::visibilityChanged() {
  if (isVisible()) {
    SparseSet<int> selected_rows = folders_view_->getSelectedRows();
    if (selected_rows.size() == 0)
      folders_view_->selectRow(0);

    rescanFolders();
  }
}
Example #5
0
void SaveSection::createNewFolder() {
  String folder_name = add_folder_name_->getText();
  if (folder_name.length() == 0)
    return;

  File bank_dir = LoadSave::getUserBankDirectory();
  File new_folder = bank_dir.getChildFile(folder_name);
  if (!new_folder.exists())
    new_folder.createDirectory();

  add_folder_name_->clear();

  rescanFolders();
  int row = folders_model_->getIndexOfFile(new_folder);
  folders_view_->selectRow(row);
  folders_view_->updateContent();
}
void FileSystemScanner::rescanFolders(QPtrList<Folder>* folders, bool forceEXIF, bool fast)
{
    Folder* folder = 0;
    for (folder = folders->first(); folder; folder = folders->next()) {
        QString currentFolderPath = folder->dir()->absPath();

        tracer->sdebug(__func__) << "rescanning folder: " << folder->id() << ": " << currentFolderPath << endl;

        if (folder->dir()->exists()) {

            folder->setFound(true);

            if (!fast) {
                rescanFolder(folder, forceEXIF);
                if (m_cancel) {
                    return;
                }
            }

            if (folder->children() && folder->children()->count()) {
                rescanFolders(folder->children(), forceEXIF, fast);
            }

            // scan the filesystem for new folders
            if (!fast && folder->recursive()) {
                delete m_loopDetectionHelper;
                m_loopDetectionHelper = new QPtrList<QString>;
                m_loopDetectionHelper->setAutoDelete(true);
                m_loopDetectionHelper->append(new QString(folder->dir()->canonicalPath()));

                addFolders(folder);
            }
        } else {
            folder->setFound(false);

            tracer->sdebug(__func__) << "folder: " << folder->id() << ": '" << currentFolderPath << "' not found" << endl;
            emit(progress_folderNotFound(currentFolderPath));
        }
    }
}