Ejemplo n.º 1
0
void FolderPost::Serialize(Json::Value& root) {
    Json::Value folder(Json::objectValue);
    folder["foldername"] = folder_.foldername();
    folder["parent_post"] = folder_.parent_post_id();
    set_content("folder", folder);

    Post::Serialize(root);
}
Ejemplo n.º 2
0
void Sprite::addFrame(frame_t newFrame)
{
  setTotalFrames(m_frames+1);
  for (frame_t i=m_frames-1; i>=newFrame; --i)
    setFrameDuration(i, frameDuration(i-1));

  folder()->displaceFrames(newFrame, +1);
}
Ejemplo n.º 3
0
void VLogFile::load(VXml xml)
{
  VLog::load(xml);

  QString _folder = xml.getStr("folder", folder()); setFolder(_folder);
  fileName        = xml.getStr("fileName", fileName);
  closeOnWrite    = xml.getBool("closeOnWrite", closeOnWrite);
}
Ejemplo n.º 4
0
Layer* Sprite::indexToLayer(LayerIndex index) const
{
  if (index < LayerIndex(0))
    return NULL;

  int index_count = -1;
  return index2layer(folder(), index, &index_count);
}
Ejemplo n.º 5
0
void VLogFile::save(VXml xml)
{
  VLog::save(xml);

  xml.setStr("folder",        folder());
  xml.setStr("fileName",      fileName);
  xml.setBool("closeOnWrite", closeOnWrite);
}
void BookmarkGui::setFolderItemDecorations( QTreeWidgetItem* item , const QString& name , const QString& id )
{
    QIcon folder(":/icons/crystal/folder.png") ;
    item->setIcon( 0 , folder);
    item->setText( 0 , name );

    item->setText( 1 , id ) ;
}
Ejemplo n.º 7
0
void Sprite::removeFrame(frame_t frame)
{
  folder()->displaceFrames(frame, -1);

  frame_t newTotal = m_frames-1;
  for (frame_t i=frame; i<newTotal; ++i)
    setFrameDuration(i, frameDuration(i+1));
  setTotalFrames(newTotal);
}
Ejemplo n.º 8
0
 void testListAllEntriesEmpty()
 {
     long const blocks = 2048;
     boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
     teasafe::SharedCoreIO io(createTestIO(testPath));
     teasafe::TeaSafeFolder folder(io, 0, std::string("root"));
     std::vector<teasafe::EntryInfo> entries = folder.listAllEntries();
     ASSERT_EQUAL(entries.size(), 0, "testListAllEntriesEmpty: number of entries");
 }
Ejemplo n.º 9
0
// Clears all journal entries.
void Database_Logs::clear ()
{
  string directory = folder ();
  vector <string> files = filter_url_scandir (directory);
  for (auto file : files) {
    filter_url_unlink (filter_url_create_path (directory, file));
  }
  log ("The journal was cleared");
}
Ejemplo n.º 10
0
void FolderPost::Deserialize(Json::Value& root) {
    Post::Deserialize(root);

    Json::Value folder(Json::objectValue);
    get_content("folder", folder);
    folder_.set_foldername(folder.get("foldername", "").asString());
    folder_.set_parent_post_id(folder.get("parent_post", "").asString());
    folder_.set_folder_post_id(id());
}
Ejemplo n.º 11
0
static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
{
    int style = dialog->GetWindowStyle();
    wxGtkString filename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)));

    // gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
#ifndef __WXGTK3__
#if GTK_CHECK_VERSION(2,7,3)
    if (gtk_check_version(2, 7, 3) != NULL)
#endif
    {
        if ((style & wxFD_SAVE) && (style & wxFD_OVERWRITE_PROMPT))
        {
            if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
            {
                wxString msg;

                msg.Printf(
                    _("File '%s' already exists, do you really want to overwrite it?"),
                    wxString::FromUTF8(filename));

                wxMessageDialog dlg(dialog, msg, _("Confirm"),
                                   wxYES_NO | wxICON_QUESTION);
                if (dlg.ShowModal() != wxID_YES)
                    return;
            }
        }
    }
#endif

    if (style & wxFD_FILE_MUST_EXIST)
    {
        if ( !g_file_test(filename, G_FILE_TEST_EXISTS) )
        {
            wxMessageDialog dlg( dialog, _("Please choose an existing file."),
                                 _("Error"), wxOK| wxICON_ERROR);
            dlg.ShowModal();
            return;
        }
    }

    // change to the directory where the user went if asked
    if (style & wxFD_CHANGE_DIR)
    {
        // Use chdir to not care about filename encodings
        wxGtkString folder(g_path_get_dirname(filename));
        if ( chdir(folder) != 0 )
        {
            wxLogSysError(_("Changing current directory to \"%s\" failed"),
                          wxString::FromUTF8(folder));
        }
    }

    wxCommandEvent event(wxEVT_BUTTON, wxID_OK);
    event.SetEventObject(dialog);
    dialog->HandleWindowEvent(event);
}
Ejemplo n.º 12
0
void KNLibImageBuffer::setAlbumArtPath(const QString &folderPath)
{
    QDir folder(folderPath);
    m_albumArtFolder=folder.absolutePath()+"/";
    if(!folder.exists())
    {
        folder.mkpath(m_albumArtFolder);
    }
}
Ejemplo n.º 13
0
bool SysLibrary::UtilsLibrary::deleteFolder(QString path)
{
  QDir folder(path);
  if (folder.exists()) {
    return folder.removeRecursively();
  }

  return true;
}
Ejemplo n.º 14
0
	void RecentFilesManager::addRecentFolder(const MyGUI::UString& _folder)
	{
		MyGUI::UString folder(_folder);
		if (_folder.empty())
			folder = MyGUI::UString(common::getSystemCurrentFolder());

		mRecentFolders.insert(mRecentFolders.begin(), folder);

		checkArray(mRecentFolders, mMaxRecentFolders);
	}
Ejemplo n.º 15
0
bool FileSystemUtil::fileExists(const Common::String &filename) {
	Common::File f;
	if (f.exists(filename))
		return true;

	// Check if the file exists in the save folder
	Common::FSNode folder(PersistenceService::getSavegameDirectory());
	Common::FSNode fileNode = folder.getChild(getPathFilename(filename));
	return fileNode.exists();
}
Ejemplo n.º 16
0
// OnOK()
//
void CBrowseFolders::OnOK() 
{
	VARIANT var = m_folderCtrl.get_SelectedFolder();
	CMTVFolder folder(var.pdispVal);

	m_newPath = folder.GetPathName();
	m_newPath.MakeLower();

	CDialog::OnOK();
}
Ejemplo n.º 17
0
bool VFolder::IsEmpty() const
{
	if (!fFolder.Exists( true))
		return true;	// if there's no folder, there's nothing inside

	VFolderIterator folder( this, FI_WANT_ALL);
	VFileIterator file( this, FI_WANT_ALL);

	return ((file.Current() == NULL) && (folder.Current() == NULL));
}
Ejemplo n.º 18
0
void IssuesWidget::retryInsufficentRemoteStorageErrors(const QString &folderAlias)
{
    auto folderman = FolderMan::instance();
    auto folder = folderman->folder(folderAlias);
    if (!folder)
        return;

    folder->journalDb()->wipeErrorBlacklistCategory(SyncJournalErrorBlacklistRecord::InsufficientRemoteStorage);
    folderman->scheduleFolderNext(folder);
}
Ejemplo n.º 19
0
PHPFolder::Ptr_t PHPFolder::AddFolder(const wxString& name)
{
    PHPFolder::List_t::iterator iter =
        std::find_if(m_children.begin(), m_children.end(), PHPFolder::CompareByName(name));
    if(iter != m_children.end()) return (*iter);

    PHPFolder::Ptr_t folder(new PHPFolder(name));
    folder->SetParent(this);
    m_children.push_back(folder);
    return folder;
}
Ejemplo n.º 20
0
// GetPath()
//
CString CBrowseFolders::GetPath()
{
	if (IsWindow(m_folderCtrl.GetSafeHwnd()))
	{
		VARIANT var = m_folderCtrl.get_SelectedFolder();
		CMTVFolder folder(var.pdispVal);
		return folder.GetPathName();
	}

	return m_newPath;
}
Ejemplo n.º 21
0
void wxFolderMenuData::CreateMenu()
{
   // get the root folder
   MFolder_obj folder(wxEmptyString);

   // and add all of its children to the menu recursively
   m_menu = new wxMenu;
   size_t id = 0;
   wxString folderName;
   AddSubFoldersToMenu(folderName, folder, m_menu, id);
}
bool VProjectItemFolder::Create(const XBOX::VString& inFullPath)
{
	bool ok = false;

	VFolder folder(inFullPath);
	if (!folder.Exists())
		if (folder.CreateRecursive() == VE_OK)
			ok = true;
	
	return ok;
}
Ejemplo n.º 23
0
void parseArguments(int argc, char *argv[], std::string & filePath, bool & unitTest, bool & dirTest, int & timeOut)
{
	filePath	= "";
	unitTest	= false,
	dirTest		= false;

	if (argc > 1)
	{
		std::string argFirst = argv[1];

		if (argFirst[0] != '-')
		{
			const std::string	jaspExtension	= ".jasp",
								unitTestArg		= "--unitTest";

					filePath	= argFirst;
			bool	isJaspFile	= filePath.size() >= jaspExtension.size()  &&  filePath.substr(filePath.size() - jaspExtension.size()) == jaspExtension;
					unitTest	= isJaspFile && argc > 2 && argv[2] == unitTestArg;

			checkTimeOut(argc, argv, 3, timeOut);

		}
		else
		{
			if(argFirst == "--unitTestRecursive")
			{
				std::string argFolder = argv[2];

				QDir folder(QString::fromStdString(argFolder));

				if(!folder.exists())
				{
					std::cerr << "Folder for dir unittest " << argFolder << " does not exist!" << std::endl;
					exit(1);
				}

				dirTest		= true;
				filePath	= argFolder;

				checkTimeOut(argc, argv, 3, timeOut);
			}
			else if(argFirst.find("--remote-debugging-port=")	== std::string::npos &&
					argFirst.find("-qmljsdebugger")				== std::string::npos) //only other excepted argument
			{
				std::cout	<< "JASP can be started without arguments, or the following: filename {--unitTest {--timeOut=10}} | --unitTestRecursive folder {--timeOut=10}\n"
							<< "If a filename is supplied JASP will try to load it. If --unitTest is specified JASP will refresh all analyses in the JASP file and see if the output remains the same and will then exit with an errorcode indicating succes or failure.\n"
							<< "If --unitTestRecursive is specified JASP will go through specified \"folder\" and perform a --unitTest on each JASP file. After it has done this it will exit with an errorcode indication succes or failure.\n"
							<< "For both testing arguments there is the optional --timeout argument, which specifies how many minutes JASP will wait for the analyses-refresh to take. Default is 10 minutes."
							<< std::endl;
				exit(1);
			}
		}
	}
}
Ejemplo n.º 24
0
void
Project::OpenXMLFolders(tinyxml2::XMLElement* folders) {

	for (tinyxml2::XMLElement* e = folders->FirstChildElement(QGF_CONFIG_FOLDERS_FOLDER_TAG);
		e != NULL; e = e->NextSiblingElement(QGF_CONFIG_FOLDERS_FOLDER_TAG)) {
			FolderType type = FolderTypeFromString(wxString::FromUTF8(e->Attribute(QGF_CONFIG_FOLDERS_FOLDER_ATT_TYPE_TAG)));
			wxString name = wxString::FromUTF8(e->Attribute(QGF_CONFIG_FOLDERS_FOLDER_ATT_NAME_TAG));
			Folder folder(type, name, name);
			ReadFolderAndSub(&folder, e, name); 
			this->folders.GetFolders()->push_back(folder);
	}
}
bool VProjectItemFolder::Exists() const
{
	if (fOwner == NULL)
		return false;
	
	VFilePath path;
	if (!fOwner->GetFilePath( path))
		return false;

	VFolder folder( path);
	return folder.Exists();
}
Ejemplo n.º 26
0
 teasafe::TeaSafeFolder createTestFolder(boost::filesystem::path const &p, long const blocks)
 {
     teasafe::SharedCoreIO io(createTestIO(p));
     teasafe::TeaSafeFolder folder(io, 0, std::string("root"));
     folder.addTeaSafeFile("test.txt");
     folder.addTeaSafeFile("some.log");
     folder.addTeaSafeFolder("folderA");
     folder.addTeaSafeFile("picture.jpg");
     folder.addTeaSafeFile("vai.mp3");
     folder.addTeaSafeFolder("folderB");
     return folder;
 }
Ejemplo n.º 27
0
wxArrayString FSOExecutable::GetBinariesFromRootFolder(const wxFileName& path, const wxString& globPattern, bool quiet) {
	wxArrayString files;
	wxDir folder(path.GetPath());
	wxString filename;

#if IS_APPLE // Binaries are directories on OSX.
	bool cont = folder.GetFirst(&filename, globPattern, wxDIR_DIRS);
#else
	bool cont = folder.GetFirst(&filename, globPattern, wxDIR_FILES);
#endif

	while (cont) {
#if IS_LINUX
		if ( !IsFileToIgnore(filename) ) {
#endif
		files.Add(filename);
#if IS_LINUX
		}
#endif
		cont = folder.GetNext(&filename);
	}

	// filter out launcher binaries (at least on OSX)
	for (int i = files.GetCount() - 1; i >= 0; --i) {
		if (files[i].Lower().Find(_T("launcher")) != wxNOT_FOUND) {
			files.RemoveAt(i);
		}
	}
	
#if IS_APPLE
	// find actual (Unix) executable inside .app bundle and call the path to it the "executable"
	for (wxArrayString::iterator it = files.begin(), end = files.end(); it != end; ++it) {
		wxString pathToBin = 
			wxDir::FindFirst(path.GetPath(wxPATH_GET_SEPARATOR) + *it + _T("/Contents/MacOS"),
							 _T("*"),
							 wxDIR_FILES);
		pathToBin.Replace(path.GetPath(wxPATH_GET_SEPARATOR), _T(""));
		*it = pathToBin;
	}
#endif
	
	if (!quiet) {
		wxString execType = globPattern.Lower().Find(_T("fred")) == wxNOT_FOUND ? _T("FS2") : _T("FRED2");
		wxLogInfo(_T(" Found %d %s Open executables in '%s'"),
			files.GetCount(), execType.c_str(), path.GetPath().c_str());
		
		for (size_t i = 0, n = files.GetCount(); i < n; ++i) {
			wxLogDebug(_T("Found executable: %s"), files.Item(i).c_str());
		}
	}

	return files;
}
Ejemplo n.º 28
0
int QDeclarativeFolderListModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractListModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 6)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 6;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QUrl*>(_v) = folder(); break;
        case 1: *reinterpret_cast< QUrl*>(_v) = parentFolder(); break;
        case 2: *reinterpret_cast< QStringList*>(_v) = nameFilters(); break;
        case 3: *reinterpret_cast< SortField*>(_v) = sortField(); break;
        case 4: *reinterpret_cast< bool*>(_v) = sortReversed(); break;
        case 5: *reinterpret_cast< bool*>(_v) = showDirs(); break;
        case 6: *reinterpret_cast< bool*>(_v) = showDotAndDotDot(); break;
        case 7: *reinterpret_cast< bool*>(_v) = showOnlyReadable(); break;
        case 8: *reinterpret_cast< int*>(_v) = count(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setFolder(*reinterpret_cast< QUrl*>(_v)); break;
        case 2: setNameFilters(*reinterpret_cast< QStringList*>(_v)); break;
        case 3: setSortField(*reinterpret_cast< SortField*>(_v)); break;
        case 4: setSortReversed(*reinterpret_cast< bool*>(_v)); break;
        case 5: setShowDirs(*reinterpret_cast< bool*>(_v)); break;
        case 6: setShowDotAndDotDot(*reinterpret_cast< bool*>(_v)); break;
        case 7: setShowOnlyReadable(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
/*
 * Class:     com_sun_glass_ui_win_WinCommonDialogs
 * Method:    _showFolderChooser
 * Signature: (JLjava/lang/String;Ljava/lang/String;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_sun_glass_ui_win_WinCommonDialogs__1showFolderChooser
  (JNIEnv *env, jclass cls, jlong owner, jstring jFolder, jstring jTitle)
{
    CommonDialogOwner cdo((HWND)jlong_to_ptr(owner));
    JString folder(env, jFolder);
    JString title(env, jTitle);

    if (IS_WINVISTA) {
        return COMFolderChooser_Show((HWND)jlong_to_ptr(owner), folder, title);
    } else {
        return StandardFolderChooser_Show((HWND)jlong_to_ptr(owner), folder, title);
    }
}
Ejemplo n.º 30
0
void wxFileDialog::GTKOnAccept()
{
    int style = GetWindowStyle();
    wxString filename = m_fc.GetPath();
    m_selectedDirectory = m_fc.GetDirectory();

    // gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
#ifndef __WXGTK3__
#if GTK_CHECK_VERSION(2,7,3)
    if (gtk_check_version(2, 7, 3) != NULL)
#endif
    {
        if ((style & wxFD_SAVE) && (style & wxFD_OVERWRITE_PROMPT))
        {
            if ( g_file_test(filename.utf8_str(), G_FILE_TEST_EXISTS) )
            {
                wxString msg;

                msg.Printf(
                    _("File '%s' already exists, do you really want to overwrite it?"),
                    wxString::FromUTF8(filename.utf8_str()));

                wxMessageDialog dlg(this, msg, _("Confirm"),
                                   wxYES_NO | wxICON_QUESTION);
                if (dlg.ShowModal() != wxID_YES)
                    return;
            }
        }
    }
#endif

    if (style & wxFD_FILE_MUST_EXIST)
    {
        if ( !g_file_test(filename.utf8_str(), G_FILE_TEST_EXISTS) )
        {
            wxMessageDialog dlg( this, _("Please choose an existing file."),
                                 _("Error"), wxOK| wxICON_ERROR);
            dlg.ShowModal();
            return;
        }
    }

    // change to the directory where the user went if asked
    if (style & wxFD_CHANGE_DIR)
    {
        // Use chdir to not care about filename encodings
        wxGtkString folder(g_path_get_dirname(filename.utf8_str()));
        chdir(folder);
    }
    EndDialog(wxID_OK);
}