IDENewProjectWindow::IDENewProjectWindow(IDEWindow *parent) :
    QDialog((QWidget*)parent)
{
    this->setWindowTitle("Creating New Project");
    this->project = parent->getProject();

    mainlayout = new QBoxLayout(QBoxLayout::TopToBottom, this);

    mainlayout->addWidget(new QLabel("Please choose a name for your new project:", 0));
    mainlayout->addWidget(projectname = new QLineEdit(0));
    mainlayout->addWidget(new QLabel("Please choose a directory where the project will be created:", 0));
    mainlayout->addWidget(projectdirectory = new QLineEdit(0));
    mainlayout->addWidget(resultingfolderlabel = new QLabel(""));
    resultingfolderlabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);


    mainlayout->addWidget(createinsubdir = new QCheckBox("Create project in subdirectory (recommended)", 0));
    createinsubdir->setChecked(true);
    reset();

    QObject::connect(projectdirectory, SIGNAL(textChanged(QString)), this, SLOT(updateResultingPath()));
    QObject::connect(projectname, SIGNAL(textChanged(QString)), this, SLOT(updateResultingPath()));
    QObject::connect(projectdirectory, SIGNAL(textEdited(QString)), this, SLOT(updateResultingPath()));
    QObject::connect(projectname, SIGNAL(textEdited(QString)), this, SLOT(updateResultingPath()));
    QObject::connect(createinsubdir, SIGNAL(stateChanged(int)), this, SLOT(updateResultingPath()));
    QObject::connect(createinsubdir, SIGNAL(toggled(bool)), this, SLOT(updateResultingPath()));

    mainlayout->addWidget(new QWidget(0), 1, Qt::AlignLeft);

    QWidget* buttonrowwidget = new QWidget(0, 0);
    mainlayout->addWidget((QWidget*)buttonrowwidget);
    buttonrowwidget->show();
    buttonrowwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    QLayout* buttonrowlayout = new QBoxLayout(QBoxLayout::RightToLeft, buttonrowwidget);

    continuebutton = new QPushButton("Continue", 0);
    buttonrowlayout->addWidget((QWidget*)continuebutton);
    continuebutton->show();
    QObject::connect(continuebutton, SIGNAL(clicked()), this, SLOT(clickedContinue()));
    continuebutton->setDisabled(true);

    cancelbutton = new QPushButton("Cancel", 0);
    buttonrowlayout->addWidget((QWidget*)cancelbutton);
    cancelbutton->show();
    QObject::connect(cancelbutton, SIGNAL(clicked()), this, SLOT(clickedCancel()));

    updateResultingPath();

    // set proper minimum size:
    QSize q = mainlayout->sizeHint();
    q.setWidth(q.width());
    q.setHeight(q.height() + 100); // leave some space for resultingfolderlabel
    this->setMinimumSize(q);
}
Пример #2
0
CSettings::CSettings(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	connect(ui.pBtn_Save,			SIGNAL(clicked()), this, SLOT(clickedSave()));
	connect(ui.pBtn_Cancel,			SIGNAL(clicked()), this, SLOT(clickedCancel()));
	connect(ui.pBtn_ShowFullScreen, SIGNAL(clicked()), this, SLOT(clickedShowFullScreen()));
	connect(ui.pBtn_Close,			SIGNAL(clicked()), this, SLOT(clickedClose()));
	connect(ui.pBtn_Connect,		SIGNAL(clicked()), this, SLOT(clickedConnect()));

	QSettings settings;
	ui.lineEdit_IPAdress->setText(settings.value("IPAdress").toString());
	ui.lineEdit_Port->setText(settings.value("Port").toString());
}
IDEGreetingWindow::IDEGreetingWindow(QWidget *parent, IDEProject *project) :
    QDialog(parent)
{
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    this->setWindowTitle("Welcome");
    this->project = project;

    welcomeframe = new QFrame(this, 0);
    welcomeframe->show();
    welcomeframe->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    radiobuttonlist = new QBoxLayout(QBoxLayout::TopToBottom, welcomeframe);
    radiobuttonlist->setSizeConstraint(QLayout::SetMinimumSize);

    greetingtext = new QLabel("Welcome to the blitwizard development environment!\n"
                              "Please specify what you want to do:");
    radiobuttonlist->addWidget((QWidget*)greetingtext);
    greetingtext->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    choicenewproject = new QRadioButton("Start new project", 0);
    radiobuttonlist->addWidget((QWidget*)choicenewproject);
    choicenewproject->setChecked(true);

    choiceopenproject = new QRadioButton("Open project from file", 0);
    radiobuttonlist->addWidget((QWidget*)choiceopenproject);

    choicerecentproject = new QRadioButton("Choose from recently opened projects:", 0);
    radiobuttonlist->addWidget((QWidget*)choicerecentproject);

    recentprojectlist = new QListWidget();
    radiobuttonlist->addWidget((QWidget*)recentprojectlist);

    // add recent projects to list:
    std::vector<QString> recentlyOpened = GetApplicationInstance()->settings->getRecentlyOpenedProjects();
    int i = recentlyOpened.size() - 1;
    while (i >= 0) {
        QString f = recentlyOpened[i];
        recentprojectlist->addItem(
                    QString(QFileInfo(QFile(f)).fileName()) + QString(" (") + QString(f) + QString(")"));
        i--;
    }
    if (recentlyOpened.size() == 0) {
        // disable recent project option if no recent projects:
        choicerecentproject->setDisabled(true);
    } else {
        // make recent project the default choice:
        choicerecentproject->setChecked(true);
        choicenewproject->setChecked(false);
        recentprojectlist->setCurrentRow(0);
        QObject::connect(recentprojectlist, SIGNAL(currentRowChanged(int)), this, SLOT(recentProjectChoiceClicked()));
        QObject::connect(recentprojectlist, SIGNAL(clicked(QModelIndex)), this, SLOT(recentProjectChoiceClicked()));
    }

    buttonrowwidget = new QWidget(0, 0);
    radiobuttonlist->addWidget((QWidget*)buttonrowwidget);
    buttonrowwidget->show();
    buttonrowwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    buttonrowlayout = new QBoxLayout(QBoxLayout::RightToLeft, buttonrowwidget);

    continuebutton = new QPushButton("Continue", 0);
    buttonrowlayout->addWidget((QWidget*)continuebutton);
    continuebutton->show();
    QObject::connect(continuebutton, SIGNAL(clicked()), this, SLOT(clickedContinue()));

    cancelbutton = new QPushButton("Cancel", 0);
    buttonrowlayout->addWidget((QWidget*)cancelbutton);
    cancelbutton->show();
    QObject::connect(cancelbutton, SIGNAL(clicked()), this, SLOT(clickedCancel()));

    // set proper minimum size:
    this->setMinimumSize(welcomeframe->sizeHint());
}