Esempio n. 1
0
void ProjectView::slotClicked(QTreeWidgetItem *item)
{
	if(!item) {
		item = currentItem();
	}

	ProjectViewItem *itm = static_cast<ProjectViewItem*>(item);
	if(itm) {
		if(itm->type() == KileType::File) {
			emit(fileSelected(itm->url()));
		}
		else if(itm->type() == KileType::ProjectItem) {
			emit(fileSelected(itm->projectItem()));
		}
		else if(itm->type() != KileType::Folder) {
			// don't open project configuration files (*.kilepr)
			if(itm->url().toLocalFile().right(7) != ".kilepr") {
				//determine mimeType and open file with preferred application
				KMimeType::Ptr pMime = KMimeType::findByUrl(itm->url());
				if(pMime->name().startsWith("text/")) {
					emit(fileSelected(itm->url()));
				}
				else {
					KRun::runUrl(itm->url(), pMime->name(), this);
				}
			}
		}
		clearSelection();
	}
}
Esempio n. 2
0
MainWindow::MainWindow(FilesList *filesList)
{
    this->filesList = filesList;

    player = new Player(this);
    filesListWidget = new FilesListWidget(this->filesList, this);
    filesCountLabel = new QLabel(FILES_COUNT_TEXT.arg(0), this);

    QSplitter *splitter = new QSplitter(Qt::Vertical, this);
    //splitter->setStyleSheet("QSplitter::handle {background-color: black;}");

    splitter->addWidget(initVideoFrame());
    splitter->addWidget(initControlFrame());
    splitter->setChildrenCollapsible(false);
    //splitter->setCursor(Qt::SizeVerCursor);
    splitter->setHandleWidth(10);

    initMenu();
    setCentralWidget(splitter);
    setWindowTitle("Visual Renamer");
    setWindowIcon(QIcon(":/resources/logo_small.png"));
    resize(850, 650);

    connect(filesListWidget, SIGNAL(fileSelected(int)), SLOT(fileSelected(int)));
    connect(this->filesList, SIGNAL(renamed(int,int)), SLOT(filesRenamed(int,int)));
    connect(this->filesList, &FilesList::reseted, this, [=](){fileSelected(-1); filesCountLabel->setText(FILES_COUNT_TEXT.arg(this->filesList->getSize()));});
    connect(this->filesList, &FilesList::filesAdded, this, [=](){filesCountLabel->setText(FILES_COUNT_TEXT.arg(this->filesList->getSize()));});
    connect(this->filesList, &FilesList::removed, this, [=](){fileSelected(-1); filesCountLabel->setText(FILES_COUNT_TEXT.arg(this->filesList->getSize()));});

    this->setFocus();
}
Esempio n. 3
0
	void PlayListWidget::onSelectionChanged(const QItemSelection & s, const QItemSelection & d)
	{
		Q_UNUSED(d);
		QModelIndexList idx = s.indexes();
		if (idx.count() > 0)
			fileSelected(fileForIndex(idx.front()));
		else
			fileSelected(MediaFileRef());
	}
Esempio n. 4
0
TransferTabController::TransferTabController(ClickableQLabel *sourceLabel, ClickableQLabel *targetLabel, ExpTranAbstractView *view,
                                             QLineEdit *srcText, QLineEdit *targetText,CustomizableFaceWidget *face_widget)
{
    this->view = view;
    this->targetLabel = targetLabel;
    this->sourceLabel = sourceLabel;
    this->srcText = srcText;
    this->targetText = targetText;
    this->face_widget = face_widget;
    this->face_widget->setLabeled(false);

    this->face_widget->setCameraParameters(-200,-1,-200);
    src_face_ptr = new Face();
    target_face_ptr = new Face();
    face_widget->setFace(src_face_ptr);

    opttype = VideoProcessor::OptType_INTERPOLATE;
    idconstype = VideoProcessor::IdConstraintType_CONST;
    projtype = VideoProcessor::PointGenerationType_2D;
    regParam = 2000.0;
    frame_num = 50;
    iter_num = 30;
    gen_point_num = 400;

    srcFileSelected("obama.avi");
    targetFileSelected("clinton.avi");

    srcDia = new QFileDialog();
    targetDia = new QFileDialog();

    connect(srcDia,SIGNAL(fileSelected(QString)),this,SLOT(srcFileSelected(QString)));
    connect(targetDia,SIGNAL(fileSelected(QString)),this,SLOT(targetFileSelected(QString)));

    initSrcSide();
    initTargetSide();

    lensDist = Mat_<double>(1,5);
    lensDist(0,0) = 0;
    lensDist(0,1) = 0;
    lensDist(0,2) = 0;
    lensDist(0,3) = 0;
    lensDist(0,4) = 0;

    //set the texture functions
    textureInterpolate = false;
    show3D = false;
    textured3D = false;
    projModel = false;
    withFirstFrame = true;
}
void GPlainTextLogger::ChooseFolder(QString folderPath /*= ""*/)
{
	if(folderPath.isEmpty()) {
		QFileDialog* pDialog = new QFileDialog(0, "Select folder", m_FolderPath);
		pDialog->setFileMode(QFileDialog::Directory);
		pDialog->setOption(QFileDialog::ShowDirsOnly);
		pDialog->show();
		pDialog->setAttribute(Qt::WA_DeleteOnClose);

		connect(pDialog, SIGNAL(fileSelected(QString)), this, SLOT(ChooseFolder(QString)));
		return;
	}
	
	QDir theFolder(folderPath);
	// if the folder doesn't exists, offer to create it
	if(!theFolder.exists()) {
		QMessageBox msgBox;
		msgBox.setIcon(QMessageBox::Question);
		QString strMess("The folder %1 doesn't exist.");
		strMess = strMess.arg(folderPath);
		msgBox.setText(strMess);
		msgBox.setInformativeText("Do you want to create it?");
		msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
		msgBox.setDefaultButton(QMessageBox::Yes);
		int ret = msgBox.exec();
		if(ret == QMessageBox::Yes) {
			theFolder.mkpath(folderPath);
		}
	}
	if(folderPath != m_FolderPath)
		if(theFolder.exists())
			m_FolderPath = folderPath;
}
Esempio n. 6
0
void CGeorgesDirTreeDialog::changeFile(QString file)
{
	QModelIndex index = m_dirModel->index(file);
	m_ui.dirTree->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
	m_ui.dirTree->scrollTo(index,QAbstractItemView::PositionAtCenter);
	fileSelected(index);
}
Esempio n. 7
0
PathButton::PathButton(QWidget *parent)
    : QPushButton(parent), d(new Data)
{
    QPushButton::setText(d->getText());

    connect(this, &QPushButton::clicked, this, [=] () {
        switch (d->mode) {
        case Folder: {
            const auto ret = getFolder();
            if (!ret.isEmpty()) {
                emit folderSelected(ret);
                if (d->editor)
                    d->prop.write(d->editor, ret);
            }
            break;
        } case SingleFile: {
            const auto ret = getFile();
            if (!ret.isEmpty()) {
                emit fileSelected(ret);
                if (d->editor)
                    d->prop.write(d->editor, ret);
            }
            break;
        } case MultiFile: {
            const auto ret = getFiles();
            if (!ret.isEmpty()) {
                emit filesSelected(ret);
                if (d->editor)
                    d->prop.write(d->editor, ret);
            }
        } default:
            break;
        }
    });
}
Esempio n. 8
0
void WatchFolderAdd::folderButtonClicked() {
    QDir dir;
    fileDialog->setDirectory(dir.homePath()+"/");
    fileDialog->setFileMode(QFileDialog::DirectoryOnly);
    connect(fileDialog, SIGNAL(fileSelected(QString)), this, SLOT(folderSelected(QString)));
    fileDialog->exec();
}
Esempio n. 9
0
CBnpDirTreeDialog::CBnpDirTreeDialog(QString bnpPath, QWidget *parent)
	:	QDockWidget(parent),
		m_DataPath(bnpPath)
{
	// Setup the dialog
	m_ui.setupUi(this);

	// Filter settings to only display files with bnp extension.
	// Could be changed to display all files and react according to the extension:
	// Bnp file: opened and displayed
	// all other files: added to the currently opened bnp file
	QStringList filter;
    filter << tr("*.bnp");

	// Setup the directory tree model
	m_dirModel= new BNPFileSystemModel();
	m_proxyModel = new BNPSortProxyModel();
	m_ui.dirTree->setSortingEnabled(true);
	m_dirModel->setRootPath(m_DataPath);
	m_dirModel->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::AllEntries);
	m_dirModel->setNameFilters(filter);
    m_dirModel->setNameFilterDisables(0);

	m_proxyModel->setSourceModel(m_dirModel);

	m_ui.dirTree->setModel(m_proxyModel);

	m_ui.dirTree->setRootIndex( m_proxyModel->mapFromSource (m_dirModel->index(m_DataPath) ) );

	// Trigger if one filename is activated
	// In future drag&drop should be also possible
	connect(m_ui.dirTree, SIGNAL(activated(QModelIndex)),
			this, SLOT(fileSelected(QModelIndex)));
}
Esempio n. 10
0
void FileBrowser::onAcceptPressed()
{
    QStringList *list = new QStringList(this->txtFilename->text());
    int ret = 0;

    if (exists(list->at(0)) && (this->mMode == FileBrowser::SAVE))
    {
        ret = QMessageBox::question(this, tr("Remote File Browser"),
                                    tr("The file already exists!\n Do you want to overwrite it?"),
                                    QMessageBox::Save | QMessageBox::Cancel,
                                    QMessageBox::Save);
    }

    this->mFilename = list;
    //emit fileload event here
    QString file = mFilename->at(0);

    if (!(ret == QMessageBox::Cancel) && (list->at(0) != ""))
    {

        emit fileSelected(file, this->mLocationPath, this->chkLoadAllClients->isChecked());
        this->hide();
    }
    else
    {
        /**
       * Take the local stored path location and return it as selected path
       *
       */
        emit pathSelected(file, mLocationPath);
        this->hide();
    }
}
Esempio n. 11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    splw = new SerialPortListWidget(this);
    ui->communicationVBoxLayout->addWidget(splw);

    //Connect browse button
    QFileDialog* fileDialog = new QFileDialog();
    connect(fileDialog,SIGNAL(fileSelected(QString)),ui->calibrationFileLineEdit,SLOT(setText(QString)));
    connect(ui->calibrationFilePushButton,SIGNAL(clicked()),fileDialog,SLOT(open()));

    //Connect apply settings button
    connect(ui->applySettingsPushButton,SIGNAL(clicked()),this,SLOT(applySettings()));

    //Frame rate timer
    frameRateTimer = new QTimer(this);
    fillDefaultSettings();
    connect(frameRateTimer,SIGNAL(timeout()),this,SLOT(update()));

    //Initialize marker detector
    markerDetector.setMinMaxSize(0.0001,0.5);

    //Camera view
    updateAutoFocus(false);
    updateFocus(ui->cameraFocusSlider->value());
    updateBrightness(ui->cameraBrightnessSlider->value());
    updateSharpness(ui->cameraSharpnessSlider->value());
    connect(ui->cameraFocusSlider,SIGNAL(valueChanged(int)),this,SLOT(updateFocus(int)));
    connect(ui->cameraBrightnessSlider,SIGNAL(valueChanged(int)),this,SLOT(updateBrightness(int)));
    connect(ui->cameraSharpnessSlider,SIGNAL(valueChanged(int)),this,SLOT(updateSharpness(int)));
}
Esempio n. 12
0
void MainWindow::on_actionAdd_File_triggered()
{
	this->settings->beginGroup(QStringLiteral("paths"));

	QFileDialog *dialog = new QFileDialog(this);
	DialogMaster::masterDialog(dialog);
	dialog->setWindowTitle(tr("Open Icon Archive"));
	dialog->setAcceptMode(QFileDialog::AcceptOpen);
	dialog->setFileMode(QFileDialog::ExistingFiles);
	dialog->setDirectory(this->settings->value(QStringLiteral("openPath")).toString());

	QStringList mTypes = byteToStringList(QImageReader::supportedMimeTypes());
	mTypes.append(QStringLiteral("application/octet-stream"));
	dialog->setMimeTypeFilters(mTypes);

	QString selFilter = this->settings->value(QStringLiteral("openFilter")).toString();
	qDebug() << selFilter;
	if(selFilter.isEmpty()) {
#if defined(Q_OS_WIN)
	dialog->selectMimeTypeFilter(QStringLiteral("image/vnd.microsoft.icon"));
#elif defined(Q_OS_OSX)
	dialog->selectMimeTypeFilter(QStringLiteral("image/x-icns"));
#else
	dialog->selectMimeTypeFilter(QStringLiteral("image/png"));
#endif
	} else
		dialog->selectNameFilter(selFilter);

	this->settings->endGroup();
	dialog->open(this, SLOT(fileSelected(QStringList)));
}
Esempio n. 13
0
void FileSelector::openFile() {
	QFile file(line->text());
	if(!file.exists()) {
		line->setText("");
	}
	Q_EMIT fileSelected(line->text());
}
Esempio n. 14
0
QWidget *InputCreator::setupLogTab() {
	QWidget *tab = new QWidget();
	
	QFormLayout *layout = new QFormLayout();
	
	QHBoxLayout *selectionLayout = new QHBoxLayout();
	
	m_fileLocation = new QLabel(tr("Not selected."));
	selectionLayout->addWidget(m_fileLocation);
	
	QPushButton *selectFile = new QPushButton(style()->standardIcon(QStyle::SP_DirOpenIcon), tr(""));
	selectionLayout->addWidget(selectFile);
	connect(selectFile, SIGNAL(clicked()), this, SLOT(fileSelected()));
	
	layout->addRow(tr("File location:"), selectionLayout);
	
	m_logCreateButton = new QPushButton(tr("&Open log"));
	m_logCreateButton->setDisabled(true);
	layout->addWidget(m_logCreateButton);
	connect(m_logCreateButton, SIGNAL(clicked()), this, SLOT(createLogInput()));
	
	tab->setLayout(layout);
	
	return tab;
}
void CueSplitter::run()
{
	m_bSuccess = false;
	m_bAborted = false;
	m_abortFlag = false;
	m_nTracksSuccess = 0;
	m_nTracksSkipped = 0;
	m_decompressedFiles.clear();
	m_activeFile.clear();
	
	if(!QDir(m_outputDir).exists())
	{
		qWarning("Output directory \"%s\" does not exist!", QUTF8(m_outputDir));
		return;
	}
	
	QStringList inputFileList = m_inputFilesInfo.keys();
	int nInputFiles = inputFileList.count();
	
	emit progressMaxChanged(nInputFiles);
	emit progressValChanged(0);

	//Decompress all input files
	for(int i = 0; i < nInputFiles; i++)
	{
		const AudioFileModel_TechInfo &inputFileInfo = m_inputFilesInfo[inputFileList.at(i)].techInfo();
		if(inputFileInfo.containerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.audioType().compare("PCM", Qt::CaseInsensitive))
		{
			AbstractDecoder *decoder = DecoderRegistry::lookup(inputFileInfo.containerType(), inputFileInfo.containerProfile(), inputFileInfo.audioType(), inputFileInfo.audioProfile(), inputFileInfo.audioVersion());
			if(decoder)
			{
				m_activeFile = shortName(QFileInfo(inputFileList.at(i)).fileName());
				
				emit fileSelected(m_activeFile);
				emit progressValChanged(i+1);
				
				QString tempFile = QString("%1/~%2.wav").arg(m_outputDir, lamexp_rand_str());
				connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
				
				if(decoder->decode(inputFileList.at(i), tempFile, &m_abortFlag))
				{
					m_decompressedFiles.insert(inputFileList.at(i), tempFile);
					m_tempFiles.append(tempFile);
				}
				else
				{
					qWarning("Failed to decompress file: <%s>", inputFileList.at(i).toLatin1().constData());
					lamexp_remove_file(tempFile);
				}
				
				m_activeFile.clear();
				LAMEXP_DELETE(decoder);
			}
			else
			{
				qWarning("Unsupported input file: <%s>", inputFileList.at(i).toLatin1().constData());
			}
		}
Esempio n. 16
0
void FileBrowserWidget::emitFileSelectedSignal()
{
	KFileItemList itemList = m_dirOperator->selectedItems();
	for(KFileItemList::iterator it = itemList.begin(); it != itemList.end(); ++it) {
		emit(fileSelected(*it));
	}

	m_dirOperator->view()->clearSelection();
}
Esempio n. 17
0
void MediaBrowser::slotAddToSchedule()
{
	QModelIndex idx = m_listView->currentIndex();
	if(idx.isValid())
	{
		QFileInfo info = m_fsModel->fileInfo(idx);
		emit fileSelected(info);
	}
}
Esempio n. 18
0
void FileSelector::accept()
{
    QModelIndex index = m_view->currentIndex();
    if (index.isValid()) {
        if (!m_model->isDir(index)) {
            emit fileSelected(m_model->filePath(index));
        }
    }
}
Esempio n. 19
0
void OptionsWidget::onCachePathButtonClick()
{
  qDebug() <<"click";
  QFileDialog fd(this);
  fd.setFileMode(QFileDialog::DirectoryOnly);
  fd.setOptions(QFileDialog::ShowDirsOnly);
  connect(&fd, SIGNAL(fileSelected(QString)), this, SLOT(onCachePathSelected(QString)));
  fd.exec();
}
Esempio n. 20
0
void OpenFile::accept()
{
    int index = getSelectedIndex();
    if (showNewFile && !index)
        index = -2;
    emit fileSelected(index, getSelectedFileName());
    
    OpenFileBase::accept();
}
Esempio n. 21
0
void loadTTeamDialog(Team &team, QObject *receiver, const char *slot)
{
    QSettings s;
    QString defaultPath = s.value("Teams/Folder").toString();
    QFileDialog *f = new QFileDialog(NULL, QObject::tr("Loading the Team"),defaultPath);
    //f->setWindowFlags(Qt::Window); //maybe the reason for crashes
    f->setAttribute(Qt::WA_DeleteOnClose);
    f->setAcceptMode(QFileDialog::AcceptOpen);
    f->setFileMode(QFileDialog::ExistingFile);
    f->show();

    TeamSaver *t = new TeamSaver(&team);
    t->setParent(f);

    QObject::connect(f, SIGNAL(fileSelected(QString)), t, SLOT(fileNameReceivedL(QString)));
    if (receiver)
        QObject::connect(f, SIGNAL(fileSelected(QString)), receiver, slot);
}
void GImageSaver::ChooseFolder()
{
	QFileDialog* pDialog = new QFileDialog(0, "Select folder", m_Folder);
	pDialog->setFileMode(QFileDialog::Directory);
	pDialog->setOption(QFileDialog::ShowDirsOnly);
	pDialog->show();	
	pDialog->setAttribute(Qt::WA_DeleteOnClose);

	connect(pDialog, SIGNAL(fileSelected(QString)), this, SLOT(SetFolder(QString)));
}
void CFileBrowser::loadFileFromDevice(){
    //Load a file from the device
    QFileDialog fileDialog;
    connect(&fileDialog,
            SIGNAL(fileSelected(QString)),
            this,
            SLOT(loadFileFromDeviceSelected(QString)), Qt::QueuedConnection);
    fileDialog.setFileMode(QFileDialog::DirectoryOnly);
    fileDialog.setOptions(QFileDialog::ShowDirsOnly);
    fileDialog.exec();
}
Esempio n. 24
0
	/** File-selection handler */
	void FileBrowser::handleSelection(const QModelIndex& index,
		const QModelIndex& prev)
	{
		if (index.row() == prev.row())
			return;

		if ( ! fsModel->isDir(index))
		{
			emit fileSelected(fsModel->filePath(index));
		}
	}
Esempio n. 25
0
void saveTTeamDialog(const Team &team, QObject *receiver, const char *slot)
{
    QSettings s;
    QString defaultPath = s.value("Teams/Folder").toString();
    QFileDialog *f = new QFileDialog(NULL, QObject::tr("Saving the Team"),defaultPath, QObject::tr("Team(*.tp)"));
    //f->setWindowFlags(Qt::Window); //maybe the reason for crashes for some people
    f->setAttribute(Qt::WA_DeleteOnClose);
    f->setAcceptMode(QFileDialog::AcceptSave);
#if defined(Q_OS_MAC)
    f->setOption(QFileDialog::DontUseNativeDialog);
#endif
    f->show();

    TeamSaver *t = new TeamSaver(const_cast<Team*>(&team));
    t->setParent(f);

    QObject::connect(f, SIGNAL(fileSelected(QString)), t, SLOT(fileNameReceived(QString)));
    if (receiver)
        QObject::connect(f, SIGNAL(fileSelected(QString)), receiver, slot);
}
Esempio n. 26
0
void FileBrowser::currentChangedSlot(QListWidgetItem *itm)
{
    if (!itm)
        return;

    QString name = itm->text();
    QString path = m_path + "/" + name;

    if (QFileInfo(path).isFile())
    	emit fileSelected(path);
}
Esempio n. 27
0
void QmitkDicomEditor::SetupImportDialog()
{
        //Initialize import widget
        m_ImportDialog = new ctkFileDialog();
        QCheckBox* importCheckbox = new QCheckBox("Copy on import", m_ImportDialog);
        m_ImportDialog->setBottomWidget(importCheckbox);
        m_ImportDialog->setFileMode(QFileDialog::Directory);
        m_ImportDialog->setLabelText(QFileDialog::Accept,"Import");
        m_ImportDialog->setWindowTitle("Import DICOM files from directory ...");
        m_ImportDialog->setWindowModality(Qt::ApplicationModal);
        connect(m_ImportDialog, SIGNAL(fileSelected(QString)),this,SLOT(OnFileSelected(QString)));
}
Esempio n. 28
0
MusicWindow::MusicWindow(MusicPlayer* player) 
{
	ui.setupUi(this);

	this->player = player;

	initFolderList();

	// SIGNALS
	connect(ui.folderList, SIGNAL(itemSelectionChanged()), this, SLOT(folderSelected()));
	connect(ui.fileList, SIGNAL(itemSelectionChanged()), this, SLOT(fileSelected()));
}
Esempio n. 29
0
void CategoryDialog::showDirDialog()
{
    QFileDialog *dlg = new QFileDialog(this);
    dlg->setDirectory(ui->catpath->text());
    dlg->setAttribute(Qt::WA_DeleteOnClose);
    dlg->setFileMode(QFileDialog::DirectoryOnly);
    dlg->setWindowTitle(tr("Выбор директории"));
    dlg->setOption(QFileDialog::DontUseNativeDialog);
    dlg->setModal(true);
    connect(dlg,SIGNAL(fileSelected(QString)),this,SLOT(setCategoryDir(QString)));
    dlg->show();
}
Esempio n. 30
0
QIODevice* LoggingConnection::openDevice(const QString &deviceName)
{
    if (logFile.isOpen()){
        logFile.close();
    }
    QFileDialog * fd = new QFileDialog();
    fd->setAcceptMode(QFileDialog::AcceptOpen);
    fd->setNameFilter("OpenPilot Log (*.opl)");
    connect(fd, SIGNAL(fileSelected(QString)), this, SLOT(startReplay(QString)));
    fd->exec();
    return &logFile;
}