Esempio n. 1
0
void MainWindow::updateListView(){
    QFileSystemModel *model = new QFileSystemModel;
    QString path(QFileInfo(currentFile->fileName()).dir().path());
    model->setFilter(QDir::AllDirs | QDir::AllEntries);
    QStringList flt;
    flt << "*.md" << "*.mkd";
    model->setNameFilters(flt);
    model->setNameFilterDisables(false);
    model->setRootPath(path);
    ui->listView->setModel(model);
    ui->listView->setRootIndex(model->index(path));
}
Esempio n. 2
0
void TagEditor::readSettings(){

    /*
    guiSettings->beginGroup("MainWindow");
    //this->resize(guiSettings->value("size", QSize(630, 750)).toSize());
    //this->move(guiSettings->value("pos", QPoint(200, 200)).toPoint());
    guiSettings->endGroup();
    */
    style = guiSettings->value("style","WindowsXP").toString();
    startupFolder = guiSettings->value("startupFolder","").toString();
    QString defaultExt = "*.mp3;*.wma;*.wav;*.ogg;*.aac;*.ac3;*.m4a";
    extensions = guiSettings->value("extensions",defaultExt.split(";")).toStringList();

    QFileSystemModel *model = static_cast<QFileSystemModel*>(TreeView->model());
    model->setRootPath(startupFolder);
    model->setNameFilters(extensions);
    model->setNameFilterDisables(false);
    TreeView->setRootIndex(model->index(startupFolder));
    treeViewLabel->setText(startupFolder);

    //api_key = guiSettings->value("api_key","").toString();
    showSaveTagWarning = guiSettings->value("showSaveTagWarning",true).toBool();
    subfolders = guiSettings->value("subfolders",true).toBool();
    ArtistCheckbox->setChecked( guiSettings->value("artistChecked",true).toBool() );
    TitleCheckbox->setChecked( guiSettings->value("titleChecked",true).toBool() );
    AlbumCheckbox->setChecked( guiSettings->value("albumChecked",true).toBool() );
    YearCheckbox->setChecked( guiSettings->value("yearChecked",true).toBool() );
    TrackCheckbox->setChecked( guiSettings->value("trackChecked",true).toBool() );
    GenreCheckbox->setChecked( guiSettings->value("genreChecked",true).toBool() );
    CommentCheckbox->setChecked( guiSettings->value("commentChecked",true).toBool() );
    lastStyleSheetFolder = guiSettings->value("lastStyleSheetFolder","").toString();
    TreeWidget_->setShowFullFileName( guiSettings->value("showFullFileName",false).toBool() );
    TreeWidget_->setShowTagInfo( guiSettings->value("showTagInfo",false).toBool() );
    TreeWidget_->setSortingEnabled( guiSettings->value("sortingEnabled",true).toBool() );
    if(TreeWidget_->isSortingEnabled()){
        TreeWidget_->header()->setSortIndicator( guiSettings->value("sortColumn",0).toInt(), static_cast<Qt::SortOrder>(guiSettings->value("sortOrder",0).toInt()) );
        TreeWidget_->header()->setSortIndicatorShown(true);
    }    
    QVariantList colstmp = guiSettings->value("columns").toList();
    QList<Global::TagField> cols;
    for(int i=0;i<colstmp.size();i++){
        qDebug()<<"colstmp[i] "<<colstmp[i];
        cols.append(static_cast<Global::TagField>(colstmp[i].toInt()));
    }
    TreeWidget_->setColumnsList(cols);

    restoreState(guiSettings->value("windowState").toByteArray());
    restoreGeometry(guiSettings->value("geometry").toByteArray());

    //splitter->setSizes(guiSettings->value("splittersizes").value< QList<int> >() );

    scriptEditor_->setText(guiSettings->value("script","").toString());
}
Esempio n. 3
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
	setupUi(this);

	menuView->addAction(fileBrowserDock->toggleViewAction());
	menuView->addAction(informationDock->toggleViewAction());
	menuView->addAction(drawingDock->toggleViewAction());

	// Load and initialize palettes
	_ildaPalette = loadPalette(":/data/ilda.palette");
	_pangolinPalette = loadPalette(":/data/pangolin.palette");
	_currentPalette = &_ildaPalette;

	// File browser
    QFileSystemModel *fsModel = new QFileSystemModel(this);
    fsModel->setRootPath(QDir::rootPath());
    fsModel->setNameFilterDisables(false);
    fsModel->setNameFilters(QStringList() << "*.ild");

	treeView->setModel(fsModel);
	treeView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
	//treeView->setSortingEnabled(true);
	//treeView->sortByColumn(0, Qt::AscendingOrder);
	treeView->setColumnHidden(2, true);
	treeView->setColumnHidden(3, true);
	//treeView->setRootIndex(fsModel->index(QDir::homePath()));

	// Create the connections
	connect(actionOpen, SIGNAL(triggered()), this, SLOT(fileOpen()));
	connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
	connect(actionPangolin_palette, SIGNAL(triggered()), SLOT(usePangolinPalette()));
	connect(actionILDA_palette, SIGNAL(triggered()), SLOT(useILDAPalette()));
	connect(actionAbout, SIGNAL(triggered()), SLOT(about()));	
    connect(treeView, SIGNAL(clicked(QModelIndex)), SLOT(fileBrowserItemClicked(QModelIndex)));
    connect(treeView, SIGNAL(doubleClicked(QModelIndex)), SLOT(fileBrowserItemDblClicked(QModelIndex)));
    connect(normalRadioButton, SIGNAL(clicked()), SLOT(drawModeChanged()));
    connect(diagnosticRadioButton, SIGNAL(clicked()), SLOT(drawModeChanged()));
	
	// restore settings
	readSettings();
}
Esempio n. 4
0
QObject* FileSystemTab::component(Jerboa::Plugin::ComponentType type, QObject* parent)
{
	switch(type)
	{
		case Jerboa::Plugin::WidgetUsedWithPlaylist:
			{
				QFileSystemModel* model = new FileSystemModelWithToolTip(parent);
				model->setRootPath("/");
				model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs);
				model->setNameFilterDisables(false);

				QStringList musicGlobs;
				musicGlobs
					<< "*.aac"
					<< "*.aiff"
					<< "*.ape"
					<< "*.au"
					<< "*.cdda"
					<< "*.flac"
					<< "*.m4a"
					<< "*.mp3"
					<< "*.oga"
					<< "*.ogg"
					<< "*.ogm"
					<< "*.wav"
					<< "*.wma"
				;
				model->setNameFilters(musicGlobs);

				QTreeView* view = new QTreeView(qobject_cast<QWidget*>(parent));
				view->setWindowTitle("Files");
				view->setModel(model);
				view->setHeaderHidden(true);
				for(int i = 1; i < model->columnCount(); ++i)
				{
					view->setColumnHidden(i, true);
				}

				QString path = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);

				if(path.isEmpty() || !QDir(path).exists())
				{
					path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
				}

				const QModelIndex index(model->index(QSettings().value("collection/directory", path).toString()));
				for(QModelIndex iterator(index); iterator.isValid(); iterator = iterator.parent())
				{
					view->setExpanded(iterator, true);
				}

				view->setDragDropMode(QAbstractItemView::DragOnly);
				view->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect);
				view->setSelectionMode(QAbstractItemView::ExtendedSelection);

				connect(
					view,
					SIGNAL(doubleClicked(QModelIndex)),
					this,
					SLOT(addPathToPlaylist(QModelIndex))
				);

				QTimer* timer = new QTimer(this);
				connect(
					timer,
					SIGNAL(timeout()),
					this,
					SLOT(scrollToSelection())
				);
				timer->setSingleShot(true);
				timer->start(1000);

				m_view = view;
				return view;
			}
		default:
			return Jerboa::Plugin::component(type, parent);
	}
}