Ejemplo n.º 1
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)));
}
Ejemplo n.º 2
0
void ProjectOperationHandler::createClicked()
{
    if(m_projectName != "" && m_projectLocation != "")
    {
        QObject* rootObject = m_engine->rootObjects().first();
        QObject* form = rootObject->findChild<QObject*>("goLight", Qt::FindChildrenRecursively);
        form->setProperty("running", true);
        form = rootObject->findChild<QObject*>("goOpenLight", Qt::FindChildrenRecursively);
        form->setProperty("running", true);

        form = rootObject->findChild<QObject*>("goDarkMouseArea", Qt::FindChildrenRecursively);
        form->setProperty("enabled", true);
        form = rootObject->findChild<QObject*>("goOpenDarkMouseArea", Qt::FindChildrenRecursively);
        form->setProperty("enabled", true);

        form = m_createProjectForm->findChild<QObject*>("projectNameInput");
        m_projectName = form->property("text").toString();
        form = m_createProjectForm->findChild<QObject*>("projectLocationInput");
        m_projectLocation = form->property("text").toString();

        qDebug() << m_projectName << m_projectLocation;

        emit createProject(m_projectName, m_projectLocation);
    }
}
Ejemplo n.º 3
0
void SerialServer::processData(QByteArray& data)
{
    QDataStream dataStream(&data, QIODevice::ReadOnly);
    
    QString fileName;
    QByteArray fileData;
    
    dataStream >> fileName;
    dataStream >> fileData;
    
    if(fileName.isEmpty())
        return;
    
    QFileInfo fileInfo(fileName);
    
    QString projectPath = createProject(fileInfo.baseName());
    writeFile(projectPath + "/" + fileName, fileData);
    
    QString mainFilePath = projectPath + "/" + fileName;
    
    while(dataStream.status() == QDataStream::Ok) {
        fileName.clear();
        fileData.clear();
        
        dataStream >> fileName;
        dataStream >> fileData;
        
        if(!fileName.isEmpty()) {
            writeFile(projectPath + "/" + fileName, fileData);
        }
    }
    emit downloadFinished(mainFilePath);
}
Ejemplo n.º 4
0
void ofPg::createProject(string name, string path, ofPgBaseProjectList projects)
{
	ofPgBaseProjectList::iterator it = projects.begin();
	while(it != projects.end()){
		createProject(name, path, *it);
		it++;
	}
}
Ejemplo n.º 5
0
 int DBimpl::randomProjects(){
     Project* projectOne = new Project("Project One");
     projectOne->setTeamMax(4);
     projectOne->setTeamMin(3);


     Project* projectTwo = new Project ("Project Two");
     projectTwo->setTeamMax(3);
     projectTwo->setTeamMin(2);
     createProject(*projectOne);
     createProject(*projectTwo);


     QList<Student*> students = getAllStudents();

     QList <Student*> studentsOne;
     QList <Student*> studentsTwo;
     int insertCount = 0;
     while (students.count() != 0)
     {
         int index = std::rand() % students.count();
         if (insertCount < 13)
         {
              studentsOne << students.at(index);
              students.removeAt(index);
         }
         else{
             studentsTwo << students.at(index);
             students.removeAt(index);
         }
         insertCount++;

     }


          addStudentsToProject(projectOne->getID(),&studentsOne);
          addStudentsToProject(projectTwo->getID(),&studentsTwo);
 }
Ejemplo n.º 6
0
    void buttonClicked (Button* b)
    {
        if (b == &createButton)
        {
            createProject();
        }
        else
        {
            MainWindow* mw = dynamic_cast<MainWindow*> (getTopLevelComponent());
            jassert (mw != nullptr);

            JucerApplication::getApp()->closeWindow (mw);
        }
    }
Ejemplo n.º 7
0
void ProjectManagerWindow::onCreateClicked()
{
    if (!(m_nameLine->text().isEmpty()) && !(m_pathLine->text().isEmpty())) {
        QString fileExtension = m_extension[m_listWidget->currentItem()];
        if (fileExtension == ".robopro") {
            emit createProject(m_nameLine->text(), m_pathLine->text());
            emit createFile("main.cpp", m_pathLine->text());
            emit projectCreated();
        }
        else {
            emit createFile(m_nameLine->text() + fileExtension, m_pathLine->text());
        }

        m_nameLine->setText("undefined");
        this->close();
    }
}
Ejemplo n.º 8
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{   
    Settings::create(QApplication::applicationDirPath() + "/appSettings.ini");
    ui->setupUi(this);    
    createPlotsGroups();
    routePlotsMenu();
    createPlotsTilingMenu();
    createPlotSettingsView();
    restoreVisibilityActionsState();
    restoreSettings();
    createProject();
    createSamplesProxyActions();
    createRecentlyProjectPaths();
    initAbout();
    createTranslator();
}
Ejemplo n.º 9
0
KGMain::KGMain(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::KGMain)
{
    // init model
    initContextModel();
    KGRessourceLoader::instance()->loadRessources();
    ui->setupUi(this);

    m_model = new KGItemModel;

    ui->projectView->setModel(m_model);
    ui->widget->kgVisualView()->setModel(m_model);
    m_model->loadGroups();

    //m_visualItemFactory = new KGVisualItemFactory(ui->widget->kgVisualView());
    //m_groupFactory = new KGGroupFactory(m_visualItemFactory, m_model);

    //m_visualItemFactory->loadGroup(0, tr("INBOX"));
    //m_groupFactory->loadGroups();

    //connect(ui->inboxButton,SIGNAL(clicked()), m_visualItemFactory, SLOT(loadGroup()));
    //connect(ui->starredButton,SIGNAL(clicked()), m_visualItemFactory, SLOT(loadStarred()));
    connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(createProject()));

    /*QListWidgetItem *item = new QListWidgetItem("test", ui->listWidget, 0);
    new QListWidgetItem("test2", ui->listWidget, 0);
    item->setCheckState(Qt::Unchecked);
*/
    /*setWindowState(Qt::WindowMaximized);
    // init user interface
    initDockWindows();
    ui->toolBar->setVisible(false);
*/
    //initToolbar();

    // windows id, key id, mod, key
    //RegisterHotKey( this->winId(), 1, MOD_CONTROL, Qt::Key_N);
    // windows id, key id
    //UnregisterHotKey(this->winId(), 1);

}
Ejemplo n.º 10
0
newProjectDialog::newProjectDialog(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::newProjectDialog)
{
	ui->setupUi(this);

	templateDir.current();
	templateDir.cd("template");

	ui->templateComboBox->addItems(templateDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot));

	connect(ui->templateComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectTemplate()));

	connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createProject()));
	connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	selectTemplate();
	setProgrammerList();
	setMCUList();
}
dataAnalysisWidget::dataAnalysisWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::dataAnalysisWidget),
    _createProjectWidget(new createProjectWidget()), // no parent - otherwise it is embedded
    _projectListModel(new QStringListModel(this))
{
    ui->setupUi(this);

    //! external connections
    connect(_createProjectWidget, SIGNAL(savedNewProject(QString)), this, SLOT(readProjectFile(QString)));

    //! connections within this widget
    // from the projects List
    connect(ui->newProjectPushButton, SIGNAL(clicked()), this, SLOT(createProject()));
    connect(ui->openProjectPushButton, SIGNAL(clicked()), this, SLOT(loadProject()));
    connect(ui->closeProjectPushButton, SIGNAL(clicked()), this, SLOT(closeProject()));
    connect(ui->projectListView, SIGNAL(activated(QModelIndex)), this, SLOT(updateOtherViews(QModelIndex)));

    // from the settings Tree

    // from the results Table

}
Ejemplo n.º 12
0
void HomeDialog::action(QListWidgetItem* i){
    int r = ui->quickStartList->row(i);
    switch(r){
        case 0:
            createProject();
            break;
        case 1:
            openProject();
            break;
        case 2:
            importProject();
            break;
        case 3:
            configure();
            break;
        case 4:
            update();
            break;
        case 5:
            documentations();
            break;
    }
    ui->quickStartList->setCurrentRow(-1);
}
Ejemplo n.º 13
0
int runRcc(int argc, char *argv[])
{
    QString outFilename;
    bool helpRequested = false;
    bool list = false;
    bool projectRequested = false;
    QStringList filenamesIn;

    QStringList args = qCmdLineArgs(argc, argv);

    RCCResourceLibrary library;

    //parse options
    QString errorMsg;
    for (int i = 1; i < args.count() && errorMsg.isEmpty(); i++) {
        if (args[i].isEmpty())
            continue;
        if (args[i][0] == QLatin1Char('-')) {   // option
            QString opt = args[i];
            if (opt == QLatin1String("-o")) {
                if (!(i < argc-1)) {
                    errorMsg = QLatin1String("Missing output name");
                    break;
                }
                outFilename = args[++i];
            } else if (opt == QLatin1String("-name")) {
                if (!(i < argc-1)) {
                    errorMsg = QLatin1String("Missing target name");
                    break;
                }
                library.setInitName(args[++i]);
            } else if (opt == QLatin1String("-root")) {
                if (!(i < argc-1)) {
                    errorMsg = QLatin1String("Missing root path");
                    break;
                }
                library.setResourceRoot(QDir::cleanPath(args[++i]));
                if (library.resourceRoot().isEmpty()
                        || library.resourceRoot().at(0) != QLatin1Char('/'))
                    errorMsg = QLatin1String("Root must start with a /");
            } else if (opt == QLatin1String("-compress")) {
                if (!(i < argc-1)) {
                    errorMsg = QLatin1String("Missing compression level");
                    break;
                }
                library.setCompressLevel(args[++i].toInt());
            } else if (opt == QLatin1String("-threshold")) {
                if (!(i < argc-1)) {
                    errorMsg = QLatin1String("Missing compression threshold");
                    break;
                }
                library.setCompressThreshold(args[++i].toInt());
            } else if (opt == QLatin1String("-binary")) {
                library.setFormat(RCCResourceLibrary::Binary);
            } else if (opt == QLatin1String("-namespace")) {
                library.setUseNameSpace(!library.useNameSpace());
            } else if (opt == QLatin1String("-verbose")) {
                library.setVerbose(true);
            } else if (opt == QLatin1String("-list")) {
                list = true;
            } else if (opt == QLatin1String("-version") || opt == QLatin1String("-v")) {
                fprintf(stderr, "Qt Resource Compiler version %s\n", QT_VERSION_STR);
                return 1;
            } else if (opt == QLatin1String("-help") || opt == QLatin1String("-h")) {
                helpRequested = true;
            } else if (opt == QLatin1String("-no-compress")) {
                library.setCompressLevel(-2);
            } else if (opt == QLatin1String("-project")) {
                projectRequested = true;
            } else {
                errorMsg = QString::fromLatin1("Unknown option: '%1'").arg(args[i]);
            }
        } else {
            if (!QFile::exists(args[i])) {
                qWarning("%s: File does not exist '%s'",
                    qPrintable(args[0]), qPrintable(args[i]));
                return 1;
            }
            filenamesIn.append(args[i]);
        }
    }

    if (projectRequested && !helpRequested) {
        return createProject(outFilename);
    }

    if (!filenamesIn.size() || !errorMsg.isEmpty() || helpRequested) {
        showHelp(args[0], errorMsg);
        return 1;
    }
    QFile errorDevice;
    errorDevice.open(stderr, QIODevice::WriteOnly|QIODevice::Text);
    
    if (library.verbose())
        errorDevice.write("Qt resource compiler\n");

    library.setInputFiles(filenamesIn);

    if (!library.readFiles(list, errorDevice))
        return 1;

    // open output
    QFile out;
    QIODevice::OpenMode mode = QIODevice::WriteOnly;
    if (library.format() == RCCResourceLibrary::C_Code)
        mode |= QIODevice::Text;

    if (outFilename.isEmpty() || outFilename == QLatin1String("-")) {
        // using this overload close() only flushes.
        out.open(stdout, mode);
    } else {
        out.setFileName(outFilename);
        if (!out.open(mode)) {
            const QString msg = QString::fromUtf8("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString());
            errorDevice.write(msg.toUtf8());
            return 1;
        }
    }

    // do the task
    if (list) {
        const QStringList data = library.dataFiles();
        for (int i = 0; i < data.size(); ++i) {
            out.write(qPrintable(QDir::cleanPath(data.at(i))));
            out.write("\n");
        }
        return 0;
    } 

    return library.output(out, errorDevice) ? 0 : 1;
}
Ejemplo n.º 14
0
int runRcc(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    QCoreApplication::setApplicationVersion(QStringLiteral(QT_VERSION_STR));

    // Note that rcc isn't translated.
    // If you use this code as an example for a translated app, make sure to translate the strings.
    QCommandLineParser parser;
    parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
    parser.setApplicationDescription(QLatin1String("Qt Resource Compiler version " QT_VERSION_STR));
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption outputOption(QStringList() << QStringLiteral("o") << QStringLiteral("output"));
    outputOption.setDescription(QStringLiteral("Write output to <file> rather than stdout."));
    outputOption.setValueName(QStringLiteral("file"));
    parser.addOption(outputOption);

    QCommandLineOption tempOption(QStringList() << QStringLiteral("t") << QStringLiteral("temp"));
    tempOption.setDescription(QStringLiteral("Use temporary <file> for big resources."));
    tempOption.setValueName(QStringLiteral("file"));
    parser.addOption(tempOption);

    QCommandLineOption nameOption(QStringLiteral("name"), QStringLiteral("Create an external initialization function with <name>."), QStringLiteral("name"));
    parser.addOption(nameOption);

    QCommandLineOption rootOption(QStringLiteral("root"), QStringLiteral("Prefix resource access path with root path."), QStringLiteral("path"));
    parser.addOption(rootOption);

    QCommandLineOption compressOption(QStringLiteral("compress"), QStringLiteral("Compress input files by <level>."), QStringLiteral("level"));
    parser.addOption(compressOption);

    QCommandLineOption nocompressOption(QStringLiteral("no-compress"), QStringLiteral("Disable all compression."));
    parser.addOption(nocompressOption);

    QCommandLineOption thresholdOption(QStringLiteral("threshold"), QStringLiteral("Threshold to consider compressing files."), QStringLiteral("level"));
    parser.addOption(thresholdOption);

    QCommandLineOption binaryOption(QStringLiteral("binary"), QStringLiteral("Output a binary file for use as a dynamic resource."));
    parser.addOption(binaryOption);

    QCommandLineOption passOption(QStringLiteral("pass"), QStringLiteral("Pass number for big resources"), QStringLiteral("number"));
    parser.addOption(passOption);

    QCommandLineOption namespaceOption(QStringLiteral("namespace"), QStringLiteral("Turn off namespace macros."));
    parser.addOption(namespaceOption);

    QCommandLineOption verboseOption(QStringLiteral("verbose"), QStringLiteral("Enable verbose mode."));
    parser.addOption(verboseOption);

    QCommandLineOption listOption(QStringLiteral("list"), QStringLiteral("Only list .qrc file entries, do not generate code."));
    parser.addOption(listOption);

    QCommandLineOption projectOption(QStringLiteral("project"), QStringLiteral("Output a resource file containing all files from the current directory."));
    parser.addOption(projectOption);

    parser.addPositionalArgument(QStringLiteral("inputs"), QStringLiteral("Input files (*.qrc)."));


    //parse options
    parser.process(app);

    QString errorMsg;
    RCCResourceLibrary library;
    if (parser.isSet(nameOption))
        library.setInitName(parser.value(nameOption));
    if (parser.isSet(rootOption)) {
        library.setResourceRoot(QDir::cleanPath(parser.value(rootOption)));
        if (library.resourceRoot().isEmpty()
                || library.resourceRoot().at(0) != QLatin1Char('/'))
            errorMsg = QLatin1String("Root must start with a /");
    }
    if (parser.isSet(compressOption))
        library.setCompressLevel(parser.value(compressOption).toInt());
    if (parser.isSet(nocompressOption))
        library.setCompressLevel(-2);
    if (parser.isSet(thresholdOption))
        library.setCompressThreshold(parser.value(thresholdOption).toInt());
    if (parser.isSet(binaryOption))
        library.setFormat(RCCResourceLibrary::Binary);
    if (parser.isSet(passOption)) {
        if (parser.value(passOption) == QLatin1String("1"))
            library.setFormat(RCCResourceLibrary::Pass1);
        else if (parser.value(passOption) == QLatin1String("2"))
            library.setFormat(RCCResourceLibrary::Pass2);
        else
            errorMsg = QLatin1String("Pass number must be 1 or 2");
    }
    if (parser.isSet(namespaceOption))
        library.setUseNameSpace(!library.useNameSpace());
    if (parser.isSet(verboseOption))
        library.setVerbose(true);

    const bool list = parser.isSet(listOption);
    const bool projectRequested = parser.isSet(projectOption);
    const QStringList filenamesIn = parser.positionalArguments();

    foreach (const QString &file, filenamesIn) {
        if (!QFile::exists(file)) {
            qWarning("%s: File does not exist '%s'", argv[0], qPrintable(file));
            return 1;
        }
    }

    QString outFilename = parser.value(outputOption);
    QString tempFilename = parser.value(tempOption);

    if (projectRequested) {
        return createProject(outFilename);
    }

    if (filenamesIn.isEmpty())
        errorMsg = QStringLiteral("No input files specified.");

    if (!errorMsg.isEmpty()) {
        fprintf(stderr, "%s: %s\n", argv[0], qPrintable(errorMsg));
        parser.showHelp(1);
        return 1;
    }
    QFile errorDevice;
    errorDevice.open(stderr, QIODevice::WriteOnly|QIODevice::Text);

    if (library.verbose())
        errorDevice.write("Qt resource compiler\n");

    library.setInputFiles(filenamesIn);

    if (!library.readFiles(list, errorDevice))
        return 1;

    QFile out;

    // open output
    QIODevice::OpenMode mode = QIODevice::NotOpen;
    switch (library.format()) {
        case RCCResourceLibrary::C_Code:
        case RCCResourceLibrary::Pass1:
            mode = QIODevice::WriteOnly | QIODevice::Text;
            break;
        case RCCResourceLibrary::Pass2:
        case RCCResourceLibrary::Binary:
            mode = QIODevice::WriteOnly;
            break;
    }


    if (outFilename.isEmpty() || outFilename == QLatin1String("-")) {
#ifdef Q_OS_WIN
        // Make sure fwrite to stdout doesn't do LF->CRLF
        if (library.format() == RCCResourceLibrary::Binary)
            _setmode(_fileno(stdout), _O_BINARY);
#endif // Q_OS_WIN
        // using this overload close() only flushes.
        out.open(stdout, mode);
    } else {
        out.setFileName(outFilename);
        if (!out.open(mode)) {
            const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString());
            errorDevice.write(msg.toUtf8());
            return 1;
        }
    }

    // do the task
    if (list) {
        const QStringList data = library.dataFiles();
        for (int i = 0; i < data.size(); ++i) {
            out.write(qPrintable(QDir::cleanPath(data.at(i))));
            out.write("\n");
        }
        return 0;
    }

    QFile temp;
    if (!tempFilename.isEmpty()) {
        temp.setFileName(tempFilename);
        if (!temp.open(QIODevice::ReadOnly)) {
            const QString msg = QString::fromUtf8("Unable to open temporary file %1 for reading: %2\n")
                    .arg(outFilename).arg(out.errorString());
            errorDevice.write(msg.toUtf8());
            return 1;
        }
    }
    bool success = library.output(out, temp, errorDevice);
    if (!success) {
        // erase the output file if we failed
        out.remove();
        return 1;
    }
    return 0;
}