예제 #1
0
void KKbdAccessExtensions::displayAccessKeys()
{
    // Build a list of valid access keys that don't collide with shortcuts.
    QString availableAccessKeys = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890";
    QPtrList<KXMLGUIClient> allClients = d->mainWindow->factory()->clients();
    QPtrListIterator<KXMLGUIClient> it( allClients );
    KXMLGUIClient *client;
    while( (client=it.current()) !=0 )
    {
        ++it;
        KActionPtrList actions = client->actionCollection()->actions();
        for (int j = 0; j < (int)actions.count(); j++) {
            KAction* action = actions[j];
            KShortcut sc = action->shortcut();
            for (int i = 0; i < (int)sc.count(); i++) {
                KKeySequence seq = sc.seq(i);
                if (seq.count() == 1) {
                    QString s = seq.toString();
                    if (availableAccessKeys.contains(s))
                        availableAccessKeys.remove(s);
                }
            }
        }
    }
    // Find all visible, focusable widgets and create a QLabel for each.  Don't exceed
    // available list of access keys.
    QWidgetList* allWidgets = kapp->allWidgets();
    QWidget* widget = allWidgets->first();
    int accessCount = 0;
    int maxAccessCount = availableAccessKeys.length();
    int overlap = 20;
    QPoint prevGlobalPos = QPoint(-overlap, -overlap);
    while (widget && (accessCount < maxAccessCount)) {
        if (widget->isVisible() && widget->isFocusEnabled() ) {
            QRect r = widget->rect();
            QPoint p(r.x(), r.y());
            // Don't display an access key if within overlap pixels of previous one.
            QPoint globalPos = widget->mapToGlobal(p);
            QPoint diffPos = globalPos - prevGlobalPos;
            if (diffPos.manhattanLength() > overlap) {
                accessCount++;
                QLabel* lab=new QLabel(widget, "", widget, 0, Qt::WDestructiveClose);
                lab->setPalette(QToolTip::palette());
                lab->setLineWidth(2);
                lab->setFrameStyle(QFrame::Box | QFrame::Plain);
                lab->setMargin(3);
                lab->adjustSize();
                lab->move(p);
                if (!d->accessKeyLabels) {
                    d->accessKeyLabels = new QPtrList<QLabel>;
                    d->accessKeyLabels->setAutoDelete(true);
                }
                d->accessKeyLabels->append(lab);
                prevGlobalPos = globalPos;
            }
        }
        widget = allWidgets->next();
    }
    if (accessCount > 0) {
        // Sort the access keys from left to right and down the screen.
        QValueList<KSortedLabel> sortedLabels;
        for (int i = 0; i < accessCount; i++)
            sortedLabels.append(KSortedLabel(d->accessKeyLabels->at(i)));
        qHeapSort( sortedLabels );
        // Assign access key labels.
        for (int i = 0; i < accessCount; i++) {
            QLabel* lab = sortedLabels[i].label();
            QChar s = availableAccessKeys[i];
            lab->setText(s);
            lab->adjustSize();
            lab->show();
        }
    }
}
StandardsInformationMaterialWidget::StandardsInformationMaterialWidget(bool isIP, QGridLayout * mainGridLayout, int & row)
  : QWidget(mainGridLayout->parentWidget())
{
  QVBoxLayout * vLayout = nullptr;

  QLabel * label = nullptr;

  bool isConnected = false;

  // Measure Tags
  QFrame * line;
  line = new QFrame();
  line->setFrameShape(QFrame::HLine);
  line->setFrameShadow(QFrame::Sunken);
  mainGridLayout->addWidget(line, row++, 0, 1, 3);

  label = new QLabel();
  label->setText("Measure Tags (Optional):");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label, row++, 0);

  // Standard
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Standard: ");
  label->setObjectName("StandardsInfo");
  vLayout->addWidget(label);

  m_standard = new QComboBox();
  m_standard->setEditable(true);
  m_standard->setDuplicatesEnabled(false);
  m_standard->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_standard);

  mainGridLayout->addLayout(vLayout, row, 0);

  isConnected = connect(m_standard, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::standardChanged);
  OS_ASSERT(isConnected);

  // Standard Source
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Standard Source: ");
  label->setObjectName("StandardsInfo");
  vLayout->addWidget(label);

  m_standardSource = new QComboBox();
  m_standardSource->setEditable(true);
  m_standardSource->setDuplicatesEnabled(false);
  m_standardSource->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_standardSource);

  mainGridLayout->addLayout(vLayout, row++, 1);

  isConnected = connect(m_standardSource, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::standardSourceChanged);
  OS_ASSERT(isConnected);

  // Standards Category
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Standards Category: ");
  label->setObjectName("StandardsInfo");
  vLayout->addWidget(label);

  m_standardsCategory = new QComboBox();
  m_standardsCategory->setEditable(true);
  m_standardsCategory->setDuplicatesEnabled(false);
  m_standardsCategory->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_standardsCategory);

  mainGridLayout->addLayout(vLayout, row, 0);

  isConnected = connect(m_standardsCategory, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::standardsCategoryChanged);
  OS_ASSERT(isConnected);

  // Standards Identifier
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Standards Identifier: ");
  label->setObjectName("StandardsInfo");
  vLayout->addWidget(label);

  m_standardsIdentifier = new QComboBox();
  m_standardsIdentifier->setEditable(true);
  m_standardsIdentifier->setDuplicatesEnabled(false);
  m_standardsIdentifier->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_standardsIdentifier);

  mainGridLayout->addLayout(vLayout, row++, 1);

  isConnected = connect(m_standardsIdentifier, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::standardsIdentifierChanged);
  OS_ASSERT(isConnected);

  // Composite Framing Material
  vLayout = new QVBoxLayout();

  m_compositeFramingMaterialLabel = new QLabel();
  m_compositeFramingMaterialLabel->setText("Composite Framing Material: ");
  m_compositeFramingMaterialLabel->setObjectName("StandardsInfo");
  vLayout->addWidget(m_compositeFramingMaterialLabel);

  m_compositeFramingMaterial = new QComboBox();
  m_compositeFramingMaterial->setEditable(true);
  m_compositeFramingMaterial->setDuplicatesEnabled(false);
  m_compositeFramingMaterial->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_compositeFramingMaterial);

  mainGridLayout->addLayout(vLayout, row, 0);

  isConnected = connect(m_compositeFramingMaterial, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::compositeFramingMaterialChanged);
  OS_ASSERT(isConnected);

  // Composite Framing Configuration
  vLayout = new QVBoxLayout();

  m_compositeFramingConfigurationLabel = new QLabel();
  m_compositeFramingConfigurationLabel->setText("Composite Framing Configuration: ");
  m_compositeFramingConfigurationLabel->setObjectName("StandardsInfo");
  vLayout->addWidget(m_compositeFramingConfigurationLabel);

  m_compositeFramingConfiguration = new QComboBox();
  m_compositeFramingConfiguration->setEditable(true);
  m_compositeFramingConfiguration->setDuplicatesEnabled(false);
  m_compositeFramingConfiguration->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_compositeFramingConfiguration);

  mainGridLayout->addLayout(vLayout, row++, 1);

  isConnected = connect(m_compositeFramingConfiguration, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::compositeFramingConfigurationChanged);
  OS_ASSERT(isConnected);

  // Composite Framing Depth
  vLayout = new QVBoxLayout();

  m_compositeFramingDepthLabel = new QLabel();
  m_compositeFramingDepthLabel->setText("Composite Framing Depth: ");
  m_compositeFramingDepthLabel->setObjectName("StandardsInfo");
  vLayout->addWidget(m_compositeFramingDepthLabel);

  m_compositeFramingDepth = new QComboBox();
  m_compositeFramingDepth->setEditable(true);
  m_compositeFramingDepth->setDuplicatesEnabled(false);
  m_compositeFramingDepth->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_compositeFramingDepth);

  mainGridLayout->addLayout(vLayout, row, 0);

  isConnected = connect(m_compositeFramingDepth, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::compositeFramingDepthChanged);
  OS_ASSERT(isConnected);

  // Composite Framing Size
  vLayout = new QVBoxLayout();

  m_compositeFramingSizeLabel = new QLabel();
  m_compositeFramingSizeLabel->setText("Composite Framing Size: ");
  m_compositeFramingSizeLabel->setObjectName("StandardsInfo");
  vLayout->addWidget(m_compositeFramingSizeLabel);

  m_compositeFramingSize = new QComboBox();
  m_compositeFramingSize->setEditable(true);
  m_compositeFramingSize->setDuplicatesEnabled(false);
  m_compositeFramingSize->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_compositeFramingSize);

  mainGridLayout->addLayout(vLayout, row++, 1);

  isConnected = connect(m_compositeFramingSize, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::compositeFramingSizeChanged);
  OS_ASSERT(isConnected);

  // Composite Cavity Insulation
  vLayout = new QVBoxLayout();

  m_compositeCavityInsulationLabel = new QLabel();
  m_compositeCavityInsulationLabel->setText("Composite Cavity Insulation: ");
  m_compositeCavityInsulationLabel->setObjectName("StandardsInfo");
  vLayout->addWidget(m_compositeCavityInsulationLabel);

  m_compositeCavityInsulation = new QComboBox();
  m_compositeCavityInsulation->setEditable(true);
  m_compositeCavityInsulation->setDuplicatesEnabled(false);
  m_compositeCavityInsulation->setFixedWidth(OSItem::ITEM_WIDTH);
  vLayout->addWidget(m_compositeCavityInsulation);

  mainGridLayout->addLayout(vLayout, row++, 0);

  isConnected = connect(m_compositeCavityInsulation, &QComboBox::currentTextChanged, this, &openstudio::StandardsInformationMaterialWidget::compositeCavityInsulationChanged);
  OS_ASSERT(isConnected);

  line = new QFrame();
  line->setFrameShape(QFrame::HLine);
  line->setFrameShadow(QFrame::Sunken);
  mainGridLayout->addWidget(line, row++, 0, 1, 3);

  hideComposite();
}
예제 #3
0
SplitterGUI::SplitterGUI(QWidget* parent,  QUrl fileURL, QUrl defaultDir) :
        QDialog(parent),
        userDefinedSize(0x100000), lastSelectedDevice(-1), resultCode(QDialog::Rejected),
        division(1)
{
    setModal(true);

    QGridLayout *grid = new QGridLayout(this);
    grid->setSpacing(6);
    grid->setContentsMargins(11, 11, 11, 11);

    QLabel *splitterLabel = new QLabel(this);
    splitterLabel->setText(i18n("Split the file %1 to folder:", fileURL.toDisplayString(QUrl::PreferLocalFile)));
    splitterLabel->setMinimumWidth(400);
    grid->addWidget(splitterLabel, 0 , 0);

    urlReq = new KUrlRequester(this);
    urlReq->setUrl(defaultDir);
    urlReq->setMode(KFile::Directory);
    grid->addWidget(urlReq, 1 , 0);

    QWidget *splitSizeLine = new QWidget(this);
    QHBoxLayout * splitSizeLineLayout = new QHBoxLayout;
    splitSizeLineLayout->setContentsMargins(0, 0, 0, 0);
    splitSizeLine->setLayout(splitSizeLineLayout);

    deviceCombo = new QComboBox(splitSizeLine);
    for (int i = 0; i != predefinedDevices().count(); i++)
        deviceCombo->addItem(predefinedDevices()[i].name);
    deviceCombo->addItem(i18n("User Defined"));
    splitSizeLineLayout->addWidget(deviceCombo);

    QLabel *spacer = new QLabel(splitSizeLine);
    spacer->setText(" ");
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    splitSizeLineLayout->addWidget(spacer);

    QLabel *bytesPerFile = new QLabel(splitSizeLine);
    bytesPerFile->setText(i18n("Max file size:"));
    splitSizeLineLayout->addWidget(bytesPerFile);

    spinBox = new QDoubleSpinBox(splitSizeLine);
    spinBox->setMaximum(9999999999.0);
    spinBox->setMinimumWidth(85);
    spinBox->setEnabled(false);
    splitSizeLineLayout->addWidget(spinBox);

    sizeCombo = new QComboBox(splitSizeLine);
    sizeCombo->addItem(i18n("Byte"));
    sizeCombo->addItem(i18n("kByte"));
    sizeCombo->addItem(i18n("MByte"));
    sizeCombo->addItem(i18n("GByte"));
    splitSizeLineLayout->addWidget(sizeCombo);

    grid->addWidget(splitSizeLine, 2 , 0);

    overwriteCb = new QCheckBox(i18n("Overwrite files without confirmation"), this);
    grid->addWidget(overwriteCb, 3, 0);

    QFrame *separator = new QFrame(this);
    separator->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    separator->setFixedHeight(separator->sizeHint().height());

    grid->addWidget(separator, 4 , 0);

    QHBoxLayout *splitButtons = new QHBoxLayout;
    splitButtons->setSpacing(6);
    splitButtons->setContentsMargins(0, 0, 0, 0);

    QSpacerItem* spacer2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    splitButtons->addItem(spacer2);

    QPushButton *splitBtn = new QPushButton(this);
    splitBtn->setText(i18n("&Split"));
    splitBtn->setIcon(QIcon::fromTheme("dialog-ok"));
    splitButtons->addWidget(splitBtn);

    QPushButton *cancelBtn = new QPushButton(this);
    cancelBtn->setText(i18n("&Cancel"));
    cancelBtn->setIcon(QIcon::fromTheme("dialog-cancel"));
    splitButtons->addWidget(cancelBtn);

    grid->addLayout(splitButtons, 5 , 0);

    setWindowTitle(i18n("Krusader::Splitter"));


    KConfigGroup cfg(KSharedConfig::openConfig(), QStringLiteral("Splitter"));
    overwriteCb->setChecked(cfg.readEntry("OverWriteFiles", false));

    connect(sizeCombo, SIGNAL(activated(int)), this, SLOT(sizeComboActivated(int)));
    connect(deviceCombo, SIGNAL(activated(int)), this, SLOT(predefinedComboActivated(int)));
    connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
    connect(splitBtn , SIGNAL(clicked()), this, SLOT(splitPressed()));

    predefinedComboActivated(0);
    resultCode = exec();
}
예제 #4
0
QLayout * PageScheme::bodyLayoutDefinition()
{
    QGridLayout * pageLayout = new QGridLayout();
    QGroupBox * gb = new QGroupBox(this);

    QGridLayout * gl = new QGridLayout();
    gb->setLayout(gl);
    QSizePolicy sp;
    sp.setVerticalPolicy(QSizePolicy::MinimumExpanding);
    sp.setHorizontalPolicy(QSizePolicy::Expanding);

    pageLayout->addWidget(gb, 1,0,13,5);

    gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb);
    gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb);

    // TODO name stuff and put CSS into main style sheet
    gbGameModes->setStyleSheet(".QGroupBox {"
                               "background-color: #130f2c; background-image:url();"
                               "}");
    gbBasicSettings->setStyleSheet(".QGroupBox {"
                                   "background-color: #130f2c; background-image:url();"
                                   "}");

    gbGameModes->setSizePolicy(sp);
    gbBasicSettings->setSizePolicy(sp);
    gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop);
    gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop);

    QGridLayout * glGMLayout = new QGridLayout(gbGameModes);
    QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings);
    gbGameModes->setLayout(glGMLayout);
    gbBasicSettings->setLayout(glBSLayout);
    // Left

    TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_mode_Forts->setWhatsThis(tr("Defend your fort and destroy the opponents, two team colours max!"));
    glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);

    TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_teamsDivide->setWhatsThis(tr("Teams will start on opposite sides of the terrain, two team colours max!"));
    glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1);

    TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_solid->setWhatsThis(tr("Land can not be destroyed!"));
    glGMLayout->addWidget(TBW_solid,0,2,1,1);

    TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_border->setWhatsThis(tr("Add an indestructible border around the terrain"));
    glGMLayout->addWidget(TBW_border,0,3,1,1);

    TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_lowGravity->setWhatsThis(tr("Lower gravity"));
    glGMLayout->addWidget(TBW_lowGravity,0,4,1,1);

    TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_laserSight->setWhatsThis(tr("Assisted aiming with laser sight"));
    glGMLayout->addWidget(TBW_laserSight,1,0,1,1);

    TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_invulnerable->setWhatsThis(tr("All hogs have a personal forcefield"));
    glGMLayout->addWidget(TBW_invulnerable,1,1,1,1);

    TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_resethealth->setWhatsThis(tr("All (living) hedgehogs are fully restored at the end of turn"));
    glGMLayout->addWidget(TBW_resethealth,1,2,1,1);

    TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_vampiric->setWhatsThis(tr("Gain 80% of the damage you do back in health"));
    glGMLayout->addWidget(TBW_vampiric,1,3,1,1);

    TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_karma->setWhatsThis(tr("Share your opponents pain, share their damage"));
    glGMLayout->addWidget(TBW_karma,1,4,1,1);

    TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_artillery->setWhatsThis(tr("Your hogs are unable to move, put your artillery skills to the test"));
    glGMLayout->addWidget(TBW_artillery,2,0,1,1);

    TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_randomorder->setWhatsThis(tr("Order of play is random instead of in room order."));
    glGMLayout->addWidget(TBW_randomorder,2,1,1,1);

    TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_king->setWhatsThis(tr("Play with a King. If he dies, your side dies."));
    glGMLayout->addWidget(TBW_king,2,2,1,1);

    TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_placehog->setWhatsThis(tr("Take turns placing your hedgehogs before the start of play."));
    glGMLayout->addWidget(TBW_placehog,2,3,1,1);

    TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_sharedammo->setWhatsThis(tr("Ammo is shared between all teams that share a colour."));
    glGMLayout->addWidget(TBW_sharedammo,2,4,1,1);

    TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_disablegirders->setWhatsThis(tr("Disable girders when generating random maps."));
    glGMLayout->addWidget(TBW_disablegirders,3,0,1,1);

    TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_disablelandobjects->setWhatsThis(tr("Disable land objects when generating random maps."));
    glGMLayout->addWidget(TBW_disablelandobjects,3,1,1,1);

    TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_aisurvival->setWhatsThis(tr("AI respawns on death."));
    glGMLayout->addWidget(TBW_aisurvival,3,2,1,1);

    TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_infattack->setWhatsThis(tr("Attacking does not end your turn."));
    glGMLayout->addWidget(TBW_infattack,3,3,1,1);

    TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_resetweps->setWhatsThis(tr("Weapons are reset to starting values each turn."));
    glGMLayout->addWidget(TBW_resetweps,3,4,1,1);

    TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_perhogammo->setWhatsThis(tr("Each hedgehog has its own ammo. It does not share with the team."));
    glGMLayout->addWidget(TBW_perhogammo,4,0,1,1);

    TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_nowind->setWhatsThis(tr("You will not have to worry about wind anymore."));
    glGMLayout->addWidget(TBW_nowind,4,1,1,1);

    TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_morewind->setWhatsThis(tr("Wind will affect almost everything."));
    glGMLayout->addWidget(TBW_morewind,4,2,1,1);

    TBW_tagteam = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_tagteam->setWhatsThis(tr("Teams in each clan take successive turns sharing their turn time."));
    glGMLayout->addWidget(TBW_tagteam,4,3,1,1);

    TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/[email protected]");
    TBW_bottomborder->setWhatsThis(tr("Add an indestructible border along the bottom"));
    glGMLayout->addWidget(TBW_bottomborder,4,4,1,1);


    // Right
    QLabel * l;

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Damage Modifier"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,0,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconDamage.png"));
    glBSLayout->addWidget(l,0,1,1,1);
    SB_DamageModifier = new QSpinBox(gbBasicSettings);
    SB_DamageModifier->setRange(10, 300);
    SB_DamageModifier->setValue(100);
    SB_DamageModifier->setSingleStep(25);
    glBSLayout->addWidget(SB_DamageModifier,0,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Turn Time"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,1,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconTime.png"));
    glBSLayout->addWidget(l,1,1,1,1);
    SB_TurnTime = new QSpinBox(gbBasicSettings);
    SB_TurnTime->setRange(1, 9999);
    SB_TurnTime->setValue(45);
    SB_TurnTime->setSingleStep(15);
    glBSLayout->addWidget(SB_TurnTime,1,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Initial Health"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,2,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconHealth.png"));
    glBSLayout->addWidget(l,2,1,1,1);
    SB_InitHealth = new QSpinBox(gbBasicSettings);
    SB_InitHealth->setRange(50, 200);
    SB_InitHealth->setValue(100);
    SB_InitHealth->setSingleStep(25);
    glBSLayout->addWidget(SB_InitHealth,2,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Sudden Death Timeout"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,3,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconSuddenDeath.png"));
    glBSLayout->addWidget(l,3,1,1,1);
    SB_SuddenDeath = new QSpinBox(gbBasicSettings);
    SB_SuddenDeath->setRange(0, 50);
    SB_SuddenDeath->setValue(15);
    SB_SuddenDeath->setSingleStep(3);
    glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Sudden Death Water Rise"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,4,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon
    glBSLayout->addWidget(l,4,1,1,1);
    SB_WaterRise = new QSpinBox(gbBasicSettings);
    SB_WaterRise->setRange(0, 100);
    SB_WaterRise->setValue(47);
    SB_WaterRise->setSingleStep(5);
    glBSLayout->addWidget(SB_WaterRise,4,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Sudden Death Health Decrease"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,5,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon
    glBSLayout->addWidget(l,5,1,1,1);
    SB_HealthDecrease = new QSpinBox(gbBasicSettings);
    SB_HealthDecrease->setRange(0, 100);
    SB_HealthDecrease->setValue(5);
    SB_HealthDecrease->setSingleStep(1);
    glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("% Rope Length"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,6,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconRope.png"));
    glBSLayout->addWidget(l,6,1,1,1);
    SB_RopeModifier = new QSpinBox(gbBasicSettings);
    SB_RopeModifier->setRange(25, 999);
    SB_RopeModifier->setValue(100);
    SB_RopeModifier->setSingleStep(25);
    glBSLayout->addWidget(SB_RopeModifier,6,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Crate Drops"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,7,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconBox.png"));
    glBSLayout->addWidget(l,7,1,1,1);
    SB_CaseProb = new FreqSpinBox(gbBasicSettings);
    SB_CaseProb->setRange(0, 9);
    SB_CaseProb->setValue(5);
    glBSLayout->addWidget(SB_CaseProb,7,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("% Health Crates"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,8,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon
    glBSLayout->addWidget(l,8,1,1,1);
    SB_HealthCrates = new QSpinBox(gbBasicSettings);
    SB_HealthCrates->setRange(0, 100);
    SB_HealthCrates->setValue(35);
    SB_HealthCrates->setSingleStep(5);
    glBSLayout->addWidget(SB_HealthCrates,8,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Health in Crates"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,9,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon
    glBSLayout->addWidget(l,9,1,1,1);
    SB_CrateHealth = new QSpinBox(gbBasicSettings);
    SB_CrateHealth->setRange(0, 200);
    SB_CrateHealth->setValue(25);
    SB_CrateHealth->setSingleStep(5);
    glBSLayout->addWidget(SB_CrateHealth,9,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Mines Time"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,10,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon
    glBSLayout->addWidget(l,10,1,1,1);
    SB_MinesTime = new QSpinBox(gbBasicSettings);
    SB_MinesTime->setRange(-1, 5);
    SB_MinesTime->setValue(3);
    SB_MinesTime->setSingleStep(1);
    SB_MinesTime->setSpecialValueText(tr("Random"));
    SB_MinesTime->setSuffix(" "+ tr("Seconds"));
    glBSLayout->addWidget(SB_MinesTime,10,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Mines"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,11,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon
    glBSLayout->addWidget(l,11,1,1,1);
    SB_Mines = new QSpinBox(gbBasicSettings);
    SB_Mines->setRange(0, 200);
    SB_Mines->setValue(0);
    SB_Mines->setSingleStep(5);
    glBSLayout->addWidget(SB_Mines,11,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("% Dud Mines"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,12,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconDud.png"));
    glBSLayout->addWidget(l,12,1,1,1);
    SB_MineDuds = new QSpinBox(gbBasicSettings);
    SB_MineDuds->setRange(0, 100);
    SB_MineDuds->setValue(0);
    SB_MineDuds->setSingleStep(5);
    glBSLayout->addWidget(SB_MineDuds,12,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Explosives"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,13,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconDamage.png"));
    glBSLayout->addWidget(l,13,1,1,1);
    SB_Explosives = new QSpinBox(gbBasicSettings);
    SB_Explosives->setRange(0, 200);
    SB_Explosives->setValue(0);
    SB_Explosives->setSingleStep(3);
    glBSLayout->addWidget(SB_Explosives,13,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("% Get Away Time"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,14,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconTime.png"));
    glBSLayout->addWidget(l,14,1,1,1);
    SB_GetAwayTime = new QSpinBox(gbBasicSettings);
    SB_GetAwayTime->setRange(0, 999);
    SB_GetAwayTime->setValue(100);
    SB_GetAwayTime->setSingleStep(25);
    glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1);

    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("World Edge"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,15,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconEarth.png"));
    glBSLayout->addWidget(l,15,1,1,1);

    CB_WorldEdge = new QComboBox(gbBasicSettings);
    CB_WorldEdge->insertItem(0, tr("None (Default)"));
    CB_WorldEdge->insertItem(1, tr("Wrap (World wraps)"));
    CB_WorldEdge->insertItem(2, tr("Bounce (Edges reflect)"));
    CB_WorldEdge->insertItem(3, tr("Sea (Edges connect to sea)"));
    /* CB_WorldEdge->insertItem(4, tr("Skybox")); */
    glBSLayout->addWidget(CB_WorldEdge,15,2,1,1);


    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Script parameter"));
    l->setWordWrap(true);
    glBSLayout->addWidget(l,16,0,1,1);
    l = new QLabel(gbBasicSettings);
    l->setFixedSize(32,32);
    l->setPixmap(QPixmap(":/res/iconBox.png"));
    glBSLayout->addWidget(l,16,1,1,1);

    LE_ScriptParam = new QLineEdit(gbBasicSettings);
    LE_ScriptParam->setMaxLength(240);
    glBSLayout->addWidget(LE_ScriptParam,16,2,1,1);


    l = new QLabel(gbBasicSettings);
    l->setText(QLabel::tr("Scheme Name:"));

    LE_name = new QLineEdit(this);

    gl->addWidget(LE_name,15,1,1,5);
    gl->addWidget(l,15,0,1,1);

    return pageLayout;
}
예제 #5
0
AboutDialog::AboutDialog(QWidget *parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
	setWindowTitle(tr("About"));
	setWindowIcon(QIcon(":/res/hn_logo.png"));
	setFixedSize(350, 230);
	
	
	QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
	
	
	QLabel *lblLogo = new QLabel(this);
	QImage image(":res/hn_logo.png");
	lblLogo->setPixmap(QPixmap::fromImage(image));
	
	
	QLabel *lblProjectname = new QLabel("<qt><b><font size=+3>Vale Do Poker</font></b></qt>", this);
	
	
	QLabel *lblVersion = new QLabel("<qt><b>" +
					tr("v. %1.%2.%3")
						.arg(VERSION_MAJOR)
						.arg(VERSION_MINOR)
						.arg(VERSION_REVISION) + "</b> <i>(" +
						QString("SVN %1").arg(VERSIONSTR_SVN) + 
					")</i></qt>",
					 this);
	
	
	QLabel *lblLicense = new QLabel(tr("protegido pela GPLv3"));
	
	QLabel *lblCopyright = new QLabel("Software baseado nos trabalhos do time &\nHoldingNuts.", this);
	
	QLabel *lblWebsite = new QLabel(this);
	lblWebsite->setText("<qt><a href=\"http://www.valedopoker.net/\">http://www.valedopoker.net/</a></qt>");
	connect(lblWebsite, SIGNAL(linkActivated(const QString&)), this, SLOT(actionHyperlink(const QString&)));
	
	
	QLabel *lblMail = new QLabel(this);
	lblMail->setText("<qt><a href=\"mailto:[email protected]\">[email protected]</a></qt>");
	connect(lblMail, SIGNAL(linkActivated(const QString&)), this, SLOT(actionHyperlink(const QString&)));
	
	
	QVBoxLayout *contentLayout = new QVBoxLayout;
	contentLayout->addWidget(lblProjectname);
	contentLayout->addWidget(lblVersion);
	contentLayout->addWidget(lblLicense);
	contentLayout->addWidget(lblCopyright);
	contentLayout->addWidget(lblWebsite);
	contentLayout->addWidget(lblMail);
	
	QHBoxLayout *baseLayout = new QHBoxLayout;
	baseLayout->addWidget(lblLogo, 30, Qt::AlignHCenter | Qt::AlignTop);
	baseLayout->addLayout(contentLayout, 70);
	
	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(baseLayout);
	mainLayout->addWidget(buttonBox, 0, Qt::AlignBottom);
	setLayout(mainLayout);
}
예제 #6
0
OverviewWidget::OverviewWidget(QWidget* parent, NetworkEvaluator* networkEval)
    : QWidget(parent)
    , duration_(1200)
    , zoom_(1)
    , viewportWidth_(500)
    , scrollBarPosition_(0)
    , canvasRenderer_(0)
    , networkEvaluator_(networkEval)
    , currentFrame_(0)
    , fps_(30)
    , autoPreview_(false)
{
    canvasRenderer_ = 0;
    previews_.clear();
    QHBoxLayout* mainLayout = new QHBoxLayout(this);

    mainLayout->setMargin(1);
    mainLayout->setSpacing(1);
    setFixedHeight(110);

    overviewScene_ = new QGraphicsScene(this);

    overviewView_ = new OverviewView(overviewScene_, this);

    highlightBar_ = new QGraphicsRectItem();
    overviewView_->setBar(highlightBar_);
    highlightBar_->setZValue(2);
    highlightBar_->setPen(QPen(Qt::DotLine));
    QLinearGradient gradient1(0,0,0, 40 );
    gradient1.setSpread(QGradient::ReflectSpread);
    gradient1.setColorAt(0.0, QColor(20, 100 ,100, 30));
    gradient1.setColorAt(1.0, QColor(80, 100 ,100, 30));
    QBrush brush(gradient1);
    highlightBar_->setBrush(gradient1);
    overviewScene_->addItem(highlightBar_);
    highlight_ = new QGraphicsRectItem();
    highlight_->setPen(QPen(Qt::DotLine));
    QLinearGradient gradient(0,0,0, 40 );
    gradient.setSpread(QGradient::ReflectSpread);
    gradient.setColorAt(0.0, QColor(120, 100 ,100, 30));
    gradient.setColorAt(1.0, QColor(100, 100 ,100, 30));
    highlight_->setBrush(gradient);
    overviewScene_->addItem(highlight_);

    overviewView_->setStyleSheet("background:transparent");
    connect(overviewView_, SIGNAL(currentFrameChanged(int)), this, SIGNAL(currentFrameChanged(int)));
    connect(overviewView_, SIGNAL(contextMenuRequest(QPoint)), this, SLOT(contextMenuRequest(QPoint)));
    connect(overviewView_, SIGNAL(barMovement(int)), this, SIGNAL(barMovement(int)));
    connect(this, SIGNAL(offsetCorrection(int)), overviewView_, SLOT(offsetCorrection(int)));

    overviewView_->setGeometry(QRect(0, 0, duration_, 50));
    overviewView_->setSceneRect(QRect(0, 0, duration_, 50));
    overviewView_->setCurrentFrame(0);

    mainLayout->addWidget(overviewView_);
    QLabel* nameLabel = new QLabel(this);
    nameLabel->lower();
    nameLabel->move(8, 45);
    nameLabel->setText(QString::fromStdString("Overview"));

    if (canvasRenderer_) {
        const std::vector<Port*> port = canvasRenderer_->getInports();
        if (port.size() == 1) {
            if(dynamic_cast<RenderPort*>(port.at(0)) != 0)
                renderPort_ = dynamic_cast<RenderPort*>(port.at(0));
        }
    }
    setStandardRenderport();
}
예제 #7
0
KColorDialog::KColorDialog(QWidget *parent)
        : QWidget(parent), d(new KColorDialogPrivate(this))
{
//     setCaption(tr("Select Color"));
//     setButtons(modal ? Ok | Cancel : Close);
//     showButtonSeparator(true);
//     setModal(modal);
    d->bRecursion = true;
    d->bColorPicking = false;
#ifdef Q_WS_X11
    d->filter = 0;
#endif
    d->cbDefaultColor = 0L;
    d->_mode = ChooserClassic;

    QLabel *label;

    QGridLayout *tl_layout = new QGridLayout(this);
    tl_layout->setMargin(0);
    tl_layout->setSpacing(1);
    d->tl_layout = tl_layout;
    tl_layout->addItem(new QSpacerItem(1*2, 0), 0, 1);

    //
    // the more complicated part: the left side
    // add a V-box
    //
    QVBoxLayout *l_left = new QVBoxLayout();
    tl_layout->addLayout(l_left, 0, 0);

    //
    // add a H-Box for the XY-Selector and a grid for the
    // entry fields
    //
    QHBoxLayout *l_ltop = new QHBoxLayout();
    l_left->addLayout(l_ltop);

    // a little space between
    l_left->addSpacing(10);

    QGridLayout *l_lbot = new QGridLayout();
    l_left->addLayout(l_lbot);

    //
    // the palette and value selector go into the H-box
    //
    d->hsSelector = new KHueSaturationSelector(this);
    d->hsSelector->setMinimumSize(256, 256);
    l_ltop->addWidget(d->hsSelector, 8);
    connect(d->hsSelector, SIGNAL(valueChanged(int, int)),
            SLOT(slotHSChanged(int, int)));

    d->valuePal = new KColorValueSelector(this);
    d->valuePal->setMinimumSize(26, 70);
    d->valuePal->setIndent(false);
    d->valuePal->setArrowDirection(Qt::RightArrow);
    l_ltop->addWidget(d->valuePal, 1);
    connect(d->valuePal, SIGNAL(valueChanged(int)),
            SLOT(slotVChanged(int)));

    //
    // add the HSV fields
    //
    l_lbot->setColumnStretch(2, 10);

    d->hmode = new QRadioButton(tr("Hue:"), this);
    l_lbot->addWidget(d->hmode, 0, 0);

    d->hedit = new KColorSpinBox(0, 359, 1, this);
    l_lbot->addWidget(d->hedit, 0, 1);
    connect(d->hedit, SIGNAL(valueChanged(int)),
            SLOT(slotHSVChanged()));
    connect(d->hmode, SIGNAL(clicked()),
            SLOT(setHMode()));

    d->smode = new QRadioButton(tr("Saturation:"), this);
    l_lbot->addWidget(d->smode, 1, 0);

    d->sedit = new KColorSpinBox(0, 255, 1, this);
    l_lbot->addWidget(d->sedit, 1, 1);
    connect(d->sedit, SIGNAL(valueChanged(int)),
            SLOT(slotHSVChanged()));
    connect(d->smode, SIGNAL(clicked()),
            SLOT(setSMode()));

    d->vmode = new QRadioButton(tr("Value:"), this);
    l_lbot->addWidget(d->vmode, 2, 0);

    d->vedit = new KColorSpinBox(0, 255, 1, this);
    l_lbot->addWidget(d->vedit, 2, 1);
    connect(d->vedit, SIGNAL(valueChanged(int)),
            SLOT(slotHSVChanged()));
    connect(d->vmode, SIGNAL(clicked()),
            SLOT(setVMode()));


    //
    // add the RGB fields
    //
    d->rmode = new QRadioButton(tr("Red:"), this);
    l_lbot->addWidget(d->rmode, 0, 3);
    d->redit = new KColorSpinBox(0, 255, 1, this);
    l_lbot->addWidget(d->redit, 0, 4);
    connect(d->redit, SIGNAL(valueChanged(int)),
            SLOT(slotRGBChanged()));
    connect(d->rmode, SIGNAL(clicked()),
            SLOT(setRMode()));

            d->gmode = new QRadioButton(tr("Green:"), this);
    l_lbot->addWidget(d->gmode, 1, 3);

    d->gedit = new KColorSpinBox(0, 255, 1, this);
    l_lbot->addWidget(d->gedit, 1, 4);
    connect(d->gedit, SIGNAL(valueChanged(int)),
            SLOT(slotRGBChanged()));
    connect(d->gmode, SIGNAL(clicked()),
            SLOT(setGMode()));

            d->bmode = new QRadioButton(tr("Blue:"), this);
    l_lbot->addWidget(d->bmode, 2, 3);

    d->bedit = new KColorSpinBox(0, 255, 1, this);
    l_lbot->addWidget(d->bedit, 2, 4);
    connect(d->bedit, SIGNAL(valueChanged(int)),
            SLOT(slotRGBChanged()));
    connect(d->bmode, SIGNAL(clicked()),
            SLOT(setBMode()));

    //
    // the entry fields should be wide enough to hold 8888888
    //
    int w = d->hedit->fontMetrics().width("8888888");
    d->hedit->setFixedWidth(w);
    d->sedit->setFixedWidth(w);
    d->vedit->setFixedWidth(w);

    d->redit->setFixedWidth(w);
    d->gedit->setFixedWidth(w);
    d->bedit->setFixedWidth(w);

    //
    // add a layout for the right side
    //
    d->l_right = new QVBoxLayout;
    tl_layout->addLayout(d->l_right, 0, 2);

    //
    // Add the palette table
    //
    d->table = new KColorTable(this);
    d->l_right->addWidget(d->table, 10);

    connect(d->table, SIGNAL(colorSelected(const QColor &, const QString &)),
            SLOT(slotColorSelected(const QColor &, const QString &)));

    connect(
        d->table,
        SIGNAL(colorDoubleClicked(const QColor &, const QString &)),
        SLOT(slotColorDoubleClicked(const QColor &, const QString &))
    );
    // Store the default value for saving time.
    d->originalPalette = d->table->name();

    //
    // a little space between
    //
    d->l_right->addSpacing(10);

    QHBoxLayout *l_hbox = new QHBoxLayout();
    d->l_right->addItem(l_hbox);

    //
    // The add to custom colors button
    //
    QPushButton *addButton = new QPushButton(this);
    addButton->setText(tr("&Add to Custom Colors"));
    l_hbox->addWidget(addButton, 0, Qt::AlignLeft);
    connect(addButton, SIGNAL(clicked()), SLOT(slotAddToCustomColors()));

    //
    // The color picker button
    //
    QPushButton* button = new QPushButton(this);
    button->setIcon(QIcon("color-picker"));
    int commonHeight = addButton->sizeHint().height();
    button->setFixedSize(commonHeight, commonHeight);
    l_hbox->addWidget(button, 0, Qt::AlignHCenter);
    connect(button, SIGNAL(clicked()), SLOT(slotColorPicker()));

    //
    // a little space between
    //
    d->l_right->addSpacing(10);

    //
    // and now the entry fields and the patch (=colored box)
    //
    QGridLayout *l_grid = new QGridLayout();
    d->l_right->addLayout(l_grid);

    l_grid->setColumnStretch(2, 1);

    label = new QLabel(this);
    label->setText(tr("Name:"));
    l_grid->addWidget(label, 0, 1, Qt::AlignLeft);

    d->colorName = new QLabel(this);
    l_grid->addWidget(d->colorName, 0, 2, Qt::AlignLeft);

    label = new QLabel(this);
    label->setText(tr("HTML:"));
    l_grid->addWidget(label, 1, 1, Qt::AlignLeft);

    d->htmlName = new QLineEdit(this);
    d->htmlName->setMaxLength(13);   // Qt's QColor allows 12 hexa-digits
    d->htmlName->setText("#FFFFFF"); // But HTML uses only 6, so do not worry about the size
    w = d->htmlName->fontMetrics().width(QLatin1String("#DDDDDDD"));
    d->htmlName->setFixedWidth(w);
    l_grid->addWidget(d->htmlName, 1, 2, Qt::AlignLeft);

    connect(d->htmlName, SIGNAL(textChanged(const QString &)),
            SLOT(slotHtmlChanged()));

            d->patch = new KColorPatch(this);
    d->patch->setFixedSize(48, 48);
    l_grid->addWidget(d->patch, 0, 0, 2, 1, Qt::AlignHCenter | Qt::AlignVCenter);
    connect(d->patch, SIGNAL(colorChanged(const QColor&)),
            SLOT(setColor(const QColor&)));

    tl_layout->activate();

    readSettings();
    d->bRecursion = false;
    d->bEditHsv = false;
    d->bEditRgb = false;
    d->bEditHtml = false;

    setFixedSize(sizeHint());
    QColor col;
    col.setHsv(0, 0, 255);
    d->_setColor(col);

// FIXME: with enabled event filters, it crashes after ever enter of a drag.
// better disable drag and drop than crashing it...
//   d->htmlName->installEventFilter(this);
//   d->hsSelector->installEventFilter(this);
    d->hsSelector->setAcceptDrops(true);

    d->setVMode();
}
BuildingStoryInspectorView::BuildingStoryInspectorView(const openstudio::model::Model& model, QWidget * parent )
  : ModelObjectInspectorView(model, true, parent)
{
  QWidget* hiddenWidget = new QWidget();
  this->stackedWidget()->insertWidget(0, hiddenWidget);

  QWidget* visibleWidget = new QWidget();
  this->stackedWidget()->insertWidget(1, visibleWidget);

  this->stackedWidget()->setCurrentIndex(0);

  QGridLayout* mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7,7,7,7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  // name
  QVBoxLayout* vLayout = new QVBoxLayout();

  QLabel* label = new QLabel();
  label->setText("Name: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_nameEdit = new OSLineEdit();
  vLayout->addWidget(m_nameEdit);

  mainGridLayout->addLayout(vLayout,0,0,1,2, Qt::AlignTop);

  // floor height and floor to floor height
  //vLayout = new QVBoxLayout();

  //label = new QLabel();
  //label->setText("Floor Height: ");
  //label->setStyleSheet("QLabel { font: bold; }");
  //vLayout->addWidget(label);

  //m_floorHeightEdit = new OSQuantityEdit(m_isIP);
  //isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), , SLOT(onUnitSystemChange(bool)));
  //OS_ASSERT(isConnected);
  //vLayout->addWidget(m_floorHeightEdit);

  //mainGridLayout->addLayout(vLayout,1,0, Qt::AlignTop|Qt::AlignLeft);

  //vLayout = new QVBoxLayout();

  //label = new QLabel();
  //label->setText("Floor To Floor Height: ");
  //label->setStyleSheet("QLabel { font: bold; }");
  //vLayout->addWidget(label);

  //m_floorToFloorHeightEdit = new OSQuantityEdit(m_isIP);
  //isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), , SLOT(onUnitSystemChange(bool)));
  //OS_ASSERT(isConnected);
  //vLayout->addWidget(m_floorToFloorHeightEdit);

  //mainGridLayout->addLayout(vLayout,1,1, Qt::AlignTop|Qt::AlignLeft);

  // default construction and schedule sets
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Default Construction Set: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  // this controller will be owned by the drop zone
  m_defaultConstructionSetVectorController = new BuildingStoryDefaultConstructionSetVectorController();
  m_defaultConstructionSetDropZone = new OSDropZone(m_defaultConstructionSetVectorController);
  m_defaultConstructionSetDropZone->setMinItems(0);
  m_defaultConstructionSetDropZone->setMaxItems(1);
  m_defaultConstructionSetDropZone->setItemsAcceptDrops(true);
  vLayout->addWidget(m_defaultConstructionSetDropZone);

  mainGridLayout->addLayout(vLayout,1,0);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Default Schedule Set: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  // this controller will be owned by the drop zone
  m_defaultScheduleSetVectorController = new BuildingStoryDefaultScheduleSetVectorController();
  m_defaultScheduleSetDropZone = new OSDropZone(m_defaultScheduleSetVectorController);
  m_defaultScheduleSetDropZone->setMinItems(0);
  m_defaultScheduleSetDropZone->setMaxItems(1);
  m_defaultScheduleSetDropZone->setItemsAcceptDrops(true);
  vLayout->addWidget(m_defaultScheduleSetDropZone);

  mainGridLayout->addLayout(vLayout,1,1);

  // rendering color
  m_renderingColorWidget = new RenderingColorWidget();
  mainGridLayout->addWidget(m_renderingColorWidget,2,0,1,2, Qt::AlignTop|Qt::AlignLeft);

  // spaces
  //vLayout = new QVBoxLayout();

  //label = new QLabel();
  //label->setText("Spaces: ");
  //label->setStyleSheet("QLabel { font: bold; }");
  //vLayout->addWidget(label);

  //m_spacesVectorController = new BuildingStorySpacesVectorController();
  //m_spacesDropZone = new OSDropZone(m_spacesVectorController);
  //vLayout->addWidget(m_spacesDropZone);

  //mainGridLayout->addLayout(vLayout,4,0,1,2);

  mainGridLayout->setColumnMinimumWidth(0, 100);
  mainGridLayout->setColumnMinimumWidth(1, 100);
  mainGridLayout->setColumnStretch(2,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowStretch(3,1);
}
예제 #9
0
Donate::Donate(QWidget *parent) : QDialog(parent)
{
    resize(400, 0);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    // Initialize "Thanks" section:

    QString thanks = QString("<hr>%1:<br>").arg(tr("Thank you for your support"));

    QRegExp rx("\\((.+)\\)");
    rx.setMinimal(true);

    QFile inputFile(APPDIR + "/authors.txt");
    if (inputFile.open(QIODevice::ReadOnly)) {

        QTextStream stream(&inputFile);

        while (!stream.atEnd()) {

            QString line = stream.readLine();

            if (line == "Supported by:") {
                while (!line.isEmpty() && !stream.atEnd()) {
                    line = stream.readLine();
                    line = line.replace(rx, "(<a href=\"\\1\">\\1</a>)");
                    thanks += line + "<br>";
                }
                thanks.chop(8);
                break;
            }
        }

        inputFile.close();
    }

    // Create GUI:

    QGridLayout *grid = new QGridLayout(this);
    QLabel *donators = new QLabel(this);
    donators->setAlignment(Qt::AlignCenter);
    donators->setTextFormat(Qt::RichText);
    donators->setOpenExternalLinks(true);
    donators->setText(thanks);

    QLabel *titlePayPal = new QLabel("PayPal", this);
    QLabel *titleBitCoin = new QLabel("BitCoin", this);
    QLineEdit *fieldPayPal = new QLineEdit(PAYPAL, this);
    QLineEdit *fieldBitCoin = new QLineEdit(BITCOIN, this);
    fieldPayPal->setReadOnly(true);
    fieldBitCoin->setReadOnly(true);
    fieldPayPal->setCursor(Qt::IBeamCursor);
    fieldBitCoin->setCursor(Qt::IBeamCursor);

    QToolButton *btnPayPal = new QToolButton(this);
    QToolButton *btnBitCoin = new QToolButton(this);
    btnPayPal->setIcon(QIcon(":/gfx/actions/copy.png"));
    btnBitCoin->setIcon(QIcon(":/gfx/actions/copy.png"));
    btnPayPal->setToolTip(tr("Copy to Clipboard"));
    btnBitCoin->setToolTip(tr("Copy to Clipboard"));

    QPushButton *btnOk = new QPushButton("OK", this);

    grid->addWidget(titlePayPal, 0, 0);
    grid->addWidget(fieldPayPal, 0, 1);
    grid->addWidget(btnPayPal, 0, 2);
    grid->addWidget(titleBitCoin, 1, 0);
    grid->addWidget(fieldBitCoin, 1, 1);
    grid->addWidget(btnBitCoin, 1, 2);
    grid->addWidget(btnOk, 2, 1);
    grid->addWidget(donators, 3, 1);

    connect(btnPayPal, SIGNAL(clicked()), this, SLOT(copyPayPal()));
    connect(btnBitCoin, SIGNAL(clicked()), this, SLOT(copyBitCoin()));
    connect(btnOk, SIGNAL(clicked()), this, SLOT(accept()));
}
예제 #10
0
QmitkFastMarchingTool3DGUI::QmitkFastMarchingTool3DGUI() : QmitkToolGUI(), m_TimeIsConnected(false)
{
  this->setContentsMargins(0, 0, 0, 0);

  // create the visible widgets
  QVBoxLayout *widgetLayout = new QVBoxLayout(this);
  widgetLayout->setContentsMargins(0, 0, 0, 0);

  QFont fntHelp;
  fntHelp.setBold(true);

  QLabel *lblHelp = new QLabel(this);
  lblHelp->setText("Press shift-click to add seeds repeatedly.");
  lblHelp->setFont(fntHelp);

  widgetLayout->addWidget(lblHelp);

  // Sigma controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Sigma: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addItem(hlayout);
  }

  m_slSigma = new ctkSliderWidget(this);
  m_slSigma->setMinimum(0.1);
  m_slSigma->setMaximum(5.0);
  m_slSigma->setPageStep(0.1);
  m_slSigma->setSingleStep(0.01);
  m_slSigma->setValue(1.0);
  m_slSigma->setTracking(false);
  m_slSigma->setToolTip("The \"sigma\" parameter in the Gradient Magnitude filter.");
  connect(m_slSigma, SIGNAL(valueChanged(double)), this, SLOT(OnSigmaChanged(double)));
  widgetLayout->addWidget(m_slSigma);

  // Alpha controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Alpha: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addItem(hlayout);
  }

  m_slAlpha = new ctkSliderWidget(this);
  m_slAlpha->setMinimum(-10);
  m_slAlpha->setMaximum(0);
  m_slAlpha->setPageStep(0.1);
  m_slAlpha->setSingleStep(0.01);
  m_slAlpha->setValue(-2.5);
  m_slAlpha->setTracking(false);
  m_slAlpha->setToolTip("The \"alpha\" parameter in the Sigmoid mapping filter.");
  connect(m_slAlpha, SIGNAL(valueChanged(double)), this, SLOT(OnAlphaChanged(double)));
  widgetLayout->addWidget(m_slAlpha);

  // Beta controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Beta: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slBeta = new ctkSliderWidget(this);
  m_slBeta->setMinimum(0);
  m_slBeta->setMaximum(100);
  m_slBeta->setPageStep(0.1);
  m_slBeta->setSingleStep(0.01);
  m_slBeta->setValue(3.5);
  m_slBeta->setTracking(false);
  m_slBeta->setToolTip("The \"beta\" parameter in the Sigmoid mapping filter.");
  connect(m_slBeta, SIGNAL(valueChanged(double)), this, SLOT(OnBetaChanged(double)));
  widgetLayout->addWidget(m_slBeta);

  // stopping value controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Stopping value: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slStoppingValue = new ctkSliderWidget(this);
  m_slStoppingValue->setMinimum(0);
  m_slStoppingValue->setMaximum(10000);
  m_slStoppingValue->setPageStep(10);
  m_slStoppingValue->setSingleStep(1);
  m_slStoppingValue->setValue(2000);
  m_slStoppingValue->setDecimals(0);
  m_slStoppingValue->setTracking(false);
  m_slStoppingValue->setToolTip("The \"stopping value\" parameter in the fast marching 3D algorithm");
  connect(m_slStoppingValue, SIGNAL(valueChanged(double)), this, SLOT(OnStoppingValueChanged(double)));
  widgetLayout->addWidget(m_slStoppingValue);

  // threshold controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Threshold: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slwThreshold = new ctkRangeWidget(this);
  m_slwThreshold->setMinimum(-100);
  m_slwThreshold->setMaximum(5000);
  m_slwThreshold->setMinimumValue(-100);
  m_slwThreshold->setMaximumValue(2000);
  m_slwThreshold->setDecimals(0);
  m_slwThreshold->setTracking(false);
  m_slwThreshold->setToolTip("The lower and upper thresholds for the final thresholding");
  connect(m_slwThreshold, SIGNAL(valuesChanged(double, double)), this, SLOT(OnThresholdChanged(double, double)));
  widgetLayout->addWidget(m_slwThreshold);

  m_btClearSeeds = new QPushButton("Clear");
  m_btClearSeeds->setToolTip("Clear current result and start over again");
  widgetLayout->addWidget(m_btClearSeeds);
  connect(m_btClearSeeds, SIGNAL(clicked()), this, SLOT(OnClearSeeds()));

  m_btConfirm = new QPushButton("Confirm Segmentation");
  m_btConfirm->setToolTip("Incorporate current result in your working session.");
  m_btConfirm->setEnabled(false);
  widgetLayout->addWidget(m_btConfirm);
  connect(m_btConfirm, SIGNAL(clicked()), this, SLOT(OnConfirmSegmentation()));

  connect(this, SIGNAL(NewToolAssociated(mitk::Tool *)), this, SLOT(OnNewToolAssociated(mitk::Tool *)));

  this->setEnabled(false);

  m_slSigma->setDecimals(2);
  m_slBeta->setDecimals(2);
  m_slAlpha->setDecimals(2);
}
예제 #11
0
FlickrWidget::FlickrWidget(QWidget* parent, KIPI::Interface *iface, const QString& serviceName)
            : QWidget(parent)
{
    setObjectName("FlickrWidget");

    QVBoxLayout* flickrWidgetLayout = new QVBoxLayout(this);

    m_photoView         = 0; //new KHTMLPart(splitter);
    KSeparator *line    = new KSeparator(Qt::Horizontal, this);
    m_tab               = new KTabWidget(this);
    QLabel *headerLabel = new QLabel(this);
    headerLabel->setOpenExternalLinks(true);
    headerLabel->setFocusPolicy(Qt::NoFocus);
    if (serviceName == "23hq")
        headerLabel->setText(i18n("<b><h2><a href='http://www.23hq.com'>"
                                  "<font color=\"#7CD164\">23hq</font>"
                                  " Export"
                                  "</h2></b>"));
    else
        headerLabel->setText(i18n("<b><h2><a href='http://www.flickr.com'>"
                                  "<font color=\"#0065DE\">flick</font>"
                                  "<font color=\"#FF0084\">r</font></a>"
                                  " Export"
                                  "</h2></b>"));

    // -------------------------------------------------------------------

    m_imglst  = new KIPIPlugins::ImagesList(iface, m_tab);
    m_imglst->setAllowRAW(true);
    m_imglst->loadImagesFromCurrentSelection();
    m_imglst->listView()->setWhatsThis(i18n("This is the list of images to upload on your Flickr account."));

    QWidget* settingsBox           = new QWidget(m_tab);
    QVBoxLayout* settingsBoxLayout = new QVBoxLayout(settingsBox);

    QGridLayout* albumsSettingsLayout = new QGridLayout();
    QLabel* albumLabel = new QLabel(i18n("PhotoSet:"), settingsBox);
    m_newAlbumBtn = new QPushButton(settingsBox);
    m_newAlbumBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_newAlbumBtn->setText(i18n("&New PhotoSet"));
    m_albumsListComboBox = new KComboBox(settingsBox);
    albumsSettingsLayout->addWidget(albumLabel, 0, 0, 1, 1);
    albumsSettingsLayout->addWidget(m_albumsListComboBox, 0, 1, 1, 1);
    albumsSettingsLayout->addWidget(m_newAlbumBtn, 0, 2, 1, 1);
    albumsSettingsLayout->setColumnStretch(1, 10);
	
    QGridLayout* tagsLayout  = new QGridLayout();
    QLabel* tagsLabel        = new QLabel(i18n("Added Tags: "), settingsBox);
    m_tagsLineEdit           = new KLineEdit(settingsBox);
    m_exportHostTagsCheckBox = new QCheckBox(settingsBox);
    m_exportHostTagsCheckBox->setText(i18n("Use Host Application Tags"));
    m_stripSpaceTagsCheckBox = new QCheckBox(settingsBox);
    m_stripSpaceTagsCheckBox->setText(i18n("Strip Space From Host Application Tags"));
    m_tagsLineEdit->setToolTip(i18n("Enter here new tags separated by space."));

    tagsLayout->addWidget(tagsLabel,                0, 0);
    tagsLayout->addWidget(m_tagsLineEdit,           0, 1);
    tagsLayout->addWidget(m_exportHostTagsCheckBox, 1, 1);
    tagsLayout->addWidget(m_stripSpaceTagsCheckBox, 2, 1);

    // ------------------------------------------------------------------------

    QGroupBox* optionsBox         = new QGroupBox(i18n("Override Default Options"), settingsBox);
    QGridLayout* optionsBoxLayout = new QGridLayout(optionsBox);

    m_publicCheckBox = new QCheckBox(optionsBox);
    m_publicCheckBox->setText(i18nc("As in accessible for people", "Public (anyone can see them)"));

    m_familyCheckBox = new QCheckBox(optionsBox);
    m_familyCheckBox->setText(i18n("Visible to Family"));

    m_friendsCheckBox = new QCheckBox(optionsBox);
    m_friendsCheckBox->setText(i18n("Visible to Friends"));

    m_resizeCheckBox = new QCheckBox(optionsBox);
    m_resizeCheckBox->setText(i18n("Resize photos before uploading"));
    m_resizeCheckBox->setChecked(false);

    m_dimensionSpinBox = new QSpinBox(optionsBox);
    m_dimensionSpinBox->setMinimum(0);
    m_dimensionSpinBox->setMaximum(5000);
    m_dimensionSpinBox->setSingleStep(10);
    m_dimensionSpinBox->setValue(600);
    m_dimensionSpinBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_dimensionSpinBox->setEnabled(false);

    QLabel* resizeLabel   = new QLabel(i18n("Maximum dimension (pixels):"), optionsBox);

    m_imageQualitySpinBox = new QSpinBox(optionsBox);
    m_imageQualitySpinBox->setMinimum(0);
    m_imageQualitySpinBox->setMaximum(100);
    m_imageQualitySpinBox->setSingleStep(1);
    m_imageQualitySpinBox->setValue(85);
    m_imageQualitySpinBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    // NOTE: The term Compression factor may be to technical to write in the label
    QLabel* imageQualityLabel = new QLabel(i18n("JPEG Image Quality (higher is better):"), optionsBox);

    optionsBoxLayout->addWidget(m_publicCheckBox,      0, 0, 1, 4);
    optionsBoxLayout->addWidget(m_familyCheckBox,      1, 0, 1, 4);
    optionsBoxLayout->addWidget(m_friendsCheckBox,     2, 0, 1, 4);
    optionsBoxLayout->addWidget(imageQualityLabel,     3, 0, 1, 3);
    optionsBoxLayout->addWidget(m_imageQualitySpinBox, 3, 3, 1, 1);
    optionsBoxLayout->addWidget(m_resizeCheckBox,      4, 0, 1, 4);
    optionsBoxLayout->addWidget(resizeLabel,           5, 1, 1, 2);
    optionsBoxLayout->addWidget(m_dimensionSpinBox,    5, 3, 1, 1);
    optionsBoxLayout->setColumnMinimumWidth(0, KDialog::spacingHint());
    optionsBoxLayout->setColumnStretch(1, 10);
    optionsBoxLayout->setSpacing(KDialog::spacingHint());
    optionsBoxLayout->setMargin(KDialog::spacingHint());

    // ------------------------------------------------------------------------

    QGroupBox* accountBox         = new QGroupBox(i18n("Account"), settingsBox);
    QGridLayout* accountBoxLayout = new QGridLayout(accountBox);

    QLabel *userNameLabel  = new QLabel(i18n("User Name: "), accountBox);
    m_userNameDisplayLabel = new QLabel(accountBox);
    m_changeUserButton     = new QPushButton(accountBox);
    m_changeUserButton->setText(i18n("Use a different account"));
    m_changeUserButton->setIcon(SmallIcon("system-switch-user"));

    accountBoxLayout->addWidget(userNameLabel,          0, 0, 1, 1);
    accountBoxLayout->addWidget(m_userNameDisplayLabel, 0, 1, 1, 1);
    accountBoxLayout->addWidget(m_changeUserButton,     0, 3, 1, 1);
    accountBoxLayout->setColumnStretch(2, 10);
    accountBoxLayout->setSpacing(KDialog::spacingHint());
    accountBoxLayout->setMargin(KDialog::spacingHint());

    settingsBoxLayout->addLayout(albumsSettingsLayout);
    settingsBoxLayout->addLayout(tagsLayout);
    settingsBoxLayout->addWidget(optionsBox);
    settingsBoxLayout->addWidget(accountBox);
    settingsBoxLayout->addStretch(10);
    settingsBoxLayout->setSpacing(KDialog::spacingHint());
    settingsBoxLayout->setMargin(KDialog::spacingHint());

    // ------------------------------------------------------------------------

    flickrWidgetLayout->addWidget(headerLabel);
    flickrWidgetLayout->addWidget(line);
    flickrWidgetLayout->addWidget(m_tab, 5);
    flickrWidgetLayout->setSpacing(KDialog::spacingHint());
    flickrWidgetLayout->setMargin(0);

    m_tab->insertTab(FILELIST, m_imglst,    i18n("Files List"));
    m_tab->insertTab(UPLOAD,   settingsBox, i18n("Upload Options"));

    // ------------------------------------------------------------------------

    connect(m_resizeCheckBox, SIGNAL(clicked()),
            this, SLOT(slotResizeChecked()));

    connect(m_exportHostTagsCheckBox, SIGNAL(clicked()),
            this, SLOT(slotExportHostTagsChecked()));

    if (serviceName == "23hq")
    {
        // 23hq.com does not support Family/Friends concept, so hide it
        m_familyCheckBox->hide();
        m_friendsCheckBox->hide();
    }
}
예제 #12
0
CustomerSearch::CustomerSearch(QWidget *parent, const char *name, Qt::WFlags f)
    : TAAWidget(parent, f)
{
    // A simple (in appearance) widget that will allow the user to
    // search for, and select, a customer.
    //
    // The layout will look like so:
    //
    //  Query: [ Search Box         ] [Search] [Clear]
    //  +---------+----------+-----------------------+
    //  + Cust ID | Login ID | Account Name          |
    //  +         |          |                       |
    //  +---------+----------+-----------------------+
    //
    // When the user types something in the search box and presses enter
    // or clicks the search button, the widget will do a search on the
    // customer database against the search text and fill in the list.
    // When the user clicks or scrolls onto an entry, itemHighlighted()
    // will be emitted with the customer ID.  When the user double clicks
    // or presses enter on an entry itemSelected() will be emitted with
    // the customer ID.


    searchText = new QLineEdit(this, "SearchText");
    searchText->setMaxLength(80);
    connect(searchText, SIGNAL(returnPressed()), this, SLOT(startSearch()));
    
    QLabel  *queryLabel = new QLabel(this, "Query Label");
    queryLabel->setText("&Query:");
    queryLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    queryLabel->setBuddy(searchText);

    searchButton = new QPushButton(this, "SearchButton");
    searchButton->setText("Search");
    connect(searchButton, SIGNAL(clicked()), this, SLOT(startSearch()));

    QPushButton *clearButton = new QPushButton(this, "Clear Button");
    clearButton->setText("C&lear");
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clearSearch()));

    custList = new Q3ListView(this, "SearchResults");
    custList->setMargin(2);
    custList->setAllColumnsShowFocus(true);
    custList->setRootIsDecorated(true);
    custList->addColumn("Account Name");
    custList->addColumn("LoginID");
    custList->addColumn("Cust ID");
    connect(custList, SIGNAL(currentChanged(Q3ListViewItem *)), this, SLOT(itemHighlighted(Q3ListViewItem *)));
    connect(custList, SIGNAL(doubleClicked(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *)));
    connect(custList, SIGNAL(returnPressed(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *)));

    Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 0, 0);
    Q3BoxLayout *sl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 0);
    sl->addSpacing(3);
    sl->addWidget(queryLabel, 0);
    sl->addSpacing(3);
    sl->addWidget(searchText, 1);
    sl->addSpacing(3);
    sl->addWidget(searchButton, 0);
    sl->addWidget(clearButton, 0);
    ml->addLayout(sl, 0);
    ml->addSpacing(3);
    ml->addWidget(custList, 1);

}
예제 #13
0
void MainWindow::on_btn_search_clicked()
{
    QSqlQuery query;
    ui->statusBar->showMessage( tr("Search Button clicked"),2000);
    int numC=ui->tableWidget_resultat->rowCount();
    for(;numC>=0;numC--){
        ui->tableWidget_resultat->removeRow(numC);
    }

    QString str=ui->lineEdit_search->text();
    bool boo;
    if(str.compare("")==0)
    {
        boo=query.exec("select * from TPatient");
        if(!boo)
        {
            qDebug() << query.lastError().text();
            qDebug() << "can't find !\n";
        }
     }
    else
    {
        QString sql="select * from TPatient where Nom='"+str+"' or Id='"+str+"' or Prenom='"+str+"' or DateConsultation='"+str+"'";
        boo=query.exec(sql);
        if(!boo)
        {
            qDebug() << query.lastError().text();
        }

    }
    int i=0;
    for(; query.next(); i++)
    {
        ui->tableWidget_resultat->insertRow(i);
        ui->tableWidget_resultat->setItem( i, 0, new QTableWidgetItem(query.value(0).toString()));
        ui->tableWidget_resultat->setItem( i, 1, new QTableWidgetItem(query.value(1).toString()));
        ui->tableWidget_resultat->setItem( i, 2, new QTableWidgetItem(query.value(2).toString()));
        ui->tableWidget_resultat->setItem( i, 3, new QTableWidgetItem(query.value(8).toString()));
        ui->tableWidget_resultat->setItem( i, 4, new QTableWidgetItem(query.value(9).toString()+" mn"));

        QLabel *modifier = new QLabel();
        modifier->setText("      Modifier");
        modifier->setCursor(Qt::PointingHandCursor);
        QPalette pa;
        pa.setColor(QPalette::Text,Qt::blue);
        modifier->setPalette(pa);
        ui->tableWidget_resultat->setCellWidget(i,5,modifier);


        QLabel *supprimer=new QLabel();
        supprimer->setText("     Supprimer");
        supprimer->setCursor(Qt::PointingHandCursor);
        QPalette pa2;
        pa2.setColor(QPalette::Text,Qt::red);
        supprimer->setPalette(pa2);
        ui->tableWidget_resultat->setCellWidget(i,6,supprimer);

    }
    if(i==0){
        ui->tableWidget_resultat->insertRow(0);
        ui->tableWidget_resultat->setItem(0, 0, new QTableWidgetItem("No record"));
    }
}
예제 #14
0
파일: profileform.cpp 프로젝트: 4myPAL/qTox
ProfileForm::ProfileForm(QWidget *parent) :
    QWidget(parent)
{
    bodyUI = new Ui::IdentitySettings;
    bodyUI->setupUi(this);
    core = Core::getInstance();

    head = new QWidget(this);
    QHBoxLayout* headLayout = new QHBoxLayout();
    head->setLayout(headLayout);

    QLabel* imgLabel = new QLabel();
    headLayout->addWidget(imgLabel);

    QLabel* nameLabel = new QLabel();
    QFont bold;
    bold.setBold(true);
    nameLabel->setFont(bold);
    headLayout->addWidget(nameLabel);
    headLayout->addStretch(1);

    nameLabel->setText(tr("User Profile"));
    imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));

    // tox
    toxId = new ClickableTE();
    toxId->setReadOnly(true);
    toxId->setFrame(false);
    toxId->setFont(Style::getFont(Style::Small));
    toxId->setToolTip(bodyUI->toxId->toolTip());

    QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout());
    toxIdGroup->replaceWidget(bodyUI->toxId, toxId);
    bodyUI->toxId->hide();

    bodyUI->qrLabel->setWordWrap(true);

    profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
    profilePicture->setClickable(true);
    connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
    QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout());
    publicGrouplayout->insertWidget(0, profilePicture);
    publicGrouplayout->insertSpacing(1, 7);

    timer.setInterval(750);
    timer.setSingleShot(true);
    connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;});

    connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(core, &Core::idSet, this, &ProfileForm::setToxId);
    connect(core, &Core::statusSet, this, &ProfileForm::onStatusSet);
    connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
    connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
    connect(bodyUI->loadButton, &QPushButton::clicked, this, &ProfileForm::onLoadClicked);
    connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked);
    connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked);
    connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked);
    connect(bodyUI->importButton, &QPushButton::clicked, this, &ProfileForm::onImportClicked);
    connect(bodyUI->newButton, &QPushButton::clicked, this, &ProfileForm::onNewClicked);

    connect(core, &Core::avStart, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avStarting, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avInvite, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avRinging, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avCancel, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avEnd, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avEnding, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avPeerTimeout, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avRequestTimeout, this, &ProfileForm::enableSwitching);

    connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
    connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });

    for (QComboBox* cb : findChildren<QComboBox*>())
    {
            cb->installEventFilter(this);
            cb->setFocusPolicy(Qt::StrongFocus);
    }
}
예제 #15
0
NoteWidget::NoteWidget(QString title, QString text, QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	setBackgroundImage();
	this->setContentsMargins(0,0,0,0);
	
	/* create the GUI objects */
	backButton = new ButtonLabel(QPixmap(":/icons/backButton.png"), QPixmap(":/icons/backButtonPushed.png"), this);
	connect(backButton, SIGNAL(released()), this, SLOT(close()));
	quitButton = new ButtonLabel(QPixmap(":/icons/quitButton.png"), QPixmap(":/icons/quitButtonPushed.png"), this);
	connect(quitButton, SIGNAL(released()), QApplication::instance(), SLOT(quit()));
	patientIcon = new QLabel(this);
	patientIcon->setPixmap(QPixmap(":/icons/patientIcon.png"));
	
	/* initialize the footer object */
	footer = new ChangePatientFooter(this);
	
    QLabel *headerText = new QLabel(this);
    headerText->setStyleSheet("font-family: arial; font-weight: bold; font-size: 18px;");
    headerText->setText("<font color=\"#622181\">Paziente</font><font color=\"#9C9E9F\"> / </font><font color=\"#0B72B5\">Immagini</font>");
        
	QHBoxLayout *headerLayout = new QHBoxLayout();
	headerLayout->setContentsMargins(13, 13, 13, 0);
	headerLayout->addWidget(patientIcon);
	headerLayout->addSpacing(3);
	headerLayout->addWidget(headerText);
	headerLayout->setAlignment(headerText, Qt::AlignVCenter);
	headerLayout->addStretch();	
	headerLayout->addWidget(quitButton);
	
	QLabel *titleLabel = new QLabel("<font color=\"black\">Soggetto<br/></font> <font color=\"white\" >"+ title +"</font>", this);
	titleLabel->setMinimumHeight(100);
	titleLabel->setAutoFillBackground(true);
	titleLabel->setFont(QFont("helvetica"));
	titleLabel->setAlignment(Qt::AlignVCenter);
	QPalette titlePal(titleLabel->palette());
	titlePal.setColor(QPalette::Background, QColor(190,10,38));
	titleLabel->setPalette(titlePal);
	
	QLabel *note = new QLabel(text, this);
	note->setFont(QFont("helvetica"));
	QPalette notePal(note->palette());
	notePal.setColor(QPalette::Text, Qt::black);
	note->setPalette(notePal);
	note->setWordWrap(true);
	note->setAlignment(Qt::AlignJustify);
	note->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QScrollArea *scrollArea = new QScrollArea();
	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	scrollArea->setWidget(note);
	scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->addLayout(headerLayout);
	mainLayout->addWidget(titleLabel);
	
	QHBoxLayout *backHLayout = new QHBoxLayout();
	backHLayout->setContentsMargins(15, 0,0,0);
	backHLayout->addWidget(backButton);
	
	QHBoxLayout *scrollLayout = new QHBoxLayout();
	scrollLayout->addWidget(scrollArea);
	scrollLayout->setAlignment(scrollArea, Qt::AlignVCenter);
	mainLayout->addLayout(scrollLayout);
	mainLayout->addStretch(3);
	mainLayout->addLayout(backHLayout);
	mainLayout->addStretch(1);
	mainLayout->addWidget(footer);
			
	setLayout(mainLayout);
}
예제 #16
0
void QtCalculator::configclicked(){


  QTabDialog * tabdialog;
  tabdialog = new QTabDialog(0,"tabdialog",TRUE);

  tabdialog->setCaption( i18n("KCalc Configuration") );
  tabdialog->resize( 360, 390 );
  tabdialog->setCancelButton( i18n("&Cancel") );
  tabdialog->setOKButton(i18n("&OK"));

  QWidget *about = new QWidget(tabdialog,"about");
  QVBoxLayout *lay1 = new QVBoxLayout( about );
  lay1->setMargin( KDialog::marginHint() );
  lay1->setSpacing( KDialog::spacingHint() );

  QGroupBox *box = new QGroupBox(0,Qt::Vertical,about,"box");
  box->layout()->setSpacing(KDialog::spacingHint());
  box->layout()->setMargin(KDialog::marginHint());
  QGridLayout *grid1 = new QGridLayout(box->layout(),2,2);
  QLabel  *label = new QLabel(box,"label");
  QLabel  *label2 = new QLabel(box,"label2");

  box->setTitle(i18n("About"));
  grid1->addWidget(label,0,1);
  grid1->addMultiCellWidget(label2,2,2,0,1);

  QString labelstring = "KCalc "KCALCVERSION"\n"\
    "Bernd Johannes Wuebben\n"\
    "[email protected]\n"\
    "[email protected]\n"\
    "Copyright (C) 1996-98\n"\
    "\n\n";

  QString labelstring2 =
#ifdef HAVE_LONG_DOUBLE
                i18n( "Base type: long double\n");
#else
                i18n( "Due to broken glibc's everywhere, "\
                      "I had to reduce KCalc's precision from 'long double' "\
                      "to 'double'. "\
                      "Owners of systems with a working libc "\
                      "should recompile KCalc with 'long double' precision "\
                      "enabled. See the README for details.");
#endif

  label->setAlignment(AlignLeft|WordBreak|ExpandTabs);
  label->setText(labelstring);

  label2->setAlignment(AlignLeft|WordBreak|ExpandTabs);
  label2->setText(labelstring2);

  // HACK
  // QPixmap pm( BarIcon( "kcalclogo" ) );
  QPixmap pm;
  QLabel *logo = new QLabel(box);
  logo->setPixmap(pm);
  grid1->addWidget(logo,0,0);
  lay1->addWidget(box);


  DefStruct newdefstruct;
  newdefstruct.forecolor  = kcalcdefaults.forecolor;
  newdefstruct.backcolor  = kcalcdefaults.backcolor;
  newdefstruct.precision  = kcalcdefaults.precision;
  newdefstruct.fixedprecision  = kcalcdefaults.fixedprecision;
  newdefstruct.fixed  = kcalcdefaults.fixed;
  newdefstruct.style  = kcalcdefaults.style;
  newdefstruct.beep  = kcalcdefaults.beep;

  ConfigDlg *configdlg;
  configdlg = new ConfigDlg(tabdialog,"configdlg",&newdefstruct);

  tabdialog->addTab(configdlg,i18n("Defaults"));
  tabdialog->addTab(about,i18n("About"));


  if(tabdialog->exec() == QDialog::Accepted){


    kcalcdefaults.forecolor  = newdefstruct.forecolor;
    kcalcdefaults.backcolor  = newdefstruct.backcolor;
    kcalcdefaults.precision  = newdefstruct.precision;
    kcalcdefaults.fixedprecision  = newdefstruct.fixedprecision;
    kcalcdefaults.fixed  = newdefstruct.fixed;
    kcalcdefaults.style  = newdefstruct.style;
    kcalcdefaults.beep  = newdefstruct.beep;

    set_colors();
    set_precision();
    set_style();
    updateGeometry();
    resize(minimumSize());
  }
  delete configdlg;
}
Interface::Interface(QString& configFile):
    QMainWindow(),
    _h_milli(210.0),
    _w_milli(297.0),
    _focal(750.0),
    _camNum(0),
    _isImageLoaded(false),
    _configFileName(configFile)
{
    //showMaximized();
    resize(1200, 900);
    setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), qApp->desktop()->availableGeometry()));
    QString dir = dataPath() + "icons/";

    // Create a Viewer with shadows management
    _poseViewer = new PoseViewer(this, "viewer", 0);
    setCentralWidget(_poseViewer.get());
#if APPLY_CULL_MASK
    _poseViewer->getOsgViewer()->getCamera()->setCullMask(0x8);
#endif
    _poseViewer->addEventHandler(new osgViewer::StatsHandler);

    _pick = new PoLAR::TabBoxPickHandler(false); // create pick handler
    _poseViewer->addEventHandler(new DraggerManipulationHandler());

    QObject::connect(_poseViewer.get(), SIGNAL(shown()), this, SLOT(readConfigFile()), Qt::QueuedConnection);

    _imageFileDialog = new LoadImageDialog;
    _imageFileDialog->setOption(QFileDialog::DontUseNativeDialog);
    QObject::connect(_imageFileDialog, SIGNAL(closed(double, double)), this, SLOT(getImageData(double, double)));

    _toolbar = new QToolBar(this);
    addToolBar(Qt::LeftToolBarArea, _toolbar);
    _toolbar->setOrientation(Qt::Vertical);

    _statuslabel = new QLabel(_toolbar);
    _statuslabel->setText(*(new QString("Tools")));

    _toolbar->addAction(QIcon(dir+"exit.png"), QString("Quit"), this, SLOT(exit()));

    QAction *loadImgAct = new QAction(QIcon(dir+"img.png"), tr("Load reference image"), this);
    loadImgAct->setStatusTip(tr("Load reference image"));
    QObject::connect(loadImgAct, SIGNAL(triggered()), _imageFileDialog, SLOT(show()));
    _toolbar->addAction(loadImgAct);

    _toolbar->addAction(QIcon(dir+"object.png"), QString("Add 3D object"), this, SLOT(loadObject()));

    _toolbar->addAction(QIcon(dir+"scene.png"), QString("Manipulate 3D object"), this, SLOT(manipulateObject()));
    // Combo Box to permit to choose the type of dragger to use for object edition
    _draggerCombo = new QComboBox(this);
    _draggerCombo->addItem("TabBox dragger");
    _draggerCombo->addItem("Trackball dragger");
    _draggerCombo->addItem("TranslateAxis dragger");
    _draggerCombo->addItem("ScaleAxis dragger");
    _draggerCombo->addItem("RotateSphere dragger");
    //_draggerCombo->addItem("Vertex dragger");
    _toolbar->addWidget(_draggerCombo);

    QObject::connect(_draggerCombo, SIGNAL(activated(int)), this, SLOT(draggerComboSlot(int)));

    _dragger = new osgManipulator::TabBoxDragger;

    QPushButton *stopButton = new QPushButton(QString("Stop manipulate object"), this);
    _toolbar->addWidget(stopButton);
    QObject::connect(stopButton, SIGNAL(pressed()), this, SLOT(stopManipulateObject()));
    QPushButton *resetButton = new QPushButton(QString("Reset object manipulation"), this);
    _toolbar->addWidget(resetButton);
    QObject::connect(resetButton, SIGNAL(pressed()), this, SLOT(resetObjectManipulation()));

    QLabel* labelW = new QLabel(_toolbar);
    labelW->setText(*(new QString("Webcam #:")));
    _toolbar->addWidget(labelW);
    _camNumBox = new QSpinBox(_toolbar);
    _camNumBox->setRange(0,19);
    _camNumBox->setSingleStep(1);
    _camNumBox->setValue(_camNum);
    _toolbar->addWidget(_camNumBox);
    QObject::connect(_camNumBox, SIGNAL(valueChanged(int)), this, SLOT(webcamNumChanged(int)));

    QLabel* labelF = new QLabel(_toolbar);
    labelF->setText(*(new QString("Focal:")));
    _toolbar->addWidget(labelF);
    _focalBox = new QSpinBox(_toolbar);
    _focalBox->setRange(0,5000);
    _focalBox->setSingleStep(1);
    _focalBox->setValue(_focal);
    _toolbar->addWidget(_focalBox);
    QObject::connect(_focalBox, SIGNAL(valueChanged(int)), this, SLOT(focalChanged(int)));

    QLabel* labelScale = new QLabel(_toolbar);
    labelScale->setText(QString("Model scale:"));
    _toolbar->addWidget(labelScale);
    _scaleBox = new QDoubleSpinBox(_toolbar);
    _scaleBox->setRange(0.001, 1000.0);
    _scaleBox->setSingleStep(0.001);
    _scaleBox->setValue(1.0);
    _toolbar->addWidget(_scaleBox);
    QObject::connect(_scaleBox, SIGNAL(valueChanged(double)), this, SLOT(scaleChanged(double)));

    QPushButton *goButton = new QPushButton(QString("Launch video"), this);
    _toolbar->addWidget(goButton);
    QObject::connect(goButton, SIGNAL(pressed()), this, SLOT(launchVideoViewer()));

    QPushButton *screenshotButton = new QPushButton(QString("Take screenshot"), this);
    _toolbar->addWidget(screenshotButton);
    QObject::connect(screenshotButton, SIGNAL(pressed()), this, SLOT(takeScreenshot()));

    // add focus to this interface in order to get the keyboard events
    this->setFocusPolicy(Qt::StrongFocus);
    this->setFocus();
    // remove the focus from the Viewer, otherwise it will bypass the interface's events
    _poseViewer->setFocusPolicy(Qt::NoFocus);

    _mb = new QMessageBox(
        QMessageBox::Information,
        QString("Help: shortkeys"),
        QString("Shortkeys:\n"),
        QMessageBox::NoButton,
        this);
    _mb->setWindowModality(Qt::NonModal);
}
예제 #18
0
SearchView::SearchView(QWidget *parent) : QWidget(parent) {

    QFont biggerFont = FontUtils::big();
    QFont smallerFont = FontUtils::smallBold();

#if defined(APP_MAC) | defined(APP_WIN)
    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);
#endif

    QBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    // hidden message widget
    message = new QLabel(this);
    message->hide();
    mainLayout->addWidget(message);

#ifdef APP_DEMO
    QLabel *buy = new QLabel(this);
    buy->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    buy->setText(QString("<a style='color:palette(text);text-decoration:none' href='%1'>%2</a>").arg(
            QString(Constants::WEBSITE) + "#download",
            tr("Get the full version").toUpper()
            ));
    buy->setOpenExternalLinks(true);
    buy->setMargin(7);
    buy->setAlignment(Qt::AlignRight);
    buy->setStyleSheet("QLabel {"
                       "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CCD6E0, stop: 1 #ADBCCC);"
                       "border-bottom-left-radius: 8px;"
                       "border-bottom-right-radius: 8px;"
                       "font-size: 10px;"
                       "margin-right: 50px;"
                       "}");
    mainLayout->addWidget(buy, 0, Qt::AlignRight);
#endif

    mainLayout->addStretch();
    mainLayout->addSpacing(PADDING);

    QBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setAlignment(Qt::AlignCenter);
    mainLayout->addLayout(hLayout);

    QLabel *logo = new QLabel(this);
    logo->setPixmap(QPixmap(":/images/app.png"));
    hLayout->addWidget(logo, 0, Qt::AlignTop);
    hLayout->addSpacing(PADDING);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->setAlignment(Qt::AlignCenter);
    hLayout->addLayout(layout);

    QLabel *welcomeLabel =
            new QLabel("<h1 style='font-weight:normal'>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       // .replace("<a ", "<a style='color:palette(text)'")
                       .replace("<a href", "<a style='text-decoration:none; color:palette(text); font-weight:bold' href")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h1>", this);
    welcomeLabel->setOpenExternalLinks(true);
    layout->addWidget(welcomeLabel);

    layout->addSpacing(PADDING / 2);

    QBoxLayout *tipLayout = new QHBoxLayout();
    tipLayout->setSpacing(10);

    //: "Enter", as in "type". The whole frase says: "Enter a keyword to start watching videos"
    QLabel *tipLabel = new QLabel(tr("Enter"), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);

    typeCombo = new QComboBox(this);
    typeCombo->addItem(tr("a keyword"));
    typeCombo->addItem(tr("a channel"));
    typeCombo->setFont(biggerFont);
    connect(typeCombo, SIGNAL(currentIndexChanged(int)), SLOT(searchTypeChanged(int)));
    tipLayout->addWidget(typeCombo);

    tipLabel = new QLabel(tr("to start watching videos."), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);
    layout->addLayout(tipLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *searchLayout = new QHBoxLayout();
    searchLayout->setAlignment(Qt::AlignVCenter);

    queryEdit = new SearchLineEdit(this);
    queryEdit->setFont(biggerFont);
    queryEdit->setMinimumWidth(queryEdit->fontInfo().pixelSize()*15);
    queryEdit->sizeHint();
    queryEdit->setFocus(Qt::OtherFocusReason);
    connect(queryEdit, SIGNAL(search(const QString&)), this, SLOT(watch(const QString&)));
    connect(queryEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));

    youtubeSuggest = new YouTubeSuggest(this);
    channelSuggest = new ChannelSuggest(this);
    searchTypeChanged(0);

    searchLayout->addWidget(queryEdit);
    searchLayout->addSpacing(10);

    watchButton = new QPushButton(tr("Watch"), this);
    watchButton->setDefault(true);
    watchButton->setEnabled(false);
    watchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(watchButton, SIGNAL(clicked()), this, SLOT(watch()));
    searchLayout->addWidget(watchButton);

    layout->addItem(searchLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *otherLayout = new QHBoxLayout();
    otherLayout->setMargin(0);
    otherLayout->setSpacing(10);

    recentKeywordsLayout = new QVBoxLayout();
    recentKeywordsLayout->setSpacing(5);
    recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    QPalette palette = recentKeywordsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentKeywordsLabel->setPalette(palette);
#else
    recentKeywordsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentKeywordsLabel->hide();
    recentKeywordsLabel->setFont(smallerFont);
    recentKeywordsLayout->addWidget(recentKeywordsLabel);

    otherLayout->addLayout(recentKeywordsLayout);

    // recent channels
    recentChannelsLayout = new QVBoxLayout();
    recentChannelsLayout->setSpacing(5);
    recentChannelsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentChannelsLabel = new QLabel(tr("Recent channels").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    palette = recentChannelsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentChannelsLabel->setPalette(palette);
#else
    recentChannelsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentChannelsLabel->hide();
    recentChannelsLabel->setFont(smallerFont);
    recentChannelsLayout->addWidget(recentChannelsLabel);

    otherLayout->addLayout(recentChannelsLayout);

    layout->addLayout(otherLayout);

    mainLayout->addSpacing(PADDING);
    mainLayout->addStretch();

    setLayout(mainLayout);

    updateChecker = 0;

#ifndef APP_MAC_STORE
    checkForUpdate();
#endif

}
예제 #19
0
Spy::Spy(Board& b)
  :board(b)
{
  int i;

  top = new QVBoxLayout(this, 5);
  
  QLabel *l = new QLabel(this);
  l->setText( i18n("Actual examined position:") );
  l->setFixedHeight( l->sizeHint().height() );
  l->setAlignment( AlignVCenter | AlignLeft );
  top->addWidget( l );

  QHBoxLayout* b1 = new QHBoxLayout();
  top->addLayout( b1, 10 );
	
  for(i=0;i<BoardCount;i++) {
    QVBoxLayout *b2 = new QVBoxLayout();
    b1->addLayout( b2 );

    actBoard[i] = new BoardWidget(board,this);
    actLabel[i] = new QLabel(this);
    actLabel[i]->setText("---");
    // actLabel[i]->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    actLabel[i]->setAlignment( AlignHCenter | AlignVCenter);
    actLabel[i]->setFixedHeight( actLabel[i]->sizeHint().height() );

    b2->addWidget( actBoard[i] );
    b2->addWidget( actLabel[i] );
    connect( actBoard[i], SIGNAL(mousePressed()), this, SLOT(nextStep()) );
  }

  l = new QLabel(this);
  l->setText( i18n("Best move so far:") );
  l->setFixedHeight( l->sizeHint().height() );
  l->setAlignment( AlignVCenter | AlignLeft );
  top->addWidget( l );

  b1 = new QHBoxLayout();
  top->addLayout( b1, 10 );
	
  for(i=0;i<BoardCount;i++) {
    QVBoxLayout *b2 = new QVBoxLayout();
    b1->addLayout( b2 );

    bestBoard[i] = new BoardWidget(board,this);
    bestLabel[i] = new QLabel(this);
    bestLabel[i]->setText("---");
    //    bestLabel[i]->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    bestLabel[i]->setAlignment( AlignHCenter | AlignVCenter);
    bestLabel[i]->setFixedHeight( bestLabel[i]->sizeHint().height() );

    b2->addWidget( bestBoard[i] );
    b2->addWidget( bestLabel[i] );
    connect( bestBoard[i], SIGNAL(mousePressed()), this, SLOT(nextStep()) );
  }
  
  connect( &board, SIGNAL(update(int,int,Move&,bool)), 
	   this, SLOT(update(int,int,Move&,bool)) );
  connect( &board, SIGNAL(updateBest(int,int,Move&,bool)), 
	   this, SLOT(updateBest(int,int,Move&,bool)) );
  top->activate();
  setCaption(i18n("Spy"));
  // KWM::setDecoration(winId(), 2);
  resize(500,300);
}
IlluminanceMapInspectorView::IlluminanceMapInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent )
  : ModelObjectInspectorView(model, true, parent)
{
  m_isIP = isIP;

  QWidget* hiddenWidget = new QWidget();
  this->stackedWidget()->insertWidget(0, hiddenWidget);

  QWidget* visibleWidget = new QWidget();
  this->stackedWidget()->insertWidget(1, visibleWidget);

  this->stackedWidget()->setCurrentIndex(0);

  QGridLayout* mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7,7,7,7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  // name
  QVBoxLayout* vLayout = new QVBoxLayout();

  QLabel* label = new QLabel();
  label->setText("Name: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_nameEdit = new OSLineEdit();
  vLayout->addWidget(m_nameEdit);

  mainGridLayout->addLayout(vLayout,0,0,1,2, Qt::AlignTop);

  // x, y, and z
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("X Coordinate: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_xCoordinateEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_xCoordinateEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_xCoordinateEdit);

  mainGridLayout->addLayout(vLayout,1,0, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Y Coordinate: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_yCoordinateEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_yCoordinateEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_yCoordinateEdit);

  mainGridLayout->addLayout(vLayout,1,1, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Z Coordinate: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_zCoordinateEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_zCoordinateEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_zCoordinateEdit);

  mainGridLayout->addLayout(vLayout,1,2, Qt::AlignTop|Qt::AlignLeft);

  // psi, theta, and phi
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Psi Rotation About X: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_psiRotationEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_psiRotationEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_psiRotationEdit);

  mainGridLayout->addLayout(vLayout,2,0, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Theta Rotation About Y: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_thetaRotationEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_thetaRotationEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_thetaRotationEdit);

  mainGridLayout->addLayout(vLayout,2,1, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Phi Rotation About Y: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_phiRotationEdit = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_phiRotationEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_phiRotationEdit);

  mainGridLayout->addLayout(vLayout,2,2, Qt::AlignTop|Qt::AlignLeft);

  // x length and number of x points
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("X Length: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_xLength = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_xLength, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_xLength);

  mainGridLayout->addLayout(vLayout,3,0, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Number of X Points: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_numberOfXPoints = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_numberOfXPoints, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_numberOfXPoints);

  mainGridLayout->addLayout(vLayout,3,1, Qt::AlignTop|Qt::AlignLeft);

  // y length and number of y points
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Y Length: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_yLength = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_yLength, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_yLength);

  mainGridLayout->addLayout(vLayout,4,0, Qt::AlignTop|Qt::AlignLeft);

  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Number of Y Points: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_numberOfYPoints = new OSQuantityEdit(m_isIP);
  connect(this, &IlluminanceMapInspectorView::toggleUnitsClicked, m_numberOfYPoints, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_numberOfYPoints);

  mainGridLayout->addLayout(vLayout,4,1, Qt::AlignTop|Qt::AlignLeft);
  mainGridLayout->setColumnMinimumWidth(0, 80);
  mainGridLayout->setColumnMinimumWidth(1, 80);
  mainGridLayout->setColumnMinimumWidth(2, 80);
  mainGridLayout->setColumnStretch(3,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowMinimumHeight(3, 30);
  mainGridLayout->setRowMinimumHeight(4, 30);
  mainGridLayout->setRowStretch(5,1);
}
MarketBuildOptionsDialog::MarketBuildOptionsDialog(const QString& CommonBuildOptions,
                                                   const QString& BuildOptions, const QString& SimID)
: QDialog(), m_CommonBuildOptions(CommonBuildOptions),m_BuildOptions(BuildOptions),m_SimID(SimID)
{

  setMinimumSize(450,0);

  QLabel *InfoLabel = new QLabel();
  InfoLabel->setText("<i>"+tr("These options control the builds of source packages.<br/>"
                              "Changing this is at your own risk.")+"</i>");
  InfoLabel->setAlignment(Qt::AlignHCenter);

  QLabel *CommonOptsLabel = new QLabel();

  if (!SimID.isEmpty())
  {
    QString Options = QString::fromStdString(openfluid::tools::replaceEmptyString(CommonBuildOptions.toStdString(),
                                                                                  tr("<i>none</i>").toStdString()));
    CommonOptsLabel->setText("<u>"+tr("Common source build options:")+"</u><br/>" + Options);
  }
  else
    CommonOptsLabel->setText("");


  QLabel *EditLabel = new QLabel();
  if (!SimID.isEmpty())
  {
    EditLabel->setText(tr("Specific build options for %1:").arg(SimID));
  }
  else
  {
    EditLabel->setText(tr("Common source build options:"));
  }


  if (SimID.isEmpty()) m_OptionsEntry.setText(CommonBuildOptions);
  else m_OptionsEntry.setText(BuildOptions);


  QDialogButtonBox *ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok
                                      | QDialogButtonBox::Cancel);

  connect(ButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
  connect(ButtonBox, SIGNAL(rejected()), this, SLOT(reject()));


  QVBoxLayout *MainLayout = new QVBoxLayout();

  MainLayout->addWidget(InfoLabel);
  MainLayout->addSpacing(10);
  MainLayout->addWidget(CommonOptsLabel);
  MainLayout->addSpacing(10);
  MainLayout->addWidget(EditLabel);
  MainLayout->addWidget(&m_OptionsEntry);
  MainLayout->addWidget(ButtonBox);


  if(m_SimID.isEmpty())
    setWindowTitle(tr("Common build options for all source packages"));
  else
    setWindowTitle(tr("Build options for %1").arg(m_SimID));

  setLayout(MainLayout);
}
QWidget *MessageDisplayWidget::createNewRow(const QString &name, const QString &message/*, const QString &timestamp*/, int messageId, bool isOur)
{
    OpacityWidget *widget = new OpacityWidget(this);
    widget->setProperty("class", "msgRow"); // for CSS styling

    ElideLabel *nameLabel = new ElideLabel(widget);
    nameLabel->setMaximumWidth(50);
    nameLabel->setTextElide(true);
    nameLabel->setTextElideMode(Qt::ElideRight);
    nameLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    nameLabel->setToolTip(name);
    nameLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);

    MessageLabel *messageLabel = new MessageLabel(widget);
    messageLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
    QString messageText = EmoticonMenu::smile(urlify(message.toHtmlEscaped())).replace('\n', "<br>");
    // Action
    if(messageId < -1) {
        QPalette actionPal;
        actionPal.setColor(QPalette::Foreground, Qt::darkGreen);
        messageLabel->setPalette(actionPal);
        messageLabel->setProperty("class", "msgAction"); // for CSS styling
        messageLabel->setText(QString("<i>%1</i>").arg(messageText));
    }
    // Message
    else if (messageId != 0) {
        messageLabel->setMessageId(messageId);
        messageLabel->setProperty("class", "msgMessage"); // for CSS styling
        messageLabel->setText(messageText);
    }
    // Error
    else {
        QPalette errorPal;
        errorPal.setColor(QPalette::Foreground, Qt::red);
        messageLabel->setPalette(errorPal);
        messageLabel->setProperty("class", "msgError"); // for CSS styling
        messageLabel->setText(QString("<img src=\":/icons/error.png\" /> %1").arg(messageText));
        messageLabel->setToolTip(tr("Couldn't send the message!"));
    }

    QLabel *timeLabel = new QLabel(widget);
    timeLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    timeLabel->setForegroundRole(QPalette::Mid);
    timeLabel->setProperty("class", "msgTimestamp"); // for CSS styling
    timeLabel->setAlignment(Qt::AlignRight | Qt::AlignTop | Qt::AlignTrailing);
    timeLabel->setText(QTime::currentTime().toString("hh:mm:ss"));

    // Insert name if sender changed.
    if (lastMessageIsOurs != isOur || mainlayout->count() < 1 || messageId < -1) {
        nameLabel->setText(name);

        if (isOur) {
            nameLabel->setForegroundRole(QPalette::Mid);
            nameLabel->setProperty("class", "msgUserName"); // for CSS styling
        } else {
            nameLabel->setProperty("class", "msgFriendName"); // for CSS styling
        }

        // Create line
        if (lastMessageIsOurs != isOur && mainlayout->count() > 0) {
            QFrame *line = new QFrame(this);
            line->setFrameShape(QFrame::HLine);
            line->setFrameShadow(QFrame::Plain);
            line->setForegroundRole(QPalette::Midlight);
            line->setProperty("class", "msgLine"); // for CSS styling
            mainlayout->addWidget(line);
        }

        lastMessageIsOurs = isOur;
    }

    // Return new line
    QHBoxLayout *hlayout = new QHBoxLayout(widget);
    hlayout->setContentsMargins(0, 0, 0, 0);
    hlayout->setMargin(0);
    hlayout->addWidget(nameLabel, 0, Qt::AlignTop);
    hlayout->addWidget(messageLabel, 0, Qt::AlignTop);
    hlayout->addWidget(timeLabel, 0, Qt::AlignTop);
    widget->setLayout(hlayout);

    return widget;
}
예제 #23
0
파일: CTreeView.cpp 프로젝트: raymyers/gnat
////////////////////////////////////////////////////////////////////////////////
/// CTreeView::setupToolBar
///
/// @description  This function initializes the toolbar that is used for the
///               tree view.
/// @pre          None
/// @post         The tree view toolbar is initialized.
///
/// @limitations  None
///
////////////////////////////////////////////////////////////////////////////////
void CTreeView::setupToolBar()
{
    QAction *tempAction;
    QLabel *tempLabel;
    QToolButton *tempButton;
    // Create toolbar.
    m_toolBar = new QToolBar( "Puzzle View", this );

    // "Reorient View" button
    tempAction = m_toolBar->addAction( QIcon(":/orient.png"), "Reorient view" );
    connect( tempAction, SIGNAL(activated()), this, SLOT(switchOrientation()) );

    // "Show Graph" toggle button
    tempAction = m_toolBar->addAction( QIcon(":/graph.png"), "Show Graph" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(setShown(bool)) );

    // "Show Trace" toggle button
    tempAction = m_toolBar->addAction(QIcon(":/trace.png"), "Show Trace" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_traceView,
             SLOT(setShown(bool)) );

    m_toolBar->addSeparator();

    // "Quick Edit Mode" toggle button
    m_quickEditAction = m_toolBar->addAction(QIcon(":/quickedit.png"),
                                      "Toggle Quick Edit Mode" );
    m_quickEditAction->setCheckable( true );
    m_quickEditAction->setChecked( false );
    connect( m_quickEditAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(setQuickEdit(bool)) );

    // "Generate Tree" button
    tempAction = m_toolBar->addAction(QIcon(":/graph.png"), "Generate Tree" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(generateTree()) );

    // "Auto Name" button
    tempAction = m_toolBar->addAction(QIcon(":/autoname.png"), "Auto Name" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoName()) );

    // "Auto Number" button
    tempAction = m_toolBar->addAction(QIcon(":/autonumber.png"), "Auto Number" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoNumber()) );

    // "Auto Layout" button
    tempAction = m_toolBar->addAction(QIcon(":/autolayout.png"), "Auto Layout");
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoLayout()) );

    m_toolBar->addSeparator();

    // "AI Config Menu" button
    m_toolBar->addWidget(m_traceView->getAIConfigButton());

    // AI Label
    tempLabel = m_traceView->getAILabel();
    m_toolBar->addWidget( tempLabel );

    // Depth spinbox
    tempLabel = new QLabel( m_toolBar );
    tempLabel->setTextFormat(Qt::AutoText);
    tempLabel->setText( "  Depth" );
    m_toolBar->addWidget( tempLabel );
    m_toolBar->addWidget( m_traceView->getDepthSelector() );

    // QS Depth spinbox
    tempLabel = new QLabel( m_toolBar );
    tempLabel->setText( "  QS Depth" );
    m_toolBar->addWidget( tempLabel );
    m_toolBar->addWidget( m_traceView->getQSDepthSelector() );

    // "Save Trace" button
    tempAction = m_toolBar->addAction(QIcon(":/latex.png"), "Save Trace");
    connect( tempAction, SIGNAL(activated()), m_traceView, SLOT(saveTrace()) );
}
예제 #24
0
InspectorNote::InspectorNote(QWidget* parent)
   : InspectorBase(parent)
      {
      b.setupUi(addWidget());
      n.setupUi(addWidget());
      c.setupUi(addWidget());
      s.setupUi(addWidget());

      static const int heads[] = {
            Note::HEAD_NORMAL,
            Note::HEAD_CROSS,
            Note::HEAD_DIAMOND,
            Note::HEAD_TRIANGLE,
            Note::HEAD_SLASH,
            Note::HEAD_XCIRCLE,
            Note::HEAD_DO,
            Note::HEAD_RE,
            Note::HEAD_MI,
            Note::HEAD_FA,
            Note::HEAD_SOL,
            Note::HEAD_LA,
            Note::HEAD_TI,
            Note::HEAD_BREVIS_ALT
            };

      //
      // fix order of note heads
      //
      for (int i = 0; i < Note::HEAD_GROUPS; ++i)
            n.noteHeadGroup->setItemData(i, QVariant(heads[i]));

      // noteHeadType starts at -1
      for (int i = 0; i < 5; ++i)
            n.noteHeadType->setItemData(i, i-1);

      iList = {
            { P_COLOR,          0, 0, b.color,         b.resetColor         },
            { P_VISIBLE,        0, 0, b.visible,       b.resetVisible       },
            { P_USER_OFF,       0, 0, b.offsetX,       b.resetX             },
            { P_USER_OFF,       1, 0, b.offsetY,       b.resetY             },

            { P_SMALL,          0, 0, n.small,         n.resetSmall         },
            { P_HEAD_GROUP,     0, 0, n.noteHeadGroup, n.resetNoteHeadGroup },
            { P_HEAD_TYPE,      0, 0, n.noteHeadType,  n.resetNoteHeadType  },
            { P_MIRROR_HEAD,    0, 0, n.mirrorHead,    n.resetMirrorHead    },
            { P_DOT_POSITION,   0, 0, n.dotPosition,   n.resetDotPosition   },
            { P_TUNING,         0, 0, n.tuning,        n.resetTuning        },
            { P_VELO_TYPE,      0, 0, n.velocityType,  n.resetVelocityType  },
            { P_VELO_OFFSET,    0, 0, n.velocity,      n.resetVelocity      },

            { P_USER_OFF,       0, 1, c.offsetX,       c.resetX             },
            { P_USER_OFF,       1, 1, c.offsetY,       c.resetY             },
            { P_SMALL,          0, 1, c.small,         c.resetSmall         },
            { P_NO_STEM,        0, 1, c.stemless,      c.resetStemless      },
            { P_STEM_DIRECTION, 0, 1, c.stemDirection, c.resetStemDirection },

            { P_LEADING_SPACE,  0, 2, s.leadingSpace,  s.resetLeadingSpace  },
            { P_TRAILING_SPACE, 0, 2, s.trailingSpace, s.resetTrailingSpace }
            };

      mapSignals();

      //
      // Select
      //
      QLabel* l = new QLabel;
      l->setText(tr("Select"));
      QFont font(l->font());
      font.setBold(true);
      l->setFont(font);
      l->setAlignment(Qt::AlignHCenter);
      _layout->addWidget(l);
      QFrame* f = new QFrame;
      f->setFrameStyle(QFrame::HLine | QFrame::Raised);
      f->setLineWidth(2);
      _layout->addWidget(f);

      QHBoxLayout* hbox = new QHBoxLayout;
      dot1 = new QToolButton(this);
      dot1->setText(tr("Dot1"));
      dot1->setEnabled(false);
      hbox->addWidget(dot1);
      dot2 = new QToolButton(this);
      dot2->setText(tr("Dot2"));
      dot2->setEnabled(false);
      hbox->addWidget(dot2);
      dot3 = new QToolButton(this);
      dot3->setText(tr("Dot3"));
      dot3->setEnabled(false);
      hbox->addWidget(dot3);
      hook = new QToolButton(this);
      hook->setText(tr("Hook"));
      hook->setEnabled(false);
      hbox->addWidget(hook);
      _layout->addLayout(hbox);

      hbox = new QHBoxLayout;
      stem = new QToolButton(this);
      stem->setText(tr("Stem"));
      stem->setEnabled(false);
      hbox->addWidget(stem);
      beam = new QToolButton(this);
      beam->setText(tr("Beam"));
      beam->setEnabled(false);
      hbox->addWidget(beam);
      _layout->addLayout(hbox);

      connect(dot1,     SIGNAL(clicked()),     SLOT(dot1Clicked()));
      connect(dot2,     SIGNAL(clicked()),     SLOT(dot2Clicked()));
      connect(dot3,     SIGNAL(clicked()),     SLOT(dot3Clicked()));
      connect(hook,     SIGNAL(clicked()),     SLOT(hookClicked()));
      connect(stem,     SIGNAL(clicked()),     SLOT(stemClicked()));
      connect(beam,     SIGNAL(clicked()),     SLOT(beamClicked()));
      }
예제 #25
0
PropertyTimelineWidget::PropertyTimelineWidget(std::string name, PropertyTimeline* propertyTimeline, QWidget* parent)
        : QWidget(parent)
        , propertyTimeline_(propertyTimeline)
        , inInterpolationMenu_(0)
        , outInterpolationMenu_(0)
        {
    guiName_ = name;
    id_ = name;
    mainLayout_ = new QHBoxLayout(this);

    mainLayout_->setMargin(0);
    mainLayout_->setSpacing(0);
    currentFrameGraphicsItem_ = new CurrentFrameGraphicsItem(false, false);

    smoothItem_ = new QGraphicsEllipseItem(0, 0, 8, 8);
    smoothItem_->setBrush(QBrush(QColor(50,255,50)));
    smoothItem_->moveBy(10, -7);
    smoothItem_->setCursor(Qt::ArrowCursor);
    smoothTextItem_ = new QGraphicsSimpleTextItem("smoothness");
    smoothTextItem_->moveBy(22, -10);
    smoothGroup_ = new QGraphicsItemGroup();
    smoothGroup_->addToGroup(smoothItem_);
    smoothGroup_->addToGroup(smoothTextItem_);
    smoothGroup_->hide();
    smoothGroup_->setZValue(5);
    propertyTimelineScene_ = new QGraphicsScene(this);

    propertyTimelineView_ = new PropertyTimelineView(propertyTimelineScene_);
    propertyTimelineView_->setStyleSheet("background:transparent");
    propertyTimelineView_->setFixedHeight(40);
    connect(propertyTimelineView_, SIGNAL(mousePressedAt(QPointF, const QGraphicsItem*)), this, SLOT(interpolationSelectorPressed(QPointF, const QGraphicsItem*)));

    inInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1leftarrow.png"));
    outInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1rightarrow.png"));
    inInterpolationSelector_->setCursor(Qt::ArrowCursor);
    outInterpolationSelector_->setCursor(Qt::ArrowCursor);

    inInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true);
    outInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true);

    propertyTimelineScene_->addItem(smoothGroup_);

    propertyTimelineScene_->addItem(inInterpolationSelector_);
    propertyTimelineScene_->addItem(outInterpolationSelector_);
    currentFrameCounter_ = propertyTimelineScene_->addText("0");
    inInterpolationSelector_->setPos(20, 20);
    outInterpolationSelector_->setPos(40, 20);
    inInterpolationSelector_->setZValue(2);
    outInterpolationSelector_->setZValue(2);

    activateTimelineButton_ = new QPushButton(QIcon(":/qt/icons/apply.png"), "", this);
    showFrameHUD(false);

    activateTimelineButton_->setToolTip(tr("Activate or deactivate timeline"));
    activateTimelineButton_->setStyleSheet("QToolButton { border: none; padding: 1px; }");
    activateTimelineButton_->setFlat(true);
    activateTimelineButton_->setFocusPolicy(Qt::NoFocus);
    activateTimelineButton_->setCheckable(true);
    activateTimelineButton_->setMaximumWidth(16);
    activateTimelineButton_->setMaximumHeight(16);
    activateTimelineButton_->setChecked(propertyTimeline->getActiveOnRendering());

    // note: this is duplicated in activateTimeline() below
    if (!propertyTimeline->getActiveOnRendering())
        activateTimelineButton_->setIcon(QIcon(":/qt/icons/button_cancel.png"));
    else
        activateTimelineButton_->setIcon(QIcon(":/qt/icons/apply.png"));


    connect(activateTimelineButton_, SIGNAL(toggled(bool)), this, SLOT(activateTimeline(bool)));

    setFps(30.0f);

    mainLayout_->addWidget(propertyTimelineView_);
    mainLayout_->addWidget(activateTimelineButton_);
    QLabel* nameLabel = new QLabel(this);
    nameLabel->move(8, 18);
    nameLabel->lower();
    nameLabel->setText(QString::fromStdString(name));
    nameLabel->setMinimumWidth(300);
    nameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    nameLabel->setEnabled(false);
    setCurrentFrame(0);
    propertyTimelineScene_->addItem(currentFrameGraphicsItem_);

    inInterpolationSelector_->show();
    outInterpolationSelector_->show();
    showFrameHUD(false);
    currentFrameGraphicsItem_->setPos(0, 1);
    currentFrameGraphicsItem_->setZValue(0.5);
    fps_ = 30.0f;
    setDuration(AnimationEditor::getDuration());
}
예제 #26
0
Rombo::Rombo(QWidget *romboWidget)
        : QWidget(romboWidget)
{
    /*
     * Frame contenuti nel widget rombo
     */
    QVBoxLayout *romboWidgetLayout = new QVBoxLayout(romboWidget);
    QFrame *romboWidget_up = new QFrame(romboWidget);
    romboWidget_up->setMaximumSize(QSize(16777215, 50));
    QHBoxLayout *romboWidget_up_Layout = new QHBoxLayout(romboWidget_up);

    QLabel *romboMaxWidthLabel = new QLabel(romboWidget_up);
    romboWidget_up_Layout->addWidget(romboMaxWidthLabel);
    romboMaxWidthLabel->setText("Larghezza massima");

    romboSpin = new QSpinBox(romboWidget_up);
    romboWidget_up_Layout->addWidget(romboSpin);
    romboSpin->setMaximumWidth(60);
    romboSpin->setMinimum(10);
    romboSpin->setMaximum(300);
    romboSpin->setValue(60);
    romboSpin->setSingleStep(5);
    romboSpin->setContextMenuPolicy(Qt::NoContextMenu);

    QPushButton *romboStartButton = new QPushButton(romboWidget_up);
    romboWidget_up_Layout->addWidget(romboStartButton);
    romboStartButton->setText("&Vai all'inizio");
    romboStartButton->setCheckable(false);

    romboNextButton = new QPushButton(romboWidget_up);
    romboWidget_up_Layout->addWidget(romboNextButton);
    romboNextButton->setText("&Successivo");
    romboNextButton->setCheckable(false);
    romboNextButton->setEnabled(false);

    romboWidgetLayout->addWidget(romboWidget_up);

    QFrame *romboWidget_down = new QFrame(romboWidget);
    QHBoxLayout *romboWidget_down_Layout = new QHBoxLayout(romboWidget_down);

    romboField = new QWidget(romboWidget_down);
    romboWidget_down_Layout->addWidget(romboField);

    romboWidgetLayout->addWidget(romboWidget_down);

    QVBoxLayout *romboFieldLayout = new QVBoxLayout(romboField);

    romboLineEdit = new QLineEdit(romboField);
    romboFieldLayout->addWidget(romboLineEdit);
    romboLineEdit->setAlignment(Qt::AlignHCenter);
    romboLineEdit->setReadOnly(true);
    romboLineEdit->setStyleSheet("background: url(':/altro/sfondo-rosso.png') repeat-y center; font-size: 14pt");
    romboLineEdit->setContextMenuPolicy(Qt::NoContextMenu);

    /*
     * Connect
     */
    connect(romboStartButton, SIGNAL(clicked()), this, SLOT(onStartButton()));
    connect(romboNextButton, SIGNAL(clicked()), this, SLOT(onNextButton()));

}
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const
{
    QWidget *widget = new QWidget(parent);
    QVBoxLayout *layout = new QVBoxLayout;
    // code + white-space:pre so the padding (see below) works properly
    // don't include frameName here as it should wrap if required and pre-line is not supported
    // by Qt yet it seems
    const QString displayTextTemplate = QString("<code style='white-space:pre'>%1:</code> %2");

    QString relativeTo = relativeToPath();

    const Error error = errorIndex.data(ErrorListModel::ErrorRole).value<Error>();

    QLabel *errorLabel = new QLabel();
    errorLabel->setWordWrap(true);
    errorLabel->setContentsMargins(0, 0, 0, 0);
    errorLabel->setMargin(0);
    errorLabel->setIndent(0);
    QPalette p = errorLabel->palette();
    QColor lc = p.color(QPalette::Text);
    QString linkStyle = QString("style=\"color:rgba(%1, %2, %3, %4);\"")
                            .arg(lc.red()).arg(lc.green()).arg(lc.blue()).arg(int(0.7 * 255));
    p.setBrush(QPalette::Text, p.highlightedText());
    errorLabel->setPalette(p);
    errorLabel->setText(QString("%1&nbsp;&nbsp;<span %4>%2</span>")
                            .arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
                                 linkStyle));
    connect(errorLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
    layout->addWidget(errorLabel);

    const QVector<Stack> stacks = error.stacks();
    for (int i = 0; i < stacks.count(); ++i) {
        const Stack &stack = stacks.at(i);
        // auxwhat for additional stacks
        if (i > 0) {
            QLabel *stackLabel = new QLabel(stack.auxWhat());
            stackLabel->setWordWrap(true);
            stackLabel->setContentsMargins(0, 0, 0, 0);
            stackLabel->setMargin(0);
            stackLabel->setIndent(0);
            QPalette p = stackLabel->palette();
            p.setBrush(QPalette::Text, p.highlightedText());
            stackLabel->setPalette(p);
            layout->addWidget(stackLabel);
        }
        int frameNr = 1;
        foreach (const Frame &frame, stack.frames()) {
            QString frameName = makeFrameName(frame, relativeTo);
            QTC_ASSERT(!frameName.isEmpty(), qt_noop());

            QLabel *frameLabel = new QLabel(widget);
            frameLabel->setAutoFillBackground(true);
            if (frameNr % 2 == 0) {
                // alternating rows
                QPalette p = frameLabel->palette();
                p.setBrush(QPalette::Base, p.alternateBase());
                frameLabel->setPalette(p);
            }
            frameLabel->setFont(QFont("monospace"));
            connect(frameLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
            // pad frameNr to 2 chars since only 50 frames max are supported by valgrind
            const QString displayText = displayTextTemplate
                                            .arg(frameNr++, 2).arg(frameName);
            frameLabel->setText(displayText);

            frameLabel->setToolTip(Valgrind::XmlProtocol::toolTipForFrame(frame));
            frameLabel->setWordWrap(true);
            frameLabel->setContentsMargins(0, 0, 0, 0);
            frameLabel->setMargin(0);
            frameLabel->setIndent(10);
            layout->addWidget(frameLabel);
        }
    }

    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    widget->setLayout(layout);
    return widget;
}
예제 #28
0
파일: mainform.cpp 프로젝트: andrei-b/YAGF
MainForm::MainForm(QWidget *parent): QMainWindow(parent)
{
    setupUi(this);

    ///!!!!!
    //alignButton->hide();
    //unalignButton->hide();


    setWindowTitle("YAGF");
    spellChecker = new SpellChecker(textEdit);
    spellChecker->enumerateDicts();
    selectLangsBox = new QComboBox();
    QLabel *label = new QLabel();
    label->setMargin(4);
    label->setText(trUtf8("Recognition language"));
    frame->show();
    toolBar->addWidget(label);
    selectLangsBox->setFrame(true);
    toolBar->addWidget(selectLangsBox);
    graphicsInput = new QGraphicsInput(QRectF(0, 0, 2000, 2000), graphicsView) ;
    graphicsInput->addToolBarAction(actionHideShowTolbar);
    graphicsInput->addToolBarAction(this->actionTBLV);
    graphicsInput->addToolBarAction(this->actionSmaller_view);
    graphicsInput->addToolBarSeparator();
    graphicsInput->addToolBarAction(actionRotate_90_CCW);
    graphicsInput->addToolBarAction(actionRotate_180);
    graphicsInput->addToolBarAction(actionRotate_90_CW);
    graphicsInput->addToolBarAction(actionDeskew);
    graphicsInput->addToolBarSeparator();
    graphicsInput->addToolBarAction(actionSelect_Text_Area);
    graphicsInput->addToolBarAction(actionSelect_multiple_blocks);
    graphicsInput->addToolBarAction(ActionClearAllBlocks);

    statusBar()->show();
    imageLoaded = false;
    useXSane = TRUE;
    textSaved = TRUE;
    hasCopy = false;
    //rotation = 0;
    m_menu = new QMenu(graphicsView);
    ifCounter = 0;

    connect(actionOpen, SIGNAL(triggered()), this, SLOT(loadImage()));
    connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(this, SIGNAL(windowShown()), this, SLOT(onShowWindow()), Qt::QueuedConnection);
    connect(actionScan, SIGNAL(triggered()), this, SLOT(scanImage()));
    connect(actionPreviousPage, SIGNAL(triggered()), this, SLOT(loadPreviousPage()));
    connect(actionNextPage, SIGNAL(triggered()), this, SLOT(loadNextPage()));
    connect(actionRecognize, SIGNAL(triggered()), this, SLOT(recognize()));
    connect(action_Save, SIGNAL(triggered()), this, SLOT(saveText()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDlg()));
    connect(actionOnlineHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(actionCopyToClipboard, SIGNAL(triggered()), this, SLOT(copyClipboard()));
    textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(textEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
    connect(textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(copyAvailable(bool)));
    connect(textEdit, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(graphicsInput, SIGNAL(rightMouseClicked(int, int, bool)), this, SLOT(rightMouseClicked(int, int, bool)));


    tesMap = new TesMap();
    fillLanguagesBox();
    initSettings();
    delTmpFiles();
    scanProcess = new QProcess(this);
    QXtUnixSignalCatcher::connectUnixSignal(SIGUSR2);
    ba = new QByteArray();
    connect(QXtUnixSignalCatcher::catcher(), SIGNAL(unixSignal(int)), this, SLOT(readyRead(int)));

    connect(textEdit->document(), SIGNAL(cursorPositionChanged(const QTextCursor &)), this, SLOT(updateSP()));

    //displayLabel->installEventFilter(this);
    textEdit->installEventFilter(this);
    QPixmap l_cursor;
    l_cursor.load(":/resize.png");
    resizeCursor = new QCursor(l_cursor);
    graphicsInput->setMagnifierCursor(resizeCursor);
    l_cursor.load(":/resize_block.png");
    resizeBlockCursor = new QCursor(l_cursor);
   // textEdit->setContextMenuPolicy(Qt::ActionsContextMenu);

    this->sideBar->show();
    connect(sideBar, SIGNAL(fileSelected(const QString &)), this, SLOT(fileSelected(const QString &)));

    connect(actionRecognize_All_Pages, SIGNAL(triggered()), this, SLOT(recognizeAll()));

    graphicsInput->setSideBar(sideBar);

    QPixmap pm;
    pm.load(":/align.png");
    //alignButton->setIcon(pm);
    pm.load(":/undo.png");
    //unalignButton->setIcon(pm);
    //connect(unalignButton, SIGNAL(clicked()), this, SLOT(unalignButtonClicked()));

    //clearBlocksButton->setDefaultAction(ActionClearAllBlocks);
    loadFromCommandLine();
    emit windowShown();

    pdfx = NULL;
    if (findProgram("pdftoppm")) {
        pdfx = new PDF2PPT();
    } else
    if (findProgram("gs")) {
         pdfx = new GhostScr();
    }

    if (pdfx) {
        connect(pdfx, SIGNAL(addPage(QString)), this, SLOT(addPDFPage(QString)), Qt::QueuedConnection);
        connect (pdfx, SIGNAL(finished()), this, SLOT(finishedPDF()));
    }

    pdfPD.setWindowTitle("YAGF");
    pdfPD.setLabelText(trUtf8("Importing pages from the PDF document..."));
    pdfPD.setCancelButtonText(trUtf8("Cancel"));
    pdfPD.setMinimum(-1);
    pdfPD.setMaximum(-1);
    pdfPD.setWindowIcon(QIcon(":/yagf.png"));
    if (pdfx)
        connect(&pdfPD, SIGNAL(canceled()), pdfx, SLOT(cancel()));

}
예제 #29
0
void SummaryWidget::updateView()
{
  mLayouts.setAutoDelete( true );
  mLayouts.clear();
  mLayouts.setAutoDelete( false );

  mLabels.setAutoDelete( true );
  mLabels.clear();
  mLabels.setAutoDelete( false );

  if ( mStations.count() == 0 ) {
    kdDebug(5602) << "No weather stations defined..." << endl;
    return;
  }


  QValueList<WeatherData> dataList = mWeatherMap.values();
  qHeapSort( dataList );

  QValueList<WeatherData>::Iterator it;
  for ( it = dataList.begin(); it != dataList.end(); ++it ) {
    QString cover;
    for ( uint i = 0; i < (*it).cover().count(); ++i )
      cover += QString( "- %1\n" ).arg( (*it).cover()[ i ] );

    QImage img;
    img = (*it).icon();

    QGridLayout *layout = new QGridLayout( mLayout, 3, 3, 3 );
    mLayouts.append( layout );

    KURLLabel* urlLabel = new KURLLabel( this );
    urlLabel->installEventFilter( this );
    urlLabel->setURL( (*it).stationID() );
    urlLabel->setPixmap( img.smoothScale( 32, 32 ) );
    urlLabel->setMaximumSize( urlLabel->sizeHint() );
    urlLabel->setAlignment( AlignTop );
    layout->addMultiCellWidget( urlLabel, 0, 1, 0, 0 );
    mLabels.append( urlLabel );
    connect ( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
              this, SLOT( showReport( const QString& ) ) );

    QLabel* label = new QLabel( this );
    label->setText( QString( "%1 (%2)" ).arg( (*it).name() ).arg( (*it).temperature() ) );
    QFont font = label->font();
    font.setBold( true );
    label->setFont( font );
    label->setAlignment( AlignLeft );
    layout->addMultiCellWidget( label, 0, 0, 1, 2 );
    mLabels.append( label );

    QString labelText;
    labelText = QString( "<b>%1:</b> %2<br>"
                         "<b>%3:</b> %4<br>"
                         "<b>%5:</b> %6" )
                         .arg( i18n( "Last updated on" ) )
                         .arg( (*it).date() )
                         .arg( i18n( "Wind Speed" ) )
                         .arg( (*it).windSpeed() )
                         .arg( i18n( "Rel. Humidity" ) )
                         .arg( (*it).relativeHumidity() );

    QToolTip::add( label, labelText.replace( " ", "&nbsp;" ) );

    label = new QLabel( cover, this );
    label->setAlignment( AlignLeft );
    layout->addMultiCellWidget( label, 1, 1, 1, 2 );
    mLabels.append( label );
  }

  for ( QLabel *label = mLabels.first(); label; label = mLabels.next() )
    label->show();
}
AnnotsPropertiesDialog::AnnotsPropertiesDialog( QWidget *parent, Okular::Document *document, int docpage, Okular::Annotation *ann )
    : KPageDialog( parent ), m_document( document ), m_page( docpage ), modified( false )
{
    setFaceType( Tabbed );
    m_annot=ann;
    const bool canEditAnnotations = m_document->canModifyPageAnnotation( ann );
    setCaptionTextbyAnnotType();
    if ( canEditAnnotations )
    {
        setButtons( Ok | Apply | Cancel );
        enableButton( Apply, false );
        connect( this, SIGNAL(applyClicked()), this, SLOT(slotapply()) );
        connect( this, SIGNAL(okClicked()), this, SLOT(slotapply()) );
    }
    else
    {
        setButtons( Close );
        setDefaultButton( Close );
    }

    m_annotWidget = AnnotationWidgetFactory::widgetFor( ann );

    QLabel* tmplabel;
  //1. Appearance
    //BEGIN tab1
    QFrame *page = new QFrame( this );
    addPage( page, i18n( "&Appearance" ) );
    QGridLayout * gridlayout = new QGridLayout( page );

    tmplabel = new QLabel( i18n( "&Color:" ), page );
    gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
    colorBn = new KColorButton( page );
    colorBn->setColor( ann->style().color() );
    colorBn->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( colorBn );
    gridlayout->addWidget( colorBn, 0, 1 );

    tmplabel = new QLabel( i18n( "&Opacity:" ), page );
    gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight );
    m_opacity = new KIntNumInput( page );
    m_opacity->setRange( 0, 100 );
    m_opacity->setValue( (int)( ann->style().opacity() * 100 ) );
    m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) );
    m_opacity->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( m_opacity );
    gridlayout->addWidget( m_opacity, 1, 1 );

    QWidget * configWidget = 0;
    if ( m_annotWidget && ( configWidget = m_annotWidget->styleWidget() ) )
    {
        gridlayout->addWidget( configWidget, 2, 0, 1, 2 );
        configWidget->setEnabled( canEditAnnotations );
    }

    gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );
    //END tab1

    //BEGIN tab 2
    page = new QFrame( this );
    addPage( page, i18n( "&General" ) );
//    m_tabitem[1]->setIcon( KIcon( "fonts" ) );
    gridlayout = new QGridLayout( page );
    tmplabel = new QLabel( i18n( "&Author:" ), page );
    AuthorEdit = new KLineEdit( ann->author(), page );
    AuthorEdit->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( AuthorEdit );
    gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
    gridlayout->addWidget( AuthorEdit, 0, 1 );

    tmplabel = new QLabel( page );
    tmplabel->setText( i18n( "Created: %1", KGlobal::locale()->formatDateTime( ann->creationDate(), KLocale::LongDate, true ) ) );
    tmplabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
    gridlayout->addWidget( tmplabel, 1, 0, 1, 2 );

    m_modifyDateLabel = new QLabel( page );
    m_modifyDateLabel->setText( i18n( "Modified: %1", KGlobal::locale()->formatDateTime( ann->modificationDate(), KLocale::LongDate, true ) ) );
    m_modifyDateLabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
    gridlayout->addWidget( m_modifyDateLabel, 2, 0, 1, 2 );

    gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );
    //END tab 2

    QWidget * extraWidget = 0;
    if ( m_annotWidget && ( extraWidget = m_annotWidget->extraWidget() ) )
    {
        addPage( extraWidget, extraWidget->windowTitle() );
    }

    //BEGIN connections
    connect( colorBn, SIGNAL(changed(QColor)), this, SLOT(setModified()) );
    connect( m_opacity, SIGNAL(valueChanged(int)), this, SLOT(setModified()) );
    connect( AuthorEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()) );
    if ( m_annotWidget )
    {
        connect( m_annotWidget, SIGNAL(dataChanged()), this, SLOT(setModified()) );
    }
    //END

#if 0
    kDebug() << "Annotation details:";
    kDebug().nospace() << " => unique name: '" << ann->uniqueName() << "'";
    kDebug() << " => flags:" << QString::number( m_annot->flags(), 2 );
#endif

    resize( sizeHint() );
}