Exemplo n.º 1
0
//---------------------------------------------------------------------------
//  deployInstance
//---------------------------------------------------------------------------
void CConfigGenEngine::deployInstance(IPropertyTree& instanceNode, bool useTempDir)
{
    StringAttr hostDir(m_outDir);
    StringAttr destDir(useTempDir ? getDeployDir(instanceNode).str() : hostDir.get());
    
    const char* pszHostDir = hostDir.get();
    if (pszHostDir && *pszHostDir==PATHSEPCHAR && *(pszHostDir+1)==PATHSEPCHAR)
        connectToHost(instanceNode);
    beforeDeployInstance(instanceNode, destDir);
    copyInstallFiles(instanceNode, destDir);
    afterDeployInstance(instanceNode, destDir);
    
    if (!m_compare && useTempDir)
    {
        checkAbort();
        EnvMachineOS os= m_envDepEngine.lookupMachineOS(instanceNode);
        renameDir(hostDir, NULL, os);
        renameDir(destDir, hostDir, os);
    }
}
Exemplo n.º 2
0
// -----------------------------------------------------------------------------
// Renames [entry] with [name].
// Returns false if the entry was invalid, true otherwise
// -----------------------------------------------------------------------------
bool Archive::renameEntry(ArchiveEntry* entry, string_view name)
{
	// Abort if read only
	if (read_only_)
		return false;

	// Check entry
	if (!checkEntry(entry))
		return false;

	// Check if entry is locked
	if (entry->isLocked())
		return false;

	// Check for directory
	if (entry->type() == EntryType::folderType())
		return renameDir(dir(entry->path(true)), name);

	// Announce (before actually renaming in case old name is still needed)
	MemChunk  mc;
	int       index = entryIndex(entry);
	wxUIntPtr ptr   = wxPtrToUInt(entry);
	mc.write(&index, sizeof(int));
	mc.write(&ptr, sizeof(wxUIntPtr));
	announce("entry_renaming", mc);

	// Create undo step
	if (UndoRedo::currentlyRecording())
		UndoRedo::currentManager()->recordUndoStep(std::make_unique<EntryRenameUS>(entry, name));

	// Rename the entry
	entry->setName(name);
	entry->formatName(formatDesc());
	entry->setState(ArchiveEntry::State::Modified, true);

	// Announce modification
	entryStateChanged(entry);

	return true;
}
Exemplo n.º 3
0
Desktopwidget::Desktopwidget (QWidget *parent)
      : QSplitter (parent)
   {
   _model = new Dirmodel ();
//    _model->setLazyChildCount (true);
   _dir = new Dirview (this);
   _dir->setModel (_model);

   _contents = new Desktopmodel (this);

   QWidget *group = createToolbar();

   _view = new Desktopview (group);
   QVBoxLayout *lay = new QVBoxLayout (group);
   lay->setContentsMargins (0, 0, 0, 0);
   lay->setSpacing (2);
   lay->addWidget (_toolbar);
   lay->addWidget (_view);

   connect (_view, SIGNAL (itemPreview (const QModelIndex &, int, bool)),
         this, SLOT (slotItemPreview (const QModelIndex &, int, bool)));

#ifdef USE_PROXY
   _proxy = new Desktopproxy (this);
   _proxy->setSourceModel (_contents);
   _view->setModel (_proxy);
//    printf ("contents=%p, proxy=%p\n", _contents, _proxy);

   // set up the model converter
   _modelconv = new Desktopmodelconv (_contents, _proxy);

   // setup another one for Desktopmodel, which only allows assertions
   _modelconv_assert = new Desktopmodelconv (_contents, _proxy, false);
#else
   _proxy = 0;
   _view->setModel (_contents);
   _modelconv = new Desktopmodelconv (_contents);

   // setup another one for Desktopmodel, which only allows assertions
   _modelconv_assert = new Desktopmodelconv (_contents, false);
#endif

   _view->setModelConv (_modelconv);

   _contents->setModelConv (_modelconv_assert);

   _delegate = new Desktopdelegate (_modelconv, this);
   _view->setItemDelegate (_delegate);
   connect (_delegate, SIGNAL (itemClicked (const QModelIndex &, int)),
         this, SLOT (slotItemClicked (const QModelIndex &, int)));
   connect (_delegate, SIGNAL (itemPreview (const QModelIndex &, int, bool)),
         this, SLOT (slotItemPreview (const QModelIndex &, int, bool)));
   connect (_delegate, SIGNAL (itemDoubleClicked (const QModelIndex &)),
      this, SLOT (openStack (const QModelIndex &)));

   connect (_contents, SIGNAL (undoChanged ()),
      this, SIGNAL (undoChanged ()));
   connect (_contents, SIGNAL (dirChanged (QString&, QModelIndex&)),
      this, SLOT (slotDirChanged (QString&, QModelIndex&)));
   connect (_contents, SIGNAL (beginningScan (const QModelIndex &)),
      this, SLOT (slotBeginningScan (const QModelIndex &)));
   connect (_contents, SIGNAL (endingScan (bool)),
      this, SLOT (slotEndingScan (bool)));
   connect (_contents, SIGNAL(updateRepositoryList (QString &, bool)),
            this, SLOT(slotUpdateRepositoryList (QString &, bool)));

    // position the items when the model is reset, otherwise things
    // move and look ugly for a while
    connect (_contents, SIGNAL (modelReset ()), _view, SLOT (setPositions ()));

   createPage();

   // and when there are no selected items
   connect (_view, SIGNAL (pageLost()), _page, SLOT (slotReset ()));

   _parent = parent;
   _pendingMatch = QString::null;
   _updating = false;

   // setup the preview timer
   _timer = new QTimer ();
   _timer->setSingleShot (true);
   connect (_timer, SIGNAL(timeout()), this, SLOT(updatePreview()));

   connect (_dir, SIGNAL (clicked (const QModelIndex&)),
            this, SLOT (dirSelected (const QModelIndex&)));
   connect (_dir, SIGNAL (activated (const QModelIndex&)),
            this, SLOT (dirSelected (const QModelIndex&)));
   connect (_model, SIGNAL(droppedOnFolder(const QMimeData *, QString &)),
            this, SLOT(slotDroppedOnFolder(const QMimeData *, QString &)));

   /* notice when the current directory is fully displayed so we can handle
      any pending action */
   connect (_contents, SIGNAL (updateDone()), this, SLOT (slotUpdateDone()));

   // connect signals from the directory tree
   connect (_dir->_new, SIGNAL (triggered ()), this, SLOT (newDir ()));
   connect (_dir->_rename, SIGNAL (triggered ()), this, SLOT (renameDir ()));
   connect (_dir->_delete, SIGNAL (triggered ()), this, SLOT (deleteDir ()));
   connect (_dir->_refresh, SIGNAL (triggered ()), this, SLOT (refreshDir ()));
   connect (_dir->_add_recent, SIGNAL (triggered ()), this,
            SLOT (addToRecent ()));
   connect (_dir->_add_repository, SIGNAL (triggered ()), this,
            SLOT (slotAddRepository ()));
   connect (_dir->_remove_repository, SIGNAL (triggered ()), this,
            SLOT (slotRemoveRepository ()));

   setStretchFactor(indexOf(_dir), 0);

   QList<int> size;

   if (!getSettingsSizes ("desktopwidget/", size))
      {
      size.append (200);
      size.append (1000);
      size.append (400);
      }
   setSizes (size);

   connect (_view, SIGNAL (popupMenu (QModelIndex &)),
         this, SLOT (slotPopupMenu (QModelIndex &)));

   // allow top level to see our view messages
   connect (_view, SIGNAL (newContents (QString)), this, SIGNAL (newContents (QString)));

   addActions();

   /* unfortunately when we first run maxview it starts with the main window
      un-maximised. This means that scrollToLast() doesn't quite scroll far
      enough for the maximised view which appears soon afterwards. As a hack
      for the moment, we do another scroll 1 second after starting up */
   QTimer::singleShot(1000, _view, SLOT (scrollToLast()));
   }