Beispiel #1
0
void SpeechRec::CreateLabelFileNameForMLF(char *fileName, char *retLableFileName)
{
	char *suffix = C.GetString("labels", "suffix");
	bool remove_path = C.GetBool("labels", "remove_path");

	strcpy(retLableFileName, fileName);
	
	// replace dir separators /\ with the one used by system
	CorrectDirSeparator(retLableFileName, dirSep);
	ChangeFileSuffix(retLableFileName, suffix);
	if(remove_path)
		ChangeFilePath(retLableFileName, "*");
}
Beispiel #2
0
void FileView::FileUp() {
  QDir dir(model_->rootDirectory());
  dir.cdUp();

  // Is this the same as going back?  If so just go back, so we can keep the
  // view scroll position.
  if (undo_stack_->canUndo()) {
    const UndoCommand* last_dir = static_cast<const UndoCommand*>(
        undo_stack_->command(undo_stack_->index()-1));
    if (last_dir->undo_path() == dir.path()) {
      undo_stack_->undo();
      return;
    }
  }

  ChangeFilePath(dir.path());
}
Beispiel #3
0
FileView::FileView(QWidget* parent)
    : QWidget(parent),
      ui_(new Ui_FileView),
      model_(nullptr),
      undo_stack_(new QUndoStack(this)),
      task_manager_(nullptr),
      storage_(new FilesystemMusicStorage("/")) {
  ui_->setupUi(this);

  // Icons
  ui_->back->setIcon(IconLoader::Load("go-previous", IconLoader::Base));
  ui_->forward->setIcon(IconLoader::Load("go-next", IconLoader::Base));
  ui_->home->setIcon(IconLoader::Load("go-home", IconLoader::Base));
  ui_->up->setIcon(IconLoader::Load("go-up", IconLoader::Base));

  connect(ui_->back, SIGNAL(clicked()), undo_stack_, SLOT(undo()));
  connect(ui_->forward, SIGNAL(clicked()), undo_stack_, SLOT(redo()));
  connect(ui_->home, SIGNAL(clicked()), SLOT(FileHome()));
  connect(ui_->up, SIGNAL(clicked()), SLOT(FileUp()));
  connect(ui_->path, SIGNAL(textChanged(QString)),
          SLOT(ChangeFilePath(QString)));

  connect(undo_stack_, SIGNAL(canUndoChanged(bool)), ui_->back,
          SLOT(setEnabled(bool)));
  connect(undo_stack_, SIGNAL(canRedoChanged(bool)), ui_->forward,
          SLOT(setEnabled(bool)));

  connect(ui_->list, SIGNAL(activated(QModelIndex)),
          SLOT(ItemActivated(QModelIndex)));
  connect(ui_->list, SIGNAL(doubleClicked(QModelIndex)),
          SLOT(ItemDoubleClick(QModelIndex)));
  connect(ui_->list, SIGNAL(AddToPlaylist(QMimeData*)),
          SIGNAL(AddToPlaylist(QMimeData*)));
  connect(ui_->list, SIGNAL(CopyToLibrary(QList<QUrl>)),
          SIGNAL(CopyToLibrary(QList<QUrl>)));
  connect(ui_->list, SIGNAL(MoveToLibrary(QList<QUrl>)),
          SIGNAL(MoveToLibrary(QList<QUrl>)));
  connect(ui_->list, SIGNAL(CopyToDevice(QList<QUrl>)),
          SIGNAL(CopyToDevice(QList<QUrl>)));
  connect(ui_->list, SIGNAL(Delete(QStringList)), SLOT(Delete(QStringList)));
  connect(ui_->list, SIGNAL(EditTags(QList<QUrl>)),
          SIGNAL(EditTags(QList<QUrl>)));

  QString filter(FileView::kFileFilter);
  filter_list_ << filter.split(" ");
}
Beispiel #4
0
void FileView::ItemActivated(const QModelIndex& index) {
  if (model_->isDir(index))
    ChangeFilePath(model_->filePath(index));
}
Beispiel #5
0
void FileView::FileHome() {
  ChangeFilePath(QDir::homePath());
}