예제 #1
0
TestWizardPage::TestWizardPage(QWidget *parent) :
    QWizardPage(parent),
    m_sourceSuffix(QtWizard::sourceSuffix()),
    m_lowerCaseFileNames(QtWizard::lowerCaseFiles()),
    ui(new Ui::TestWizardPage),
    m_fileNameEdited(false),
    m_valid(false)
{
    setTitle(tr("Test Class Information"));
    ui->setupUi(this);
    ui->testSlotLineEdit->setText(QLatin1String("testCase1"));
    ui->testClassLineEdit->setLowerCaseFileName(m_lowerCaseFileNames);
    ui->qApplicationCheckBox->setChecked(TestWizardParameters::requiresQApplicationDefault);
    connect(ui->testClassLineEdit, SIGNAL(updateFileName(QString)),
            this, SLOT(slotClassNameEdited(QString)));
    connect(ui->fileLineEdit, SIGNAL(textEdited(QString)), \
                this, SLOT(slotFileNameEdited()));
    connect(ui->testClassLineEdit, SIGNAL(validChanged()),
            this, SLOT(slotUpdateValid()));
    connect(ui->testSlotLineEdit, SIGNAL(validChanged()),
            this, SLOT(slotUpdateValid()));
    connect(ui->fileLineEdit, SIGNAL(validChanged()),
            this, SLOT(slotUpdateValid()));

    setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details"));
}
예제 #2
0
void BaseValidatingLineEdit::slotChanged(const QString &t)
{
    m_bd->m_errorMessage.clear();
    // Are we displaying the initial text?
    const bool isDisplayingInitialText = !m_bd->m_initialText.isEmpty() && t == m_bd->m_initialText;
    const State newState = isDisplayingInitialText ?
                               DisplayingInitialText :
                               (validate(t, &m_bd->m_errorMessage) ? Valid : Invalid);
    setToolTip(m_bd->m_errorMessage);
    if (debug)
        qDebug() << Q_FUNC_INFO << t << "State" <<  m_bd->m_state << "->" << newState << m_bd->m_errorMessage;
    // Changed..figure out if valid changed. DisplayingInitialText is not valid,
    // but should not show error color. Also trigger on the first change.
    if (newState != m_bd->m_state || m_bd->m_firstChange) {
        const bool validHasChanged = (m_bd->m_state == Valid) != (newState == Valid);
        m_bd->m_state = newState;
        m_bd->m_firstChange = false;
        setTextColor(this, newState == Invalid ? m_bd->m_errorTextColor : m_bd->m_okTextColor);
        if (validHasChanged) {
            emit validChanged(newState == Valid);
            emit validChanged();
        }
    }
    bool block = blockSignals(true);
    const QString fixedString = fixInputString(t);
    if (t != fixedString) {
        const int cursorPos = cursorPosition();
        setText(fixedString);
        setCursorPosition(qMin(cursorPos, fixedString.length()));
    }
    blockSignals(block);
}
예제 #3
0
FileWizardPage::FileWizardPage(QWidget *parent) :
    QWizardPage(parent),
    m_d(new FileWizardPagePrivate)
{
    m_d->m_ui.setupUi(this);
    connect(m_d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
    connect(m_d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));

    connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
    connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated()));
}
예제 #4
0
BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
    QWizardPage(parent),
    d(new BaseCheckoutWizardPagePrivate)
{
    d->ui.setupUi(this);
    d->ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory);
    connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged()));
    connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(validChanged()),
            this, SLOT(slotChanged()));
    connect(d->ui.repositoryLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotRepositoryChanged(QString)));
    connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotDirectoryEdited()));
}
예제 #5
0
BuddyContactsTable::BuddyContactsTable(Buddy buddy, QWidget *parent) :
		QWidget(parent), MyBuddy(buddy)
{
	Delegate = new BuddyContactsTableDelegate(this);
	Model = new BuddyContactsTableModel(buddy, this);
	Proxy = new BuddyContactsTableModelProxy(Model);
	Proxy->setSourceModel(Model);

	connect(Model, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
	connect(Model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(validChanged()));
	connect(Model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(validChanged()));

	createGui();
}
예제 #6
0
void WordChecker::setValid(bool valid)
{
    if(mValid != valid) {
        mValid = valid;
        emit validChanged(mValid);
    }
}
예제 #7
0
FilesPage::FilesPage(QWidget *parent) :
    QWizardPage(parent),
    m_newClassWidget(new Utils::NewClassWidget)
{
    m_newClassWidget->setPathInputVisible(false);
    setTitle(tr("Class Information"));

    QLabel *label = new QLabel(tr("Specify basic information about the classes "
        "for which you want to generate skeleton source code files."));
    label->setWordWrap(true);

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->addWidget(label);
    vlayout->addItem(new QSpacerItem(0, 20));

    vlayout->addWidget(m_newClassWidget);

    vlayout->addItem(new QSpacerItem(0, 20));
    m_errorLabel = new QLabel;
    m_errorLabel->setStyleSheet(QLatin1String("color: red;"));
    vlayout->addWidget(m_errorLabel);
    setLayout(vlayout);

    connect(m_newClassWidget, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
}
ClassNamePage::ClassNamePage(QWidget *parent)
    : QWizardPage(parent)
    , m_isValid(false)
{
    setTitle(tr("Enter Class Name"));
    setSubTitle(tr("The source file name will be derived from the class name"));

    m_newClassWidget.reset(new Utils::NewClassWidget);
    // Order, set extensions first before suggested name is derived
    m_newClassWidget->setClassTypeComboVisible(true);
    m_newClassWidget->setBaseClassChoices(QStringList()
            << QString()
            << QLatin1String("QObject")
            << QLatin1String("QWidget")
            << QLatin1String("QMainWindow")
            << QLatin1String("QDeclarativeItem"));

    m_newClassWidget->setBaseClassEditable(true);
    m_newClassWidget->setFormInputVisible(false);
    m_newClassWidget->setHeaderInputVisible(false);
    m_newClassWidget->setNamespacesEnabled(true);
    m_newClassWidget->setBaseClassInputVisible(true);
    m_newClassWidget->setNamesDelimiter(QLatin1String("."));
    m_newClassWidget->setAllowDirectories(true);

    connect(m_newClassWidget.data(), SIGNAL(validChanged()), this, SLOT(slotValidChanged()));

    QVBoxLayout *pageLayout = new QVBoxLayout(this);
    pageLayout->addWidget(m_newClassWidget.data());
    QSpacerItem *vSpacer = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding);
    pageLayout->addItem(vSpacer);

    initParameters();
}
예제 #9
0
void GraphLayout::invalidate()
{
    if (m_valid) {
        m_valid = false;
        emit validChanged();
    }
}
void QuickDBusReply::setValid(bool arg)
{
    if (m_valid != arg) {
        m_valid = arg;
        emit validChanged();
    }
}
예제 #11
0
FileWizardPage::FileWizardPage(QWidget *parent) :
    WizardPage(parent),
    d(new FileWizardPagePrivate)
{
    d->m_ui.setupUi(this);
    connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
    connect(d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));

    connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
    connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated()));

    setProperty(SHORT_TITLE_PROPERTY, tr("Location"));

    registerFieldWithName(QLatin1String("Path"), d->m_ui.pathChooser, "path", SIGNAL(pathChanged(QString)));
    registerFieldWithName(QLatin1String("FileName"), d->m_ui.nameLineEdit);
}
예제 #12
0
void ModelConsistency::setValid(bool arg)
{
  if (m_valid == arg)
    return;

  m_valid = arg;
  validChanged(arg);
}
예제 #13
0
void NewClassWidget::slotValidChanged()
{
    const bool newValid = isValid();
    if (newValid != d->m_valid) {
        d->m_valid = newValid;
        emit validChanged();
    }
}
예제 #14
0
void PreviewBridge::setValid(bool valid)
{
    if (m_valid == valid) {
        return;
    }
    m_valid = valid;
    emit validChanged();
}
void CMBaseAudioSource::setvalid(bool valid)
{
    if (m_valid == valid)
        return;

    m_valid = valid;
    emit validChanged(valid);
}
예제 #16
0
CustomWizardPage::CustomWizardPage(const QSharedPointer<CustomWizardContext> &ctx,
                                   const QSharedPointer<CustomWizardParameters> &parameters,
                                   QWidget *parent) :
    CustomWizardFieldPage(ctx, parameters, parent),
    m_pathChooser(new Utils::PathChooser)
{
    addRow(tr("Path:"), m_pathChooser);
    connect(m_pathChooser, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
}
예제 #17
0
CustomWizardPage::CustomWizardPage(const QSharedPointer<CustomWizardContext> &ctx,
                                   const QSharedPointer<CustomWizardParameters> &parameters,
                                   QWidget *parent) :
    CustomWizardFieldPage(ctx, parameters, parent),
    m_pathChooser(new Utils::PathChooser)
{
    m_pathChooser->setHistoryCompleter(QLatin1String("PE.ProjectDir.History"));
    addRow(tr("Path:"), m_pathChooser);
    connect(m_pathChooser, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
}
예제 #18
0
GitoriousHostWizardPage::GitoriousHostWizardPage(QWidget *parent) :
    QWizardPage(parent),
    m_widget(createHostWidget())
{
    connect(m_widget, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
    QVBoxLayout *lt = new QVBoxLayout;
    lt->addWidget(m_widget);
    setLayout(lt);
    setTitle(tr("Host"));
    setSubTitle(tr("Select a host."));
}
예제 #19
0
PathChooser::PathChooser(QWidget *parent) :
    QWidget(parent),
    m_d(new PathChooserPrivate(this))
{
    m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);

    connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
    connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString)));
    connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
    connect(m_d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool)));
    connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));

    m_d->m_lineEdit->setMinimumWidth(200);
    m_d->m_hLayout->addWidget(m_d->m_lineEdit);
    m_d->m_hLayout->setSizeConstraint(QLayout::SetMinimumSize);

    addButton(tr(browseButtonLabel), this, SLOT(slotBrowse()));

    setLayout(m_d->m_hLayout);
    setFocusProxy(m_d->m_lineEdit);
    setEnvironment(Environment::systemEnvironment());
}
예제 #20
0
void ActionRootState::setActionName(const QString &actionName)
{
    if (m_actionName != actionName) {
        bool wasValid = valid();

        m_actionName = actionName;
        updateActionState();

        Q_EMIT actionNameChanged();

        if (wasValid != valid()) Q_EMIT validChanged();
    }
}
예제 #21
0
ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
    QWizardPage(parent),
    m_d(new ProjectIntroPagePrivate)
{
    m_d->m_ui.setupUi(this);
    hideStatusLabel();
    m_d->m_ui.nameLineEdit->setInitialText(tr("<Enter_Name>"));
    m_d->m_ui.nameLineEdit->setFocus();
    connect(m_d->m_ui.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged()));
    connect(m_d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged()));
    connect(m_d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged()));
    connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
    connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated()));
}
FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
    QWizardPage(parent),
    m_ui(new Ui::FormClassWizardPage),
    m_isValid(false)
{
    m_ui->setupUi(this);

    m_ui->newClassWidget->setBaseClassInputVisible(false);
    m_ui->newClassWidget->setNamespacesEnabled(true);
    m_ui->newClassWidget->setAllowDirectories(true);
    m_ui->newClassWidget->setClassTypeComboVisible(false);

    connect(m_ui->newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));

    initFileGenerationSettings();
}
void GitoriousProjectWizardPage::initializePage()
{
    // Try to find the page by hostindex
    const int hostIndex = m_hostPage->selectedHostIndex();
    const QString hostName = Gitorious::instance().hostName(hostIndex);
    const int existingStackIndex = stackIndexOf(hostName);
    // Found? - pop up that page
    if (existingStackIndex != -1) {
        m_stackedWidget->setCurrentIndex(existingStackIndex);
        setSubTitle(msgChooseProject(hostName));
        return;
    }
    // Add a new page
    GitoriousProjectWidget *widget = new GitoriousProjectWidget(hostIndex);
    connect(widget, SIGNAL(validChanged()), this, SLOT(slotCheckValid()));
    m_stackedWidget->addWidget(widget);
    m_stackedWidget->setCurrentIndex(m_stackedWidget->count() - 1);
    setSubTitle(msgChooseProject(widget->hostName()));
    slotCheckValid();
}
예제 #24
0
void KKioDrop::setUser(const QString & user, const QString & password,
	const QString & mailbox, const QString & auth )
{
	_kurl->setUser( user );
	_password = password ;
	_kurl->setPass( _password );
	_kurl->setPath( mailbox );
	if( ! auth.isEmpty() && auth != "Plain" )
		(*_metadata)["auth"] = auth;
	else if( _metadata->contains( "auth" ) )
		_metadata->erase( "auth" );

	_valid = _kurl->isValid();
	emit validChanged( valid() );
	
	if( ! _valid )
		kdWarning() << i18n( "url is not valid" ) << endl;
	
	_count->stopActiveCount();
}
예제 #25
0
void GitoriousHostWidget::checkValid(const QModelIndex &index)
{
    if (debug)
        qDebug() << Q_FUNC_INFO << index;
    bool hasSelectedHost = false;
    bool hasProjects = false;
    if (index.isValid()) {
        // Are we on the new dummy item?
        Gitorious &gitorious = Gitorious::instance();
        const int row = index.row();
        hasSelectedHost = row < gitorious.hostCount();
        hasProjects = hasSelectedHost && gitorious.projectCount(row) > 0;
    }
    ui->deleteToolButton->setEnabled(hasSelectedHost);
    ui->browseToolButton->setEnabled(hasSelectedHost);

    const bool valid = hasSelectedHost && hasProjects;
    if (valid != m_isValid) {
        m_isValid = valid;
        emit validChanged();
    }
}
예제 #26
0
void ActionRootState::setActionGroup(QDBusActionGroup *actionGroup)
{
    if (m_actionGroup != actionGroup) {
        bool wasValid = valid();

        if (m_actionGroup) {
            disconnect(m_actionGroup, 0, this, 0);
        }
        m_actionGroup = actionGroup;

        if (m_actionGroup) {
            connect(m_actionGroup, &QDBusActionGroup::statusChanged, this, [&](bool) { updateActionState(); });
            connect(m_actionGroup, &QDBusActionGroup::actionAppear, this, [&](const QString&) { updateActionState(); });
            connect(m_actionGroup, &QDBusActionGroup::actionVanish, this, [&](const QString&) { updateActionState(); });
            connect(m_actionGroup, &QDBusActionGroup::actionStateChanged, this, [&](QVariant) { updateActionState(); });

            connect(m_actionGroup, &QObject::destroyed, this, [&](QObject*) { updateActionState(); });
        }
        updateActionState();
        Q_EMIT actionGroupChanged();

        if (wasValid != valid()) Q_EMIT validChanged();
    }
}
예제 #27
0
void GraphLayout::call()
{
    if (m_valid) {
        return;
    }
    try {
        m_layout->call(*m_attributes);
        m_valid = true;
        emit validChanged();
    } catch (ogdf::AlgorithmFailureException &e) {
        QString reason = QString("of an unknown reason (%1)").arg(e.exceptionCode());
        switch (e.exceptionCode()) {
        case ogdf::afcUnknown:
            // Do nothing.
            break;
        case ogdf::afcIllegalParameter:
            reason = "of an illegal parameter";
            break;
        case ogdf::afcNoFlow:
            reason = "min-cost flow solver could not find a legal flow";
            break;
        case ogdf::afcSort:
            reason = "sequence is not sorted";
            break;
        case ogdf::afcLabel:
            reason = "labelling failed";
            break;
        case ogdf::afcExternalFace:
            reason = "external face is not correct";
            break;
        case ogdf::afcForbiddenCrossing:
            reason = "crossing were forbidden";
            break;
        case ogdf::afcTimelimitExceeded:
            reason = "timelimit exceeded";
            break;
        case ogdf::afcNoSolutionFound:
            reason = "it could not find a solution";
            break;
        case ogdf::afcSTOP:
            // Do nothing.
            break;
        }
        qmlInfo(this) << "Layout algorithm failed, because " << reason;
    } catch (ogdf::PreconditionViolatedException &e) {
        QString reason = QString("An unknown reason (%1)").arg(e.exceptionCode());
        switch (e.exceptionCode()) {
        case ogdf::pvcUnknown:
            // Do nothing.
            break;
        case ogdf::pvcSelfLoop:
            reason = "Graph contains a self-loop, which";
            break;
        case ogdf::pvcTreeHierarchies:
            reason = "Graph is not a tree, which";
            break;
        case ogdf::pvcAcyclicHierarchies:
            reason = "Graph is not acyclic, which";
            break;
        case ogdf::pvcSingleSource:
            reason = "Graph has not a single source, which";
            break;
        case ogdf::pvcUpwardPlanar:
            reason = "Graph is not upward planar, which";
            break;
        case ogdf::pvcTree:
            reason = "Graph is not a rooted tree, which";
            break;
        case ogdf::pvcForest:
            reason = "Graph is not a rooted forest, which";
            break;
        case ogdf::pvcOrthogonal:
            reason = "Layout is not orthogonal, which";
            break;
        case ogdf::pvcPlanar:
            reason = "Graph is not planar, which";
            break;
        case ogdf::pvcClusterPlanar:
            reason = "Graph is not cluster planar, which";
            break;
        case ogdf::pvcNoCopy:
            reason = "Graph is not a copy of the corresponding graph, which";
            break;
        case ogdf::pvcConnected:
            reason = "Graph is not connected, which";
            break;
        case ogdf::pvcBiconnected:
            reason = "Graph is not twoconnected, which";
            break;
        case ogdf::pvcSTOP:
            // Do nothing.
            break;
        }
        qmlInfo(this) << reason << " violates layout preconditions";
    } catch (ogdf::Exception &) {
        qmlInfo(this) << "OGDF exception caught";
    } catch (...) {
        qmlInfo(this) << "Unknown exception caught";
    }
}
예제 #28
0
void SettingWidget::slotWidgetChanged()
{
    Q_EMIT validChanged(isValid());
}
예제 #29
0
void IconItem::setSource(const QVariant &source)
{
    if (source == m_source) {
        return;
    }

    m_source = source;
    QString sourceString = source.toString();

    // If the QIcon was created with QIcon::fromTheme(), try to load it as svg
    if (source.canConvert<QIcon>() && !source.value<QIcon>().name().isEmpty()) {
        sourceString = source.value<QIcon>().name();
    }

    if (!sourceString.isEmpty()) {
        //If a url in the form file:// is passed, take the image pointed by that from disk
        QUrl url(sourceString);
        if (url.isLocalFile()) {
            m_icon = QIcon();
            m_imageIcon = QImage(url.path());
            m_svgIconName.clear();
            delete m_svgIcon;
            m_svgIcon = 0;
        } else {
            if (!m_svgIcon) {
                m_svgIcon = new Plasma::Svg(this);
                m_svgIcon->setColorGroup(m_colorGroup);
                m_svgIcon->setStatus(m_status);
                m_svgIcon->setDevicePixelRatio((window() ? window()->devicePixelRatio() : qApp->devicePixelRatio()));
                connect(m_svgIcon, &Plasma::Svg::repaintNeeded, this, &IconItem::schedulePixmapUpdate);
            }

            if (m_usesPlasmaTheme) {
                //try as a svg icon from plasma theme
                m_svgIcon->setImagePath(QLatin1String("icons/") + sourceString.split('-').first());
                m_svgIcon->setContainsMultipleImages(true);
            }

            //success?
            if (m_svgIcon->isValid() && m_svgIcon->hasElement(sourceString)) {
                m_icon = QIcon();
                m_svgIconName = sourceString;

                //ok, svg not available from the plasma theme
            } else {
                //try to load from iconloader an svg with Plasma::Svg
                const auto *iconTheme = KIconLoader::global()->theme();
                QString iconPath;
                if (iconTheme) {
                    iconPath = iconTheme->iconPath(sourceString + QLatin1String(".svg"), qMin(width(), height()), KIconLoader::MatchBest);
                    if (iconPath.isEmpty()) {
                        iconPath = iconTheme->iconPath(sourceString + QLatin1String(".svgz"), qMin(width(), height()), KIconLoader::MatchBest);
                    }
                } else {
                    qWarning() << "KIconLoader has no theme set";
                }

                if (!iconPath.isEmpty()) {
                    m_svgIcon->setImagePath(iconPath);
                    m_svgIconName = sourceString;
                //fail, use QIcon
                } else {
                    m_icon = QIcon::fromTheme(sourceString);
                    if (m_icon.isNull()) {
                        // fallback for non-theme icons
                        m_icon = source.value<QIcon>();
                    }
                    m_svgIconName.clear();
                    delete m_svgIcon;
                    m_svgIcon = 0;
                    m_imageIcon = QImage();
                }
            }
        }

    } else if (source.canConvert<QIcon>()) {
        m_icon = source.value<QIcon>();
        m_imageIcon = QImage();
        m_svgIconName.clear();
        delete m_svgIcon;
        m_svgIcon = 0;
    } else if (source.canConvert<QImage>()) {
        m_icon = QIcon();
        m_imageIcon = source.value<QImage>();
        m_svgIconName.clear();
        delete m_svgIcon;
        m_svgIcon = 0;

    } else {
        m_icon = QIcon();
        m_imageIcon = QImage();
        m_svgIconName.clear();
        delete m_svgIcon;
        m_svgIcon = 0;
    }

    if (width() > 0 && height() > 0) {
        schedulePixmapUpdate();
    }

    emit sourceChanged();
    emit validChanged();
}