Пример #1
0
void QuizFrame::setTerm( const Term& term ) {
    Translation firstLangTranslation = term.getTranslation( controller->getQuizFirstLanguage() );
    Translation testLangTranslation = term.getTranslation( controller->getQuizTestLanguage() );

    const QString firstLangWord = firstLangTranslation.getWord();
    const QString testLangAlt = testLangTranslation.getAlt();
    const QString testLangWord = testLangTranslation.getWord();

    QString comment;
    BilingualKey commentKey( controller->getQuizFirstLanguage(), controller->getQuizTestLanguage() );
    if( term.isCommentExists( commentKey ) )
        comment = term.getComment( commentKey );

    firstLangTermLineEdit->setText( firstLangWord );
    firstLangTermLineEdit->setCursorPosition( 0 );

    testLangTermAltLineEdit->setText( testLangAlt );
    testLangTermAltLineEdit->setCursorPosition( 0 );

    testLangTermLineEdit->setText( testLangWord );
    testLangTermLineEdit->setCursorPosition( 0 );

    commentMultiLineEdit->setText( comment );

    Folder* vocabTree = controller->getVocabTree();
    Vocabulary* vocab = vocabTree->getVocabulary( term.getVocabId() );
    if( vocab ) {
        QString absPath = controller->getResolvedImagePath( term.getImagePath(), *vocab );
        setImage( absPath ); 
    }
}
Пример #2
0
Folder* Folder::fromOPML(const QDomElement& e)
{
    Folder* fg = new Folder(e.hasAttribute(QString::fromLatin1("text")) ? e.attribute(QString::fromLatin1("text")) : e.attribute(QString::fromLatin1("title")));
    fg->setOpen( e.attribute(QString::fromLatin1("isOpen")) == QString::fromLatin1(("true")));
    fg->setId( e.attribute(QString::fromLatin1("id")).toUInt() );
    return fg;
}
Пример #3
0
string virusTest()
{
	vector<File*> fls;
	Folder * f = new Folder("test");
	
	File * file = new File();
	
	Virus * v = new Virus();
	v->type = Virus::CREATING;
	v->nextHarm = 0;
	file->setVirus(v);
	
	f->addFile(file);
	
	f->getAllFilesRecursively(fls);
	if(fls.size() != 1) return "file count mismatch 1";
	
	v->update(f);
	
	fls.clear();
	f->getAllFilesRecursively(fls);
	if(fls.size() != 2) return "file count mismatch 2";
	
	v->type = Virus::ERASING;
	v->nextHarm = 0;
	v->update(f);
	
	fls.clear();
	f->getAllFilesRecursively(fls);
	if(fls.size() != 2) return "file count mismatch 3";
	
	delete f;
	
	return "";
}
Пример #4
0
QPtrList<File>* Engine::files(FilterNode* filterRootNode)
{
    tracer->sinvoked(__func__) << "with filter:" << endl;
    if (filterRootNode) {
        filterRootNode->dump("");
    }

    // remove all files currently shown
    m_fileList2display->clear();

    // loop over all source directories
    QIntDictIterator<Folder> sourceDirIt(*m_sourceDirDict);
    for ( ; sourceDirIt.current(); ++sourceDirIt ) {
        Folder* sourceDir = sourceDirIt.current();

        // handle the files in this directory only if it is selected
        if (sourceDir->include()) {

            // loop over all files in the current sourcedirectory
            QPtrList<File>* fileList = sourceDir->files();
            for (File* file = fileList->first(); file; file = fileList->next()) {

                // append the file if it matches the filter
                if (filterRootNode->evaluate(file)) {
                    m_fileList2display->append(file);
                }
            }
        }
    }

    return m_fileList2display;
}
Пример #5
0
Folder* LocalFolder::newChildFolder(string Name) {

	//If the name is invalid return 0
	if (Name.empty())
		return 0;

	//If it already exists bottle out return 0
	if (searchForChild(Name) != 0)
		return 0;

	Folder* returnFolder = 0;

	//Generate the file path
	string fullPath = m_localFolderPath + Name + "/";

	if (mkdir(fullPath.c_str(), 0) == 0) {

		returnFolder = new LocalFolder(Name, fullPath);
		returnFolder->refresh();

		m_entryList.push_back(returnFolder);
	}

	return returnFolder;
}
Пример #6
0
bool ImportOPJ::createProjectTree(const OPJFile &opj) {
  const tree<projectNode> *projectTree = opj.project();
  tree<projectNode>::iterator root = projectTree->begin(projectTree->begin());
  if (!root.node)
    return false;
  FolderListItem *item =
      static_cast<FolderListItem *>(mw->folders->firstChild());
  item->setText(0, root->name.c_str());
  item->folder()->setObjectName(root->name.c_str());
  Folder *projectFolder = mw->projectFolder();
  QHash<tree<projectNode>::iterator, Folder *> parent;
  parent[root] = projectFolder;
  for (tree<projectNode>::iterator sib = projectTree->begin(root);
       sib != projectTree->end(root); ++sib) {
    if (sib->type == 1) {
      parent[sib] = mw->addFolder(sib->name.c_str(),
                                  parent.value(projectTree->parent(sib)));
      parent[sib]->setBirthDate(JulianDateTime2String(sib->creation_date));
      parent[sib]->setModificationDate(
          JulianDateTime2String(sib->modification_date));
    } else {
      MdiSubWindow *w = projectFolder->window(sib->name.c_str());
      if (w) {
        parent.value(projectTree->parent(sib))->addWindow(w);
        projectFolder->removeWindow(w);
      }
    }
  }
  mw->changeFolder(projectFolder, true);
  return true;
}
Пример #7
0
void add_Folder(Folder &F) {
    F.set_Full_Folder_Name( folder_root + "/" + F.get_Folder_Name() );
    cout << "Folder_name= " << F.get_Folder_Name() << endl;				// DEBUG
    cout << "fullFolder_name= " << F.get_Folder_Name() << endl;			// DEBUG
    folder_list.push_back( F );    
    return;
}
Пример #8
0
TEST(D_FileSystemTest, Folders_Create_1)
{
	ASSERT_TRUE(DatabasePrepare());

	FoldersNames_vt foldsNames;
	const unsigned char foldsInPack = 3;
	CreateFoldNames(foldsInPack, foldsNames);
	ASSERT_FALSE(foldsNames.empty());

	FolderGuard root = cont->GetRoot();
	ElementGuard ce;

	Folders_vt folds;
	for (int i = 0; i < foldsInPack; ++i)
	{
		EXPECT_NO_THROW(root->CreateChild(foldsNames[i], ElementTypeFolder));
		EXPECT_NO_THROW(ce = root->GetChild(foldsNames[i]));
		EXPECT_EQ(foldsNames[i], ce->Name());
		EXPECT_EQ(ElementTypeFolder, ce->Type());
		Folder* cf = ce->AsFolder();
		ASSERT_NE(cf, nullptr);
		folds.push_back(cf->AsFolder()->Clone());
	}
	for (int i = 0; i < foldsInPack; ++i)
	{
		EXPECT_THROW(root->CreateChild(foldsNames[i], ElementTypeFolder), ContainerException);
		EXPECT_THROW(root->CreateChild(foldsNames[i], ElementTypeFile), ContainerException);
		EXPECT_TRUE(folds[i]->Exists());
	}
}
Пример #9
0
TEST(D_FileSystemTest, Folders_Create_3)
{
	ASSERT_TRUE(DatabasePrepare());

	FoldersNames_vt foldsNames;
	const unsigned char foldsInPack = 5;
	CreateFoldNames(foldsInPack, foldsNames);
	ASSERT_FALSE(foldsNames.empty());
	FolderGuard root;
	ASSERT_NO_THROW(root = cont->GetRoot());

	for (int i = 1; i < foldsInPack; ++i)
	{
		FolderGuard new_root;
		ASSERT_NO_THROW(new_root = root->CreateFolder(foldsNames[i]));

		for (int j = 0; j < foldsInPack; ++j)
		{
			ElementGuard ce;
			EXPECT_NO_THROW(new_root->CreateChild(foldsNames[j], ElementTypeFolder));
			EXPECT_NO_THROW(ce = new_root->GetChild(foldsNames[j]));
			EXPECT_EQ(foldsNames[j], ce->Name());
			EXPECT_EQ(ElementTypeFolder, ce->Type());
			Folder* cf = ce->AsFolder();
			ASSERT_NE(cf, nullptr);

			EXPECT_THROW(new_root->CreateChild(foldsNames[j], ElementTypeFolder), ContainerException);
			EXPECT_THROW(new_root->CreateChild(foldsNames[j], ElementTypeFile), ContainerException);
			std::string compared_path(utils::SlashedPath(new_root->Path()) + foldsNames[j]);
			EXPECT_EQ(compared_path, cf->Path());
		}
	}
}
Пример #10
0
void QuizFrame::editCurrentTerm() {
    if( controller->isQuizInProgress() ) {
        Folder* vocabTree = controller->getVocabTree();
        Term* term = controller->getCurrentTerm();
        if( !term ) {
            QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
            return;
        }

        Vocabulary* vocab = vocabTree->getVocabulary( term->getVocabId() );
        if( vocab == NULL || !vocab->isTermExists( term->getId() ) ) {
            QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
            return;
        }

        TermDialog dialog( *vocab, controller, this, *term );
        int result = dialog.exec();
        if( result ) { 
            QString firstLang( controller->getQuizFirstLanguage() );
            QString testLang( controller->getQuizTestLanguage() );
            Term newTerm = dialog.getTerm();
            Translation firstLangTrans = newTerm.getTranslation( firstLang );
            Translation testLangTrans = newTerm.getTranslation( testLang );
            term->addTranslation( firstLangTrans );
            term->addTranslation( testLangTrans );
            BilingualKey commentKey( firstLang, testLang );
            term->addComment( commentKey, newTerm.getComment( commentKey ) );
            term->setImagePath( newTerm.getImagePath() );
            vocab->setModificationDate( QDateTime::currentDateTime() );
            vocab->setDirty( true );
            setTerm( newTerm );
        }
    }
}
void FolderItemPropertiesWidget::sl_ChooseIconButton_Clicked() {
	if (!itemToEdit) {
		WARNING("Null pointer recieved");
		reject();
	}

	if (!customIconsWidget) {
		customIconsWidget = new CustomIconsListWidget(this);
	}

	if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Folder) {
		Folder* f = dynamic_cast<Folder*>(itemToEdit);
		customIconsWidget->SelectIcon(f->GetIconID());
	} else if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Note) {
		Note* n = dynamic_cast<Note*>(itemToEdit);
		customIconsWidget->SelectIcon(n->GetIconID());
	}

	if (customIconsWidget->exec() != QDialog::Accepted) {return;}

	Document* doc = Application::I()->CurrentDocument();
	if (doc == 0) {
		WARNING("Current document is 0");
		return;
	}

	selectedIconKey = customIconsWidget->SelectedIconKey;
	iconLabel->setPixmap(doc->GetItemIcon(selectedIconKey));
}
void swap(Folder &lhs, Folder &rhs) {
	using std::swap;
	lhs.remove_Message();
	rhs.remove_Message();
	swap(lhs.messages, rhs.messages);
	lhs.add_Message(lhs);
	rhs.add_Message(rhs);
}
Пример #13
0
int main( int argc, char * argv[] )
{
   Process process;
   Session session;
   Folder * folder;
   string name = "/cpp_folder_create";
   string subname = "test";

   try {
      if ( argc > 1 ) {
         process.Init( argv[1], argv[0] );
      }
      else {
         process.Init( "10701", argv[0] );
      }
   }
   catch( pso::Exception exc ) {
      cerr << "Test failed in init phase, error = " << exc.Message() << endl;
      cerr << "Is the server running?" << endl;
      return 1;
   }

   try {
      session.Init();
      session.CreateFolder( name );
      folder = new Folder( session, name );
   }
   catch( pso::Exception exc ) {
      cerr << "Test failed in init phase, error = " << exc.Message() << endl;
      cerr << "Is the server running?" << endl;
      return 1;
   }
   
   // Invalid arguments to tested function.

   try {
      folder->CreateFolder( "" );
      cerr << "Test failed - line " << __LINE__ << endl;
      return 1;
   }
   catch( pso::Exception exc ) {
      if ( exc.ErrorCode() != PSO_INVALID_LENGTH ) {
         cerr << "Test failed - line " << __LINE__ << ", error = " << exc.Message() << endl;
         return 1;
      }
   }
   
   // End of invalid args. This call should succeed.
   try {
      folder->CreateFolder( subname );
   }
   catch( pso::Exception exc ) {
      cerr << "Test failed - line " << __LINE__ << ", error = " << exc.Message() << endl;
      return 1;
   }

   return 0;
}
Пример #14
0
void LocalFolder::refresh() {
#warning May not be compatable with Windows 32
	emptyList();

	DIR* dir = opendir(m_localFolderPath.c_str());
	struct dirent* nextEntry;

	if (dir != 0) {

		while (true) {

			nextEntry = readdir(dir);

			if (nextEntry != 0) {
				//Check it isn't the current or parent indicators
				if (strcmp(nextEntry->d_name, ".") == 0) {
					//Do nothing for this dir
				} else if (strcmp(nextEntry->d_name, "..") == 0) {
					//Do nothing for the dir the level above
				} else {
					//if its not process it

					if (nextEntry->d_type == DT_DIR) {

						//Directory
						string fullPath = m_localFolderPath + nextEntry->d_name
								+ "/";

						Folder* subFolder = new LocalFolder(nextEntry->d_name,
								fullPath);

						subFolder->refresh();

						m_entryList.push_back(subFolder);

					} else {

						//File
						string fullPath = m_localFolderPath + nextEntry->d_name;

						m_entryList.push_back(new LocalFile(fullPath));
					}

				}

			} else {

				break;

			}

		}

		closedir(dir);
		dir = 0;
	}

}
Пример #15
0
	extern "C" uint64_t Syscall_CheckFolderExistence(const char* path)
	{
		using namespace Kernel::HardwareAbstraction::Filesystems::VFS;
		Folder* f = new Folder(path);
		bool ret = f->Exists();
		delete f;

		return ret;
	}
Пример #16
0
void OwncloudSetupWizard::startWizard()
{
    FolderMan *folderMan = FolderMan::instance();
    bool multiFolderSetup = folderMan->map().count() > 1;
    // ###
    Account *account = Account::restore();
    if (!account) {
        _ocWizard->setConfigExists(false);
        account = new Account;
        account->setCredentials(CredentialsFactory::create("dummy"));
    } else {
        _ocWizard->setConfigExists(true);
    }
    account->setSslErrorHandler(new SslDialogErrorHandler);
    _ocWizard->setAccount(account);
    _ocWizard->setOCUrl(account->url().toString());

    _remoteFolder = Theme::instance()->defaultServerFolder();
    // remoteFolder may be empty, which means /
    QString localFolder = Theme::instance()->defaultClientFolder();

    // if its a relative path, prepend with users home dir, otherwise use as absolute path

    if( !QDir(localFolder).isAbsolute() ) {
        localFolder = QDir::homePath() + QDir::separator() + localFolder;
    }

    if (!multiFolderSetup) {
        QList<Folder*> folders = folderMan->map().values();
        if (!folders.isEmpty()) {
            Folder* folder = folders.first();
            localFolder = QDir(folder->path()).absolutePath();
        }
    }

    _ocWizard->setProperty("localFolder", localFolder);

    // remember the local folder to compare later if it changed, but clean first
    QString lf = QDir::fromNativeSeparators(localFolder);
    if( !lf.endsWith(QLatin1Char('/'))) {
        lf.append(QLatin1Char('/'));
    }

    _initLocalFolder = lf;

    _ocWizard->setRemoteFolder(_remoteFolder);

    _ocWizard->setStartId(WizardCommon::Page_ServerSetup);

    _ocWizard->restart();

    // settings re-initialized in initPage must be set here after restart
    _ocWizard->setMultipleFoldersExist( multiFolderSetup );

    _ocWizard->open();
    _ocWizard->raise();
}
Пример #17
0
void swap(Folder& lhs, Folder& rhs)
{
    using std::swap;
    lhs.rem_from_Messages();
    rhs.rem_from_Messages();
    swap(lhs.messages, rhs.messages);
    lhs.add_to_Messages(lhs);
    rhs.add_to_Messages(rhs);
}
Пример #18
0
QString Folder::path() {
  QString folderPath = "/" + QString(name()) + "/";
  Folder *parentFolder = static_cast<Folder *>(parent());
  while (parentFolder) {
    folderPath.prepend("/" + QString(parentFolder->name()));
    parentFolder = static_cast<Folder *>(parentFolder->parent());
  }
  return folderPath;
}
Пример #19
0
int Folder::depth()
{
	int d = 0;
    Folder *parentFolder = (Folder *)parent();
    while (parentFolder){
        ++d;
        parentFolder = (Folder *)parentFolder->parent();
	}
    return d;
}
Пример #20
0
QString Folder::path()
{
    QString s = "/" + QString(objectName()) + "/";
    Folder *parentFolder = (Folder *)parent();
    while (parentFolder){
        s.prepend("/" + QString(parentFolder->objectName()));
        parentFolder = (Folder *)parentFolder->parent();
	}
    return s;
}
Пример #21
0
AbstractXmlItemObject * FoldersModel::newItem()
{
    Folder *newItem = new Folder(this);
    connect(newItem, SIGNAL(idChanged()), this, SLOT(itemDataChanged()));
    connect(newItem, SIGNAL(additionalDataChanged()), this, SLOT(itemDataChanged()));

    connect(newItem, SIGNAL(nameChanged()), this, SLOT(itemDataChanged()));
    newItem->filesModel()->setItemAdditionalData(m_fileAdditionalData);
    return newItem;
}
Пример #22
0
Gobby::TitleBar::TitleBar(Gtk::Window& window, const Folder& folder):
	m_window(window), m_folder(folder), m_current_view(NULL)
{
	folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &TitleBar::on_document_removed));
	folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &TitleBar::on_document_changed));

	on_document_changed(folder.get_current_document());
}
Пример #23
0
void swap(Folder&lhs, Folder&rhs)
{
	using std::swap;
	lhs.remove_from_Message();
	rhs.remove_from_Message();

	swap(lhs.msgs, rhs.msgs);

	lhs.add_to_Message(lhs);
	rhs.add_to_Message(rhs);
}
Пример #24
0
QString Folder::path()
{
QString s = "/" + fName + "/";
Folder *parentFolder = (Folder *)parent();
while (parentFolder)
	{
	s.prepend("/"+parentFolder->folderName());
	parentFolder = (Folder *)parentFolder->parent();
	}
return s;
}
Пример #25
0
void LibSpotifyPlaybackHandler::playFolder(const Folder& folder)
{
    mtx_.lock();
    playQueue_.clear();
    currentlyPlayingFromName_ = folder.getName();
    currentlyPlayingFromUri_ = ""; //Unknown so far as how to get the folder link..
    currentlyPlayingFromType_ = FOLDER;
    folder.getAllTracks(playQueue_);
    playQueueIter_ = playQueue_.begin();
    if(enquedQueue_.empty())libSpotifyIf_.playTrack(playQueue_.front());
    mtx_.unlock();
}
Пример #26
0
int main()
{
	Message m1("hello world");	
	Folder f ;
	m1.save(f);
	Message m2 = m1 ;
	cout << f.NumofObjects() << endl; 
	m1.remove(f);
	cout << f.NumofObjects() << endl; 
	m2.remove(f);
	return 0;
}	
Пример #27
0
void Synchro::FirstSynchro()
{
	GetJSON();
	std::map<int, Folder *> FolderMap = myparse.getFoldermap();
	typedef std::map<int, Folder *>::iterator it_type2;
	for (it_type2 iterator = FolderMap.begin(); iterator != FolderMap.end(); iterator++) {
		Folder *fold = iterator->second;
		std::string str = this->folder + fold->getChosenPath() + "/" + fold->getName();
		char *cstr = new char[str.length() + 1];
		strcpy(cstr, str.c_str());
		if (QDir(cstr).exists() == true)
			return;
		else
			QDir().mkdir(cstr);
		delete[] cstr;
	}

	std::map<int, File *> fileMap = myparse.getFileMap();
	std::string StrignUpload = "uploads/";
	typedef std::map<int, File *>::iterator it_type;
	for (it_type iterator = fileMap.begin(); iterator != fileMap.end(); iterator++) {
		File *test = iterator->second;
		std::string urltodown = this->URL + StrignUpload + test->getPseudoOwner() + "/" + test->getRealPath() + test->getPath();
		while (urltodown.find('\\') != std::string::npos)
			replace(urltodown, "\\", "/");
		char *cstr1 = new char[urltodown.length() + 1];
		strcpy(cstr1, urltodown.c_str());

		std::string str = test->getName() + "." + test->getMimeType();
		char *cstr = new char[str.length() + 1];
		strcpy(cstr, str.c_str());

		str = this->folder + test->getChosenPath() + "/";
		char *pathDisk = new char[str.length() + 1];
		strcpy(pathDisk, str.c_str());

		std::string ty = pathDisk + str;
		QString URI(ty.c_str());
		DownloadFile(cstr1, URI);

		delete[] cstr;
		delete[] cstr1;
	}

	char acsjson[1024];
	strcpy(acsjson, this->folder);
	strcat(acsjson, ".acsilserver");
	QFile txt(acsjson);

	txt.open(QIODevice::ReadWrite | QIODevice::Text);
	txt.write(myparse.getJSON().c_str());
	txt.close();
}
Пример #28
0
WebNode* Folder::GetPage(const string& pageName) const
{
	const size_t slashInd = pageName.find_first_of('/', 1);
	
	if(slashInd != string::npos)
	{
		const size_t endInd = pageName.length() - slashInd;
		string localName = string(pageName, 1, slashInd - 1);
		const string remainingName = string(pageName, slashInd, endInd);
		Util::to_upper(localName);
		auto potentialPage =  this->pages.find(localName);
		if(potentialPage != this->pages.end())
		{
			switch (potentialPage->second->GetNodeType())
			{
			case FOLDER:
				Folder* nextFolder = static_cast<Folder*>(potentialPage->second);
				WebNode* nextNode = nextFolder->GetPage(remainingName);
				return nextNode;
				break;
			}
		}
		
		//log.error(pageName + " not found in directory " + this->fullPath);
	}
	else
	{
		if(pageName[0] != '/')
		{
			string pageN = pageName;
			Util::to_upper(pageN);
			auto potentialPage =  this->pages.find(pageN);
			if(potentialPage != this->pages.end())
			{
				return potentialPage->second;
			}
		}
		else
		{
			string pageN(pageName, 1, pageName.length() - 1);
			Util::to_upper(pageN);
			auto potentialPage =  this->pages.find(pageN);
			if(potentialPage != this->pages.end())
			{
				return potentialPage->second;
			}
		}

		log.error(pageName + " not found in directory " + this->fullPath);
	}
	
	return nullptr;
}
void ImageImporter::initData() {
    const KMountPoint::List lst = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions);
    for ( KMountPoint::List::ConstIterator it = lst.begin() ; it != lst.end() ; ++it ) {
        //so, I only show devices that are mountable by a user
        if (getuid() == 0 || (*it)->mountOptions().grep("user").size() > 0) {
            QString x = QString("%1 (%2)").arg((*it)->mountedFrom()).arg((*it)->mountPoint());
            m_cmbSourceDevice->insertItem(x);
        }
    }
    //after adding all available mountpoints, check the status of the current
    slotUpdateMountStatus();

    m_cmbSourceFolder->insertItem(Settings::imageImporterSourceFolder());
    m_cmbSourceFolder->setCurrentText(Settings::imageImporterSourceFolder());
    m_cmbSourceDevice->setCurrentText(Settings::imageImporterSourceDevice());
    m_txtSourceFilename->setText(Settings::imageImporterSourceFilenameRegexp());
    m_chkIgnoreCase->setChecked(Settings::imageImporterFilenameIgnoreCase());
    m_chkSrcIncludeSubfolders->setChecked(Settings::imageImporterSourceIncludeSubfolders());
    m_chkSrcRemoveFilesFromSrc->setChecked(Settings::imageImporterSourceRemoveAfterTransfer());

    m_groupArchive->setChecked(Settings::imageImporterArchiveImages());
    m_txtArchiveBaseFolder->setText(Settings::imageImporterArchiveBaseFolder());
    m_txtArchiveSubfolders->setText(Settings::imageImporterArchiveSubfolders());
    m_txtArchiveFilename->setText(Settings::imageImporterArchiveFilename());
    m_chkArchiveLowercase->setChecked(Settings::imageImporterArchiveLowercaseFilenames());

    //add all dirs from the album to the list of target folders
    Folder* sourceDir;
    for (
          sourceDir = m_photobook->engine()->sourceDirs()->first();
          sourceDir;
          sourceDir = m_photobook->engine()->sourceDirs()->next()
        )
    {
        m_cmbDestBasefolder->insertItem(sourceDir->dir()->absPath());
    }

	if (m_cmbDestBasefolder->count() == 0) {
		QMessageBox::information( this, "No Folders Available",
                                  "There are no Folders in your album!<br>"
                                  "Either create a new album and add Folders to "
                                  "it, or open another available album." );
		
	}
    //m_cmbDestBasefolder->insertItem(Settings::imageImporterDestBaseFolder());
	
    m_cmbDestBasefolder->setCurrentText(Settings::imageImporterDestBaseFolder());
    m_txtDestSubfolders->setText(Settings::imageImporterDestSubfolders());
    m_txtDestFilename->setText(Settings::imageImporterDestFilenames());
    m_chkDestLowercase->setChecked(Settings::imageImporterDestLowercaseFilenames());

}
Пример #30
0
bool Folder::readChildAspectElement(XmlStreamReader * reader)
{
	bool loaded = false;
	Q_ASSERT(reader->isStartElement() && reader->name() == "child_aspect");

	if (!reader->skipToNextTag()) return false;
	if (reader->isEndElement() && reader->name() == "child_aspect") return true; // empty element tag
	QString element_name = reader->name().toString();
	if (element_name == "folder")
	{
		Folder * folder = new Folder(tr("Folder %1").arg(1));
		if (!folder->load(reader))
		{
			delete folder;
			return false;
		}
		addChild(folder);
		loaded = true;
	}
	else if (element_name == "column")
	{
		Column * column = new Column(tr("Column %1").arg(1), SciDAVis::Text);
		if (!column->load(reader))
		{
			delete column;
			return false;
		}
		addChild(column);
		loaded = true;
	}
	else
	{
		foreach(QObject * plugin, QPluginLoader::staticInstances()) 
		{
			XmlElementAspectMaker * maker = qobject_cast<XmlElementAspectMaker *>(plugin);
			if (maker && maker->canCreate(element_name))
			{
				AbstractAspect * aspect = maker->createAspectFromXml(reader);
				if (aspect)
				{
					addChild(aspect);
					loaded = true;
					break;
				}
				else
				{
					reader->raiseError(tr("creation of aspect from element '%1' failed").arg(element_name));
					return false;
				}
			}
		}
	}