bool QtFileIconView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break;
    case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break;
    case 2: newDirectory(); break;
    case 3: currentDir(); break;
    case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break;
    case 6: viewLarge(); break;
    case 7: viewSmall(); break;
    case 8: viewBottom(); break;
    case 9: viewRight(); break;
    case 10: flowEast(); break;
    case 11: flowSouth(); break;
    case 12: itemTextTruncate(); break;
    case 13: itemTextWordWrap(); break;
    case 14: sortAscending(); break;
    case 15: sortDescending(); break;
    case 16: arrangeItemsInGrid(); break;
    case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 18: openFolder(); break;
    default:
	return QIconView::qt_invoke( _id, _o );
    }
    return TRUE;
}
Example #2
0
QNapiOpenDialog::QNapiOpenDialog( QWidget * parent, const QString & caption,
									const QString & init_path,
									FilterMode filterMode )
							: QFileDialog(parent)
{
	setAttribute(Qt::WA_QuitOnClose, false);
	setWindowTitle(caption);

	if(filterMode == Movies)
	{
#if QT_VERSION >= 0x040400
		setNameFilter
#else
		setFilter
#endif
				(tr("Filmy (*.avi *.asf *.divx *.mkv *.mov *.mp4 *.mpeg *.mpg *.ogm "
					"*.rm *.rmvb *.wmv);;Wszystkie pliki (*.*)"));
	}
	else if(filterMode == Subtitles)
	{
#if QT_VERSION >= 0x040400
		setNameFilter
#else
		setFilter
#endif
				(tr("Napisy (*.txt);;Wszystkie pliki (*.*)"));
	}

	if(QFileInfo(init_path).isDir())
		setDirectory(init_path);
	else
		setDirectory(QDir::currentPath());

	QStringList sideUrls;
	
#ifdef Q_WS_MAC
	sideUrls << "/Volumes";
	setAttribute(Qt::WA_MacBrushedMetal, GlobalConfig().useBrushedMetal());
#endif

	sideUrls << QString(QDir::homePath() + "/Movies") << QString(QDir::homePath() + "/movies")
				<< QString(QDir::homePath() + "/Video") << QString(QDir::homePath() + "/video")
				<< QString(QDir::homePath() + "/Filmy") << QString(QDir::homePath() + "/filmy")
				<< QString(QDir::homePath() + "/Wideo") << QString(QDir::homePath() + "/wideo");

	QList<QUrl> urls = sidebarUrls();

	foreach(QString sideUrl, sideUrls)
	{
		if(!QDir().exists(sideUrl)) continue;
		QUrl url = QUrl::fromLocalFile(sideUrl);
		if(!urls.contains(url))
			urls << url;
	}

	setSidebarUrls(urls);
}
Example #3
0
void Wizard::setConnexions()
{
    connect(m_ui->bypassCheck,SIGNAL(clicked()),this,SLOT(bypassXML()));
    connect(this,SIGNAL(accepted()),this,SLOT(createProject())); // Finish pushButton
    connect(m_ui->browseButton,SIGNAL(clicked()),SLOT(setDirectory()));
    connect(m_ui->projectNameEdit,SIGNAL(textEdited(QString)),this,SLOT(editText(QString)));
}
Example #4
0
	void Konsole::sync()
	{
		if(!KileConfig::syncConsoleDirWithTabs()) {
			return;
		}

		KTextEditor::Document *doc = m_ki->activeTextDocument();
		KTextEditor::View *view = Q_NULLPTR;

		if(doc) {
			view = doc->views().first();
		}

		if(view) {
			QString finame;
			QUrl url = view->document()->url();

			if(url.path().isEmpty()) {
				return;
			}

			QFileInfo fic(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
			if(fic.isReadable()) {
				setDirectory(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
			}
		}
	}
Example #5
0
void Navigator::checkDirectory (Q3ListBoxItem *item)
{
  //qDebug("checkDirectory(selected)");
  if (! item)
  {
    emit noSelection();
    selectedFlag = FALSE;
    return;
  }

  if (! item->text().compare(".."))
  {
    upDirectory();
    return;
  }

  QString s;
  if (item->pixmap())
  {
    // step directory tree down
    s = currentDir.absPath() + "/" + item->text();
    setDirectory(s);
    return;
  }

  getFileSelection(s);
  emit fileOpened(s);
}
Example #6
0
// User clicked up directory button
long FileSelector::onCmdDirUp(FXObject*,FXSelector,void*)
{
    setDirectory(FXPath::upLevel(list->getDirectory()));
   	pathlink->setPath(list->getDirectory());
   	pathtext->setText(list->getDirectory());
    return 1;
}
Example #7
0
// Back to current working directory
long FileSelector::onCmdWork(FXObject*,FXSelector,void*)
{
    setDirectory(FXSystem::getCurrentDirectory());
   	pathlink->setPath(list->getDirectory());
	pathtext->setText(list->getDirectory());
    return 1;
}
Example #8
0
UDirWalk::UDirWalk(const char* dir, const char* _filter, uint32_t _filter_len)
{
   U_TRACE_REGISTER_OBJECT(0, UDirWalk, "%S,%.*S,%u", dir, _filter_len, _filter, _filter_len)

   max               = 128 * 1024;
   depth             = -1; // starting recursion depth
   pthis             = this;
   sort_by           = 0;
   filetype          = '.';
   call_if_up        = 0;
   call_internal     = 0;
   call_if_directory = brecurse = is_directory = false;

   if (dir) (void) setDirectory(dir, _filter, _filter_len);
   else
      {
      pathname[0]             = '.';
      pathname[(pathlen = 1)] = '\0';

      if ((filter_len = _filter_len))
         {
         filter      = _filter;
         u_pfn_flags = 0;
         u_pfn_match = u_dosmatch_with_OR;
         }
      }
}
Example #9
0
/*! 
 * set directory and name for VTK file
 * @param[in]  dir_    directory of file with final "/"
 * @param[in]  name_   file name without suffix
 */
void  VTK::setNames( std::string dir_, std::string name_ ){

  setDirectory(dir_);
  setName(name_);

  return ;
};
Example #10
0
QString QG_FileDialog::getOpenFile(RS2::FormatType* type){
//    bool fileAccepted = false;
    setAcceptMode ( QFileDialog::AcceptOpen );
    // read default settings:
    RS_SETTINGS->beginGroup("/Paths");
    QString defDir = RS_SETTINGS->readEntry("/Open",
                                              RS_SYSTEM->getHomeDir());
    RS_SETTINGS->endGroup();

    RS_DEBUG->print("defDir: %s", defDir.toLatin1().data());
    QString fn = "";
    QStringList filters;
    filters << fDxfrw  << fDxf1 << fLff << fCxf << fJww;

    setWindowTitle(tr("Open %1").arg(name));
#if QT_VERSION >= 0x040400
    setNameFilters(filters);
#endif
    setDirectory(defDir);
    setFileMode(QFileDialog::ExistingFile);
#if QT_VERSION >= 0x040400
    selectNameFilter(fDxfrw);
#endif
    ftype= RS2::FormatDXFRW;
    RS_DEBUG->print("defFilter: %s", fDxfrw.toLatin1().data());

    /* preview RVT PORT preview is currently not supported by QT4
    RS_Graphic* gr = new RS_Graphic;
    QG_GraphicView* prev = new QG_GraphicView(parent);
    prev->setContainer(gr);
    prev->setBorders(1, 1, 1, 1);
    fileDlg->setContentsPreviewEnabled(true);
    fileDlg->setContentsPreview(prev, prev); */

    if (exec()==QDialog::Accepted) {
        QStringList fl = selectedFiles();
        if (!fl.isEmpty()) {
            fn = fl[0];
        }
        fn = QDir::toNativeSeparators( QFileInfo(fn).absoluteFilePath() );

        if (type!=NULL) {
                getType(selectedFilter());
                *type = ftype;
        }

    // store new default settings:
        RS_SETTINGS->beginGroup("/Paths");
        RS_SETTINGS->writeEntry("/Open", QFileInfo(fn).absolutePath());
        RS_SETTINGS->writeEntry("/OpenFilter", selectedFilter());
        RS_SETTINGS->endGroup();
    }

    RS_DEBUG->print("QG_FileDialog::getOpenFileName: fileName: %s", fn.toLatin1().data());
    RS_DEBUG->print("QG_FileDialog::getOpenFileName: OK");

    // RVT PORT delete prev;
    // RVT PORT delete gr;
    return fn;
}
Example #11
0
//------------------------------------------------------------------------------
void ctkFileDialog::accept()
{
  QLineEdit* fileNameEdit = qobject_cast<QLineEdit*>(this->sender());
  if (fileNameEdit)
    {
    QFileInfo info(fileNameEdit->text());
    if (info.isDir())
      {
      setDirectory(info.absoluteFilePath());
      return;
      }
    }
  // Don't accept read-only directories if we are in AcceptSave mode.
  if ((this->fileMode() == Directory || this->fileMode() == DirectoryOnly) &&
      this->acceptMode() == AcceptSave)
    {
    QStringList files = this->selectedFiles();
    QString fn = files.first();
    QFileInfo info(fn);
    if (info.isDir() && !info.isWritable())
      {
      this->setDirectory(info.absoluteFilePath());
      return;
      }
    }
  this->Superclass::accept();
}
bool GitRunner::isValidDirectory()
{
    const QString initialPath(m_lastRepoRoot->toLocalFile(KUrl::RemoveTrailingSlash));
    setDirectory(*m_lastRepoRoot);

    // A possible git repo has a .git subdicerctory
    const QString gitDir(".git");

    // Also, git rev-parse --is-inside-work-tree returns "true" if we are
    // inside any subdirectory of the git tree.
    DvcsJob *job = new DvcsJob();
    initJob(*job);
    *job << "rev-parse";
    *job << "--is-inside-work-tree";
    startJob(*job);

    QFileInfo finfo(initialPath);
    QDir dir;
    if (finfo.isFile()) {
        dir = finfo.absoluteDir();
    } else {
        dir = QDir(initialPath);
        dir.makeAbsolute();
    }

    return (dir.exists(gitDir) && m_result.compare("true")) ? true : false;
}
Example #13
0
MediaBrowser::MediaBrowser(const QString &directory, QWidget *parent)
	: QWidget(parent)
	, m_currentDirectory("")
	, m_prevPathKey("media")
	, m_backgroundActionsEnabled(true)
	, m_iconSize(MEDIABROWSER_LIST_ICON_SIZE)
	, m_controlWidget(0)
	, m_autoPlayVideo(true)
	, m_autoPlayCheckbox(0)
	, m_ignoreBookmarkIdxChange(false)
{
	setObjectName("MediaBrowser");
	setupUI();

	QStringList filters;

	filters << tr("Media Files (*.wmv *.mpeg *.mpg *.avi *.wmv *.flv *.mov *.mp4 *.m4a *.3gp *.3g2 *.mj2 *.mjpeg *.ipod *.m4v *.gsm *.gif *.swf *.dv *.dvd *.asf *.mtv *.roq *.aac *.ac3 *.aiff *.alaw *.iif *.png *.jpg *.bmp *.svg *.xpm)");
	filters << tr("Video Files (*.wmv *.mpeg *.mpg *.avi *.wmv *.flv *.mov *.mp4 *.m4a *.3gp *.3g2 *.mj2 *.mjpeg *.ipod *.m4v *.gsm *.swf *.dv *.dvd *.asf *.mtv *.roq *.aac *.ac3 *.aiff *.alaw *.iif)");
	filters << tr("Image Files (*.png *.jpg *.bmp *.svg *.xpm *.gif)");
	filters << tr("Any File (*.*)");

	setFileTypeFilterList(filters);

	setDirectory(directory.isEmpty() ? AppSettings::previousPath(m_prevPathKey) : directory);
}
WindowAnotationManager::WindowAnotationManager(const QString &path, ShapeTracker *tracker, QWidget *parent) :
    QMainWindow(parent), ui(new Ui::WindowAnotationManager)
{
    ui->setupUi(this);
    setTracker(tracker);
    setDirectory(path);
}
Example #15
0
void OpenFileDialog::on_treeView_activated(const QModelIndex &index)
{
    if (mDirModel->isDir(index))
    {
        auto mSelectedDir = mDirModel->filePath(index);
        if (mSelectedDir.endsWith(".."))
        {
            // remove "/.."
            mSelectedDir = mSelectedDir.left(mSelectedDir.length()-3);
            QFileInfo info = (mSelectedDir);
            // get parent directory
            mSelectedDir = info.path();
        }

        setDirectory(mSelectedDir);
        mDirModel->setRootPath(getDirectory());
        mDirModel->setFilter(QDir::NoDot | QDir::AllEntries);
        ui->treeView->setRootIndex(mDirModel->index(getDirectory()));
    }
    else
    {
        mSelectedFile = mDirModel->filePath(index);
        this->accept();
    }
}
void WindowAnotationManager::on_btnBrowse_clicked()
{
    QString selected = QFileDialog::getExistingDirectory(this, QString(), path);
    if (selected.isNull() || selected.isEmpty()) return;

    saveMetadataAndShapes();
    setDirectory(selected);
}
Example #17
0
void TimeLapseWidget::setupConnections()
{
    connect(startButton, SIGNAL(clicked()), this, SLOT(startShooting()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stopPressed()));
    connect(directoryButton, SIGNAL(clicked()), this, SLOT(setDirectory()));
    connect(saveDirectory, SIGNAL(textChanged(QString)), this, SLOT(saveDirectoryUpdated()));
    connect(attachedCameras, SIGNAL(currentIndexChanged(QString)), this, SLOT(attachedCameraSelectionChanged()));
}
IVLEFetcher::IVLEFetcher(QString token, QString dir, QObject *parent) :
    QObject(parent)
{
    this->token = token;
    setDirectory(dir);
    manager = new QNetworkAccessManager(this);
    connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(gotReply(QNetworkReply*)));
}
Example #19
0
void MainWindowModel::changeDirectory()
{
    auto directory = QFileDialog::getExistingDirectory(nullptr, tr("Select directory"));
    if (directory != QString::null)
    {
        setDirectory(directory);
    }
}
//========================================================================================
TileCache_cl::TileCache_cl(string sDirectory)
{
	setDirectory(sDirectory) ;

	cacheData() ;


}
Example #21
0
QNapiOpenDialog::QNapiOpenDialog(QWidget* parent, const QString& caption,
                                 const QString& init_path,
                                 FilterMode filterMode)
    : QFileDialog(parent), staticConfig(LibQNapi::staticConfig()) {
  setAttribute(Qt::WA_QuitOnClose, false);
  setWindowTitle(caption);

  if (filterMode == Movies) {
    setNameFilter(tr("Video files (%1);;All files (*.*)")
                      .arg(staticConfig->movieExtensionsFilter()));
  } else if (filterMode == Subtitles) {
    setNameFilter(tr("Subtitles files (%1);;All files (*.*)")
                      .arg(staticConfig->subtitleExtensionsFilter()));
  }

  if (QFileInfo(init_path).isDir())
    setDirectory(init_path);
  else
    setDirectory(QDir::currentPath());

  QStringList sideUrls;

#ifdef Q_OS_MAC
  sideUrls << "/Volumes";
#endif

  sideUrls << QString(QDir::homePath() + "/Movies")
           << QString(QDir::homePath() + "/movies")
           << QString(QDir::homePath() + "/Video")
           << QString(QDir::homePath() + "/video")
           << QString(QDir::homePath() + "/Videos")
           << QString(QDir::homePath() + "/videos")
           << QString(QDir::homePath() + "/Filmy")
           << QString(QDir::homePath() + "/wideo");

  QList<QUrl> urls = sidebarUrls();

  foreach (QString sideUrl, sideUrls) {
    if (!QDir().exists(sideUrl)) continue;
    QUrl url = QUrl::fromLocalFile(sideUrl);
    if (!urls.contains(url)) urls << url;
  }

  setSidebarUrls(urls);
}
Example #22
0
/*!
  Elementary constructor.
*/
vpDiskGrabber::vpDiskGrabber()
  : image_number(0), image_step(1), number_of_zero(0), useGenericName(false)
{
  setDirectory("/tmp");
  setBaseName("I");
  setExtension("pgm");

  init = false;
}
Example #23
0
void GtkFileDialog::applyOptions() {
    GtkDialog *gtkDialog = d->gtkDialog();

    Libs::gtk_window_set_title(Libs::gtk_window_cast(gtkDialog), _windowTitle.toUtf8());
    Libs::gtk_file_chooser_set_local_only(Libs::gtk_file_chooser_cast(gtkDialog), true);

    const GtkFileChooserAction action = gtkFileChooserAction(_fileMode, _acceptMode);
    Libs::gtk_file_chooser_set_action(Libs::gtk_file_chooser_cast(gtkDialog), action);

    const bool selectMultiple = (_fileMode == QFileDialog::ExistingFiles);
    Libs::gtk_file_chooser_set_select_multiple(Libs::gtk_file_chooser_cast(gtkDialog), selectMultiple);

    const bool confirmOverwrite = !_options.testFlag(QFileDialog::DontConfirmOverwrite);
    Libs::gtk_file_chooser_set_do_overwrite_confirmation(Libs::gtk_file_chooser_cast(gtkDialog), confirmOverwrite);

    if (!_nameFilters.isEmpty())
        setNameFilters(_nameFilters);

    if (!_initialDirectory.isEmpty())
        setDirectory(_initialDirectory);

    for_const (const auto &filename, _initialFiles) {
        if (_acceptMode == QFileDialog::AcceptSave) {
            QFileInfo fi(filename);
            Libs::gtk_file_chooser_set_current_folder(Libs::gtk_file_chooser_cast(gtkDialog), fi.path().toUtf8());
            Libs::gtk_file_chooser_set_current_name(Libs::gtk_file_chooser_cast(gtkDialog), fi.fileName().toUtf8());
        } else if (filename.endsWith('/')) {
            Libs::gtk_file_chooser_set_current_folder(Libs::gtk_file_chooser_cast(gtkDialog), filename.toUtf8());
        } else {
            Libs::gtk_file_chooser_select_filename(Libs::gtk_file_chooser_cast(gtkDialog), filename.toUtf8());
        }
    }

    const QString initialNameFilter = _nameFilters.isEmpty() ? QString() : _nameFilters.front();
    if (!initialNameFilter.isEmpty())
        selectNameFilter(initialNameFilter);

    if (CustomButtonsSupported()) {
        GtkWidget *acceptButton = Libs::gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK);
        if (acceptButton) {
            /*if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
            	Libs::gtk_button_set_label(Libs::gtk_button_cast(acceptButton), opts->labelText(QFileDialogOptions::Accept).toUtf8());
            else*/ if (_acceptMode == QFileDialog::AcceptOpen)
                Libs::gtk_button_set_label(Libs::gtk_button_cast(acceptButton), GTK_STOCK_OPEN);
            else
                Libs::gtk_button_set_label(Libs::gtk_button_cast(acceptButton), GTK_STOCK_SAVE);
        }

        GtkWidget *rejectButton = Libs::gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_CANCEL);
        if (rejectButton) {
            /*if (opts->isLabelExplicitlySet(QFileDialogOptions::Reject))
            	Libs::gtk_button_set_label(Libs::gtk_button_cast(rejectButton), opts->labelText(QFileDialogOptions::Reject).toUtf8());
            else*/
            Libs::gtk_button_set_label(Libs::gtk_button_cast(rejectButton), GTK_STOCK_CANCEL);
        }
    }
}
Example #24
0
void MediaBrowser::loadBookmarkIndex(int idx)
{
	if(m_ignoreBookmarkIdxChange)
		return;
		
	if(idx < 0 || idx >= m_bookmarkList.size())
		return;
	
	setDirectory(m_bookmarkList[idx].first);
}
Example #25
0
void Navigator::setHome ()
{
  /*QString s = basePath;
  currentDir.setPath(s);
  updateList();
  emit noSelection();
  selectedFlag = FALSE;
  */
  setDirectory(basePath);
}
Example #26
0
GUI_TemplateDialog::GUI_TemplateDialog(GUI_WinBase *pw, bool bSave, const char *ext, const char *defaultFN, bool (*cmd)(const char *)):
GUI_Dialog( pw, "Templates", 0, 0, 480, 244 ),
fileListBox(NULL),
bttnOK(NULL),
fileEdit(NULL),
file_cmd(cmd),
fileExtension(ext)
{
    setDirectory();
    bNeedUpdate = true;
}
int main(void)
{

	srand(time(0));
	
	int SIZE = 10;
	char* rooms[] = {"blue", "red", "ONE", "TWO", "Big", "Small", "best", "worst", "CARPET", "WOOD"};
	int CHOSEN_ROOMS_SIZE = 7;
	char * chosenRooms[] = { "", "", "", "", "", "", "" };
	char *directory_name;
	// initialize some variables and set up room files
	setDirectory( &directory_name );
	makeRooms( rooms, SIZE, directory_name, chosenRooms, CHOSEN_ROOMS_SIZE );
	// the first chosen room is always START_ROOM
	// (the last chosen room is always END_ROOM)
	char* curr_loc = chosenRooms[0];
	
	struct Moves* moves = (struct Moves*) malloc( sizeof( struct Moves ) );
	moves->room = curr_loc;
	moves->next = NULL;
	int moves_count = 0;
	int* moves_count_p = &moves_count;
	
	
	int isEnd = 0;
	while ( ! isEnd ) {
		presentCurrentLocation( curr_loc );
		listLocations( curr_loc, directory_name );
		promptUser( &curr_loc, directory_name, moves, moves_count_p );
		// Check if user is in END_ROOM
		if ( ! strcmp( curr_loc, chosenRooms[CHOSEN_ROOMS_SIZE - 1] ) ) {
			printEndingMessage( moves, moves_count );
			// break out of while loop
			isEnd = 1;
		}
	}
	
	
	//clean up
	free( directory_name );
	free( curr_loc );
	int i;
	for ( i = 0; i < CHOSEN_ROOMS_SIZE; ++i ) {
		free( chosenRooms[i] );
	}
	while( moves->next != NULL ) {
		struct Moves* temp = moves->next;
		free( moves );
		moves = temp;
	}
	free( moves );

	exit(0);
}
Example #28
0
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::RDirectoryCnv::updateRep(IOpaqueAddress* /* pAddress */,
                                                 DataObject* pObject)
//-----------------------------------------------------------------------------
{
  const std::string& loc = pObject->registry()->identifier();
  if ( createDirectory(loc).isSuccess() )   {
    setDirectory(loc);
    return StatusCode::SUCCESS;
  }
  return StatusCode::FAILURE;
}
Example #29
0
vpDiskGrabber::vpDiskGrabber(const char *dir, const char *basename,
                             long number,
                             int step, unsigned int noz,
                             const char *ext)
  : image_number(number), image_step(step), number_of_zero(noz), useGenericName(false)
{
  setDirectory(dir);
  setBaseName(basename);
  setExtension(ext);

  init = false;
}
void QtFileIconView::openFolder()
{
    if ( !openItem )
        return;
    if ( openItem->type() != QtFileIconViewItem::Dir ||
            openItem->type() == QtFileIconViewItem::Dir &&
            !QDir( openItem->itemFileName ).isReadable() )
        return;

    openItem->timer.stop();
    setDirectory( openItem->itemFileName );
}