Ejemplo n.º 1
0
void ofPg::setup(){
	while(!checkConfigExists()){
		askOFRoot();
	}
	setOFRoot(getOFRootFromConfig());

	addons.open(ofFilePath::join(getOFRoot(),"addons"));
	addons.listDir();
	
	addProject(new CBLinuxProject());
	addProject(new CBWinProject());
	addProject(new visualStudioProject());
	addProject(new xcodeProject());
	addProject(new CodeLiteLinuxProject());
}
Ejemplo n.º 2
0
int Server::reloadProjects()
{
    MutexLocker lock(&mMutex);
    mProjects.clear(); // ### could keep the ones that persist somehow
    List<Path> projects = mOptions.dataDir.files(Path::File);
    const Path home = Path::home();
    for (int i=0; i<projects.size(); ++i) {
        Path file = projects.at(i);
        Path p = file.mid(mOptions.dataDir.size());
        RTags::decodePath(p);
        if (p.isDir()) {
            bool remove = false;
            if (FILE *f = fopen(file.constData(), "r")) {
                Deserializer in(f);
                int version;
                in >> version;

                if (version == Server::DatabaseVersion) {
                    int fs;
                    in >> fs;
                    if (fs != Rct::fileSize(f)) {
                        error("%s seems to be corrupted, refusing to restore. Removing.",
                              file.constData());
                        remove = true;
                    } else {
                        addProject(p);
                    }
                } else {
Ejemplo n.º 3
0
TEST(OOInteraction, SimpleTest)
{
	Model::Model* model = new Model::Model();

	Project* pr = nullptr;
	pr = addProject(model);

	Class* cl = nullptr;
	cl = addClass(model, pr);

	Method* divbysix = nullptr;
	divbysix = addDivBySix(model, cl);

	Model::Node* top_level = nullptr;
	if (pr) top_level = pr;
	else if (cl) top_level = cl;
	else top_level = divbysix;

	Scene* scene = new Scene();
	scene->addTopLevelItem( scene->defaultRenderer()->render(nullptr, top_level) );
	scene->scheduleUpdate();
	scene->listenToModel(model);

	// Create view
	MainView* view = new MainView(scene);

	CHECK_CONDITION(view != nullptr);
}
Ejemplo n.º 4
0
void ContributoriesWidget::add(ContributoriesList& list)
{
    for(Project* p : list.getProjects()) {
        addProject(new QPair<Project*, Rate>(p, list.getRate(p)));
        for(Contributory c :list.getContributories(p)) {
            _modelsContributories.last()->append(c);
        }
    }
    emit contributoryChanged();
}
Ejemplo n.º 5
0
/**
  Load active project from .sm file in project base directory
  projectPath - path to project file
  */
bool InfoManager::loadProject(QString projectPath)
{
    QFile file(projectPath);

    if(!file.open(QIODevice::ReadOnly))
        return false;

    QDataStream in(&file);

    in.setVersion(QDataStream::Qt_4_8);

    quint32 magicN;

    in >> magicN;

    if(magicN != magicNumber)
    {
        file.close();
        return false;
    }

    qint32 versionMaj;
    qint32 versionMin;
    in >> versionMaj;
    in >> versionMin;

    // project part
    MetaProject* proj = new MetaProject();

    QDir dir(projectPath);
    dir.cdUp();
    proj->loadProject(in, dir.absolutePath(), versionMaj, versionMin);

    addProject(proj);

    proj->postLoadProject();

    /*
    if(projects.contains(proj->getProjName()))
    {
        file.close();
        return false;
    }

    projects[proj->getProjName()] = proj;
    */

    file.close();

    qDebug() << "Project" << proj->getName() << "loaded";

    return true;
}
Ejemplo n.º 6
0
void ModelEnumerator::initProjection(SharedContext& ctx) {
	if (!projectionEnabled()) { return; }
	const OutputTable& out = ctx.output;
	char const filter = static_cast<char>(options_ >> 24);
	// Make sure that nogoods are tagged with step literal.
	addProject(ctx, ctx.stepLiteral().var());
	if (out.projectMode() == OutputTable::project_output) {
		// Mark all relevant output variables.
		for (OutputTable::pred_iterator it = out.pred_begin(), end = out.pred_end(); it != end; ++it) {
			if (*it->name != filter) { addProject(ctx, it->cond.var()); }
		}
		for (OutputTable::range_iterator it = out.vars_begin(), end = out.vars_end(); it != end; ++it) {
			for (Var v = it->lo; v != it->hi; ++v) { addProject(ctx, v); }
		}
	}
	else {
		// Mark explicitly requested variables only.
		for (OutputTable::lit_iterator it = out.proj_begin(), end = out.proj_end(); it != end; ++it) {
			addProject(ctx, it->var());
		}
	}
	domRec_.clear();
}
Ejemplo n.º 7
0
IfcSchema::IfcGeometricRepresentationContext* IfcHierarchyHelper::getRepresentationContext(const std::string& s) {
	std::map<std::string, IfcSchema::IfcGeometricRepresentationContext*>::const_iterator it = contexts.find(s);
	if (it != contexts.end()) return it->second;
	else {
		IfcSchema::IfcProject* project = getSingle<IfcSchema::IfcProject>();
		if (!project) {
			project = addProject();
		}
		IfcSchema::IfcRepresentationContext::list::ptr project_contexts = project->RepresentationContexts();
		IfcSchema::IfcGeometricRepresentationContext* context = new IfcSchema::IfcGeometricRepresentationContext(
			boost::none, s, 3, 1e-5, addPlacement3d(), addDoublet<IfcSchema::IfcDirection>(0, 1));
		addEntity(context);
		project_contexts->push(context);
		project->setRepresentationContexts(project_contexts);
		return contexts[s] = context;
	}
}
IfcSchema::IfcSite* IfcHierarchyHelper::addSite(IfcSchema::IfcProject* proj, IfcSchema::IfcOwnerHistory* owner_hist) {
	if (! owner_hist) {
		owner_hist = getSingle<IfcSchema::IfcOwnerHistory>();
	}
	if (! owner_hist) {
		owner_hist = addOwnerHistory();
	}
	if (! proj) {
		proj = getSingle<IfcSchema::IfcProject>();
	}
	if (! proj) {
		proj = addProject(owner_hist);
	}

	IfcSchema::IfcSite* site = new IfcSchema::IfcSite(IfcParse::IfcGlobalId(), owner_hist, boost::none, 
		boost::none, boost::none, addLocalPlacement(), 0, boost::none, 
		IfcSchema::IfcElementCompositionEnum::IfcElementComposition_ELEMENT, 
		boost::none, boost::none, boost::none, boost::none, 0);

	addEntity(site);
	addRelatedObject<IfcSchema::IfcRelAggregates>(proj, site);
	return site;
}
Ejemplo n.º 9
0
ProjectToolBox::ProjectToolBox ( FermaNextWorkspace& ws, QWidget* parent, 
                                 Qt::WFlags f ) :
    QToolBox(parent, f),
    workspace(ws)
{    
    setMouseTracking( true );
        
    // Fill in toolbox by existent projects
    if ( workspace.countProjects() ) {
        for ( int i=0; i < workspace.countProjects(); ++i ) {
            FermaNextProject& prj = workspace.getProject(i);
            addProject(prj);            
        }
    }
    connect( &workspace, SIGNAL(onReset()), SLOT(clear()) );
    connect( &workspace, SIGNAL(onProjectCreate(FermaNextProject&)), 
                         SLOT(addProject(FermaNextProject&)) );
    connect( &workspace, SIGNAL(onProjectActivated(FermaNextProject&)), 
                         SLOT(projectIsActivated(FermaNextProject&)) );
    connect( &workspace, SIGNAL(onBeforeProjectRemove(FermaNextProject&)), 
                         SLOT(removeProject(FermaNextProject&)) );
    connect( this, SIGNAL(currentChanged(int)), 
                   SLOT(activateSelected(int)) );
}
Ejemplo n.º 10
0
ProjectsView::ProjectsView( QObject* parent, QWidget* parentWidget ) : View( parent ),
    m_folderUpdateCounter( 0 ),
    m_updateCounter( 0 ),
    m_sessionExpired( false )
{
    m_systemAdmin = dataManager->currentUserAccess() == AdminAccess;

    QAction* action;

    action = new QAction( IconLoader::icon( "file-reload" ), tr( "&Update Projects" ), this );
    action->setShortcut( QKeySequence::Refresh );
    connect( action, SIGNAL( triggered() ), this, SLOT( updateProjects() ), Qt::QueuedConnection );
    setAction( "updateProjects", action );

    action = new QAction( IconLoader::icon( "edit-access" ), tr( "&Manage Permissions..." ), this );
    action->setIconText( tr( "Permissions" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( managePermissions() ), Qt::QueuedConnection );
    setAction( "managePermissions", action );

    if ( m_systemAdmin ) {
        action = new QAction( IconLoader::icon( "project-new" ), tr( "Add &Project..." ), this );
        connect( action, SIGNAL( triggered() ), this, SLOT( addProject() ), Qt::QueuedConnection );
        setAction( "addProject", action );
    }

    action = new QAction( IconLoader::icon( "folder-new" ), tr( "Add &Folder..." ), this );
    action->setShortcut( QKeySequence::New );
    connect( action, SIGNAL( triggered() ), this, SLOT( addFolder() ), Qt::QueuedConnection );
    setAction( "addFolder", action );

    action = new QAction( IconLoader::icon( "edit-rename" ), tr( "&Rename Folder..." ), this );
    action->setIconText( tr( "Rename" ) );
    action->setShortcut( tr( "F2" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( editRename() ), Qt::QueuedConnection );
    setAction( "editRename", action );

    action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Folder" ), this );
    action->setIconText( tr( "Delete" ) );
    action->setShortcut( QKeySequence::Delete );
    connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ), Qt::QueuedConnection );
    setAction( "editDelete", action );

    action = new QAction( IconLoader::icon( "folder-move" ), tr( "&Move Folder..." ), this );
    action->setIconText( tr( "Move" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( moveFolder() ), Qt::QueuedConnection );
    setAction( "moveFolder", action );

    action = new QAction( IconLoader::icon( "project" ), tr( "&Open Project" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openProject() ), Qt::QueuedConnection );
    setAction( "openProject", action );

    action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open Folder" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openFolder() ), Qt::QueuedConnection );
    setAction( "openFolder", action );

    action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open List" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openGlobalList() ), Qt::QueuedConnection );
    setAction( "openGlobalList", action );

    action = new QAction( IconLoader::icon( "configure-alerts" ), tr( "&Manage Alerts..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( manageAlerts() ), Qt::QueuedConnection );
    setAction( "manageAlerts", action );

    setTitle( "sectionAdd", tr( "Add" ) );
    setTitle( "sectionProjects", tr( "Projects" ) );

    setDefaultMenuAction( "menuProject", "openProject" );
    setDefaultMenuAction( "menuProjectAdmin", "openProject" );
    setDefaultMenuAction( "menuFolder", "openFolder" );
    setDefaultMenuAction( "menuGlobalList", "openGlobalList" );

    loadXmlUiFile( ":/resources/projectsview.xml" );

    m_list = new QTreeView( parentWidget );

    TreeViewHelper helper( m_list );
    helper.initializeView( TreeViewHelper::TreeStyle );

    connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( contextMenu( const QPoint& ) ) );
    connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ),
        this, SLOT( doubleClicked( const QModelIndex& ) ) );

    setMainWidget( m_list );
}
CApplicationInstaller::CApplicationInstaller(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CApplicationInstaller)
{
    qDebug("CApplicationInstaller Init");
    ui->setupUi(this);
    //updateNeeded = false;
    ui->uninstallButton->setToolTip("Uninstall application");

    ui->optionsRunCheckBox->setToolTip("Run program after install completes");
    ui->optionsRamCheckBox->setToolTip("Install program in RAM");
    ui->optionsStartupCheckBox->setToolTip("Run program on startup");
    ui->optionsFilesCheckBox->setToolTip("Install files with application");

    ui->dataSizeSpinBox->setAttribute(Qt::WA_MacShowFocusRect, 0);
    ui->dataSizeLockCheckBox->setObjectName("lock");
    ui->dataSizeLockCheckBox->setEnabled(true);
    ui->dataSizeLockCheckBox->setToolTip("Lock/unlock size of RAM");
    ui->dataSizeSpinBox->setToolTip("Size of RAM (data/bss/stack) for application ");

    ui->uninstallButton->setObjectName("blueButton");
    ui->uninstallButton->setText(CFont::iconTrash());

    ui->installButton->setObjectName("blueButton");
    ui->installButton->setText(CFont::iconDownloadAlt());
    ui->installButton->setToolTip("Install Application");

    ui->filesInstallButton->setObjectName("blueButton");
    ui->filesInstallButton->setText(CFont::iconCopy());
    ui->filesInstallButton->setToolTip("Install associated files");

    ui->installAllCheckBox->setToolTip("Install all workspace applications");

    ui->installPath->setObjectName("unified");
    connect(ui->installPath->lineEdit(), SIGNAL(editingFinished()), this, SLOT(installPathUpdated()));

    ui->installer->setPrefix("APPLICATION");
    ui->installer->setSettings(CApplicationSettings::settings());
    ui->installer->loadPreferences();


    connect(ui->installer, SIGNAL(addProject(QString)), this, SLOT(addProject(QString)));
    connect(ui->installer, SIGNAL(projectSelected(QString)), this, SLOT(projectSelected(QString)));
    //need to load the previously loaded workspace

    connect(ui->installer, SIGNAL(projectUpdated(QString, QString, QString)),
            this, SIGNAL(projectUpdated(QString, QString, QString)));

    connect(ui->dataSizeLockCheckBox, SIGNAL(clicked(bool)), ui->dataSizeSpinBox, SLOT(setEnabled(bool)));

    ui->installer->updateProjectList();

    ui->stackLabel->setToolTip("Stack size");
    ui->stackLabel->setObjectName("warningLabel");

    connected(false);
    qDebug("CApplicationInstaller Done");

    CEventFilter * wheelFilter = new CEventFilter(QEvent::Wheel);
    ui->dataSizeSpinBox->installEventFilter(wheelFilter);
}
Ejemplo n.º 12
0
void ProjectBrowser::openProject(ProjectSettings* settings)
{
	FileType sourceType, includeType;
	StringTokenizer* strtok = new StringTokenizer();

	settings->parse();

	FXString project = settings->getStringValue("GENERAL", "name");
	addProject(project);

	FXString source = settings->getStringValue("DIRECTORY", "sourceDir");
	if (source != "")
		addDir(project, source, SOURCE);
	FXString include = settings->getStringValue("DIRECTORY", "includeDir");
	if (include != "")
		addDir(project, include, INCLUDE);
	FXString ressource = settings->getStringValue("DIRECTORY", "ressourceDir");
	if (ressource != "")
		addDir(project, ressource, RESSOURCE);
	FXString doc = settings->getStringValue("DIRECTORY", "docDir");
	if (doc != "")
		addDir(project, doc, DOC);

	FXString type = settings->getStringValue("GENERAL", "type");
	if (type == "C/C++")
	{
		sourceType = CPP_SOURCE;
		includeType = CPP_HEADER;
	}

	FXString sourceList = settings->getStringValue("FILES", "source");
	if (sourceList != "")
	{
		strtok->reinit(sourceList, ProjectSettings::SEPARATOR);
		FXString token;
		while ((token = strtok->getNextToken()) != "")
			addFile(project, token, source, sourceType);
	}

	FXString includeList = settings->getStringValue("FILES", "include");
	if (includeList != "")
	{
		strtok->reinit(includeList, ProjectSettings::SEPARATOR);
		FXString token;
		while ((token = strtok->getNextToken()) != "")
			addFile(project, token, include, includeType);
	}

	FXString ressourceList = settings->getStringValue("FILES", "ressource");
	if (ressourceList != "")
	{
		strtok->reinit(ressourceList, ProjectSettings::SEPARATOR);
		FXString token;
		while ((token = strtok->getNextToken()) != "")
			addFile(project, token, ressource, RESSOURCE_FILE);
	}

	FXString docList = settings->getStringValue("FILES", "doc");
	if (docList != "")
	{
		strtok->reinit(docList, ProjectSettings::SEPARATOR);
		FXString token;
		while ((token = strtok->getNextToken()) != "")
			addFile(project, token, doc, TEXT);
	}

	FXString rootList = settings->getStringValue("FILES", "root");
	if (rootList != "")
	{
		strtok->reinit(rootList, ProjectSettings::SEPARATOR);
		FXString token;
		while ((token = strtok->getNextToken()) != "")
			addFile(project, token, "", TEXT);
	}

	settings->write();	// unparse
	delete strtok;
}
Ejemplo n.º 13
0
Rekall::Rekall(const QStringList &arguments, QWidget *parent) :
    QDialog(parent) {
    trayIconWorking = false;
    trayIconIndex   = 0;
    trayIconIndexOld = 9999;
    Global::rekall = this;

    qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);

    //Update
    updateManager = 0;
    forceUpdate = false;
    firstTimeOpened = newVersionOfRekall = false;
    if(arguments.contains("-forceupdate"))
        forceUpdate = true;

    //Tray icon
    trayTimer.setInterval(500);
    connect(&trayTimer,    SIGNAL(timeout()), SLOT(trayIconToOnPrivate()));
    connect(&trayTimerOff, SIGNAL(timeout()), SLOT(trayIconToOffPrivate()));
    QString prefix = "mac";
#ifdef Q_OS_WIN
    prefix = "win";
#endif
    for(quint16 i = 0 ; i <= 17 ; i++)
        trayIcons << QIcon(QString(":/icons/rekall-menubar-%1-%2.png").arg(prefix).arg(i, 2, 10, QChar('0')));
    trayIcon = new QSystemTrayIcon(this);
    trayIconToOffPrivate();
    trayTimer.start();
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));

    //Interfaces
    Global::userInfos = new UserInfos(this);
    Global::http      = new Http(this);
    Analyse *analyse  = new Analyse(this);
    Global::analyse   = analyse;
    connect(analyse, SIGNAL(trayChanged(QString,bool)), SLOT(analyseTrayChanged(QString,bool)));
    connect(analyse, SIGNAL(trayIconToOff()), SLOT(trayIconToOff()));
    connect(analyse, SIGNAL(trayIconToOn(qint16)), SLOT(trayIconToOn(qint16)));
    //Wrapper web
    Global::userInfos->setDockIcon(this, false);
    Global::webWrapper = new WebWrapper();

    /*
    VideoPlayer *player = new VideoPlayer();
    player->open(QUrl::fromLocalFile("/Users/guillaume/Documents/Rekall/Walden/Captations/captation WALDEN_TPV.mov"));
    player->seek(4000);
    */

    trayMenu = new QMenu(this);
    trayMenu->setSeparatorsCollapsible(true);
    trayAnalyse      = trayMenu->addAction(tr("File analysis…"));
    trayAnalysePause = trayMenu->addAction(tr("Pause analysis"));
    trayAnalysePause->setCheckable(true);
    connect(trayAnalysePause, SIGNAL(toggled(bool)), SLOT(trayAnalysePaused()));
    trayMenu->addSeparator();
    trayMenu->addAction(tr("Open welcome page"), this, SLOT(openWebPage()));
    trayMenu->addAction(tr("Open welcome page in webrowser"), this, SLOT(openWebPageInBrowser()));
    //trayMenu->addAction(tr("Create a new project"), this, SLOT(addProject()));
    trayMenu->addSeparator();
    trayMenuProjects = trayMenu->addAction(tr("Quit Rekall"), this, SLOT(closeRekall()));
    trayIcon->setContextMenu(trayMenu);
    trayIcon->show();
    trayIconToOnPrivate();

    QSettings settings;
    quint16 projectCount = settings.beginReadArray("projects");
    /*
    if(projectCount == 0) {
        addProject(new Project("walden",     "Walden", true, QFileInfo("/Users/guillaume/Documents/Rekall/Walden"), this));
        addProject(new Project("joris-test", "Joris", false, QFileInfo("/Users/guillaume/Documents/Rekall/joris-test"), this));
    }
    */
    connect(Global::udp, SIGNAL(outgoingMessage(QString,quint16,QString,QList<QVariant>)), SLOT(incomingMessage(QString,quint16,QString,QList<QVariant>)));

    for(quint16 projectIndex = 0 ; projectIndex < projectCount ; projectIndex++) {
        settings.setArrayIndex(projectIndex);
        Project *project = new Project(settings.value("name").toString(), settings.value("friendlyName").toString(), true, QFileInfo(settings.value("path").toString()), this);
        addProject(project);
    }
    settings.endArray();

    //foreach(ProjectInterface *project, Global::projects)
    //    project->load();


    //Global settings creation if needed
    globalSettings = new QSettings();
    if((globalSettings) && ((!globalSettings->childKeys().contains("id")) || (arguments.contains("-newuser")))) {
        firstTimeOpened = true;
        qsrand(QDateTime::currentDateTime().toTime_t());
        updateAnonymousId = QString::number(qrand());
        globalSettings->setValue("id", updateAnonymousId);
        globalSettings->setValue("version", "");
        globalSettings->setValue("updatePeriod", 1);
        globalSettings->setValue("lastUpdate",   QDateTime(QDate(2000, 01, 01)));
    }

    //Update management
    if((globalSettings) && (globalSettings->childKeys().contains("id"))) {
        QDateTime updateLastDate  = globalSettings->value("lastUpdate")  .toDateTime();
        quint16   updatePeriod    = globalSettings->value("updatePeriod").toUInt();
        updateAnonymousId         = globalSettings->value("id")          .toString();
        QString applicationVersionSettings = globalSettings->value("version").toString();
        if(applicationVersionSettings != QCoreApplication::applicationVersion()) {
            globalSettings->setValue("version", QCoreApplication::applicationVersion());
            firstTimeOpened = true;
        }

        qDebug("Last update : %s (should update each %d day(s))", qPrintable(updateLastDate.toString("dd/MM/yyyy hh:mm:ss")), updatePeriod);
        if((updateLastDate.daysTo(QDateTime::currentDateTime()) >= updatePeriod) || (forceUpdate))
            checkForUpdates();
    }

    askScreenshot = askAddProject = 0;
    startTimer(50);
    if(firstTimeOpened)
        showMessage(tr("Welcome!\nRekall is now running!"));
    else
        showMessage(tr("Rekall is now running!"));

    if(!arguments.contains("-silent"))
        openWebPage();

    /*
    QWebView *webView = new QWebView();
    webView->load(QUrl("http://127.0.0.1:23411"));
    webView->show();
    */
}