コード例 #1
0
    ConnectionTab::ConnectionTab(QWidget *parent)
        : QWidget(parent)
    {
        const short int labelWidth = 120;

        QLabel* bandwidthLabel = new QLabel(tr("Bandwidth limit [kB]:"));
        bandwidthLabel->setMinimumWidth(labelWidth);
        QLineEdit* bandwidthEdit = new QLineEdit("0");
        QHBoxLayout* bandwidthLayout = new QHBoxLayout;
        bandwidthLayout->addWidget(bandwidthLabel);
        bandwidthLayout->addWidget(bandwidthEdit);
        bandwidthLayout->addWidget(new QLabel("(0 - unlimited)"));
        bandwidthLayout->addStretch(1);

        QLabel* downloadsLabel = new QLabel(tr("Simultanious downloads:"));
        downloadsLabel->setMinimumWidth(labelWidth);
        m_pDownloadsSpin = new QSpinBox; 
        m_pDownloadsSpin->setRange(1,999);
        int v = Proxy::settings()->value( SettingsValNames::scMaxDownloads,Settings::LIBRARY).value<int>() ;
        m_pDownloadsSpin->setValue ( v==0 ? 2 : v );
        m_pDownloadsSpin->setMaximumWidth(45);
        QHBoxLayout* downloadsLayout = new QHBoxLayout;
        downloadsLayout->addWidget(downloadsLabel);
        downloadsLayout->addWidget( m_pDownloadsSpin );
        downloadsLayout->addStretch(1);

        QVBoxLayout* layout = new QVBoxLayout;
        layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
        layout->addLayout(bandwidthLayout);
        layout->addSpacing(settings_ui::SpaceBeetwenWidgets);
        layout->addLayout(downloadsLayout);
        layout->addStretch(1);

        setLayout(layout);
    }
コード例 #2
0
ファイル: SearchControl.cpp プロジェクト: marbl/gingr
void SearchControl::initialize()
{
	QHBoxLayout * layoutSearch = new QHBoxLayout();
	QVBoxLayout * layout = new QVBoxLayout();
	QHBoxLayout * layoutTracks = new QHBoxLayout();
	QHBoxLayout * layoutAnnotations = new QHBoxLayout();
	
	QPushButton * clearButton = new QPushButton("Clear");
	QCheckBox * caseCheckBox = new QCheckBox("Match case");
	lineEdit = new QLineEdit();
	labelResultsTracks = new StatusLabel();
	labelResultsAnnotations = new StatusLabel();
	
	QLabel * labelTracks = new QLabel(tr("tracks"));
	QLabel * labelAnnotations = new QLabel(tr("annotations"));
	
	labelResultsAnnotations->setMinimumWidth(100);
	labelResultsAnnotations->setMaximumWidth(100);
	labelAnnotations->setMinimumWidth(100);
	labelAnnotations->setMaximumWidth(100);
	labelResultsTracks->setMinimumWidth(100);
	labelResultsTracks->setMaximumWidth(100);
	labelTracks->setMinimumWidth(100);
	labelTracks->setMaximumWidth(100);
	labelResultsTracks->setMinimumHeight(19);
	labelResultsAnnotations->setMinimumHeight(19);
	
	layoutSearch->addWidget(lineEdit);
	layoutSearch->addWidget(clearButton);
	layout->addLayout(layoutSearch);
	layout->addWidget(caseCheckBox);
	layoutTracks->addWidget(labelResultsTracks);
	layoutTracks->addWidget(labelTracks);
	layoutTracks->setAlignment(Qt::AlignLeft);
	layoutAnnotations->addWidget(labelResultsAnnotations);
	layoutAnnotations->addWidget(labelAnnotations);
	layoutAnnotations->setAlignment(Qt::AlignLeft);
	layout->addLayout(layoutTracks);
	layout->addLayout(layoutAnnotations);
	
	qDeleteAll(children());
	delete this->layout();
	setLayout(layout);
	
	connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
	connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
	connect(caseCheckBox, SIGNAL(stateChanged(int)), this, SLOT(matchCaseChaged(int)));
	
	matchCase = false;
	setWindowTitle("Find");
	adjustSize();
}
コード例 #3
0
QLabel * TASARIM_DESIGN_WIDGET::CREATE_NEW_LABEL ( const QString &text, QWidget * parent )
{
    if ( parent EQ NULL ) {
        parent = this;
    }

    QLabel * label = new QLabel(text.toUtf8(),parent);
    label->setMargin(0);
    label->setIndent(0);
    QFont label_font = label->font();
    label_font.setFixedPitch    ( false );
    label_font.setKerning       ( false );
    label_font.setLetterSpacing ( QFont::AbsoluteSpacing, 0.01 );
    label_font.setWordSpacing   ( 0.01 );
    label->setScaledContents    ( true );
    label->setFont              ( label_font );
    label->setFocusPolicy       ( Qt::StrongFocus );

    int width = label->width();
    label->setMinimumWidth( width + 5 );

    label->installEventFilter( this );

    SET_LABEL_FONTS_UNSELECTED( label );

    return label;
}
コード例 #4
0
ファイル: progressdlg.cpp プロジェクト: serghei/kde-kdesdk
void ProgressDialog::setupGui(const QString& heading)
{
    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing(10);

    QWidget* headingBox = new QWidget(vbox);
    QHBoxLayout* hboxLayout = new QHBoxLayout(headingBox);

    QLabel* textLabel = new QLabel(heading, headingBox);
    textLabel->setMinimumWidth(textLabel->sizeHint().width());
    textLabel->setFixedHeight(textLabel->sizeHint().height());
    hboxLayout->addWidget(textLabel);
    hboxLayout->addStretch();

    d->gear = new KAnimWidget(QString("kde"), 32, headingBox);
    d->gear->setFixedSize(32, 32);
    hboxLayout->addWidget(d->gear);

    d->resultbox = new QListBox(vbox);
    d->resultbox->setSelectionMode(QListBox::NoSelection);
    QFontMetrics fm(d->resultbox->fontMetrics());
    d->resultbox->setMinimumSize(fm.width("0")*70, fm.lineSpacing()*8);

    resize(sizeHint());
}
コード例 #5
0
QWidget *PartsEditorViewsWidget::addZoomControlsAndBrowseButton(PartsEditorView *view) {
    QFrame *container1 = new QFrame(this);
    QVBoxLayout *lo1 = new QVBoxLayout(container1);
    lo1->setSpacing(1);
    lo1->setMargin(0);

    QLabel *button = new QLabel(QString("<a href='#'>%1</a>").arg(tr("Load image..")), this);
    button->setObjectName("browseButton");
    button->setMinimumWidth(85);
    button->setMaximumWidth(85);
    button->setFixedHeight(20);
    button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);

    connect(button, SIGNAL(linkActivated(const QString&)), view, SLOT(loadFile()));
    QHBoxLayout *lo2 = new QHBoxLayout();
    lo2->setSpacing(1);
    lo2->setMargin(0);
    lo2->addWidget(button);
    lo2->addWidget(new ZoomControls(view,container1));

    lo1->addWidget(view);
    lo1->addLayout(lo2);

    return container1;
}
コード例 #6
0
ファイル: EdLevelResourceSound.cpp プロジェクト: 9heart/DT3
EdLevelResourceSound::EdLevelResourceSound (const FilePath &path)
{
    
    EdLevelSoundThumbnail *item = new EdLevelSoundThumbnail(this);
    item->setSound(path);
    item->setMaximumWidth(128);
    item->setMinimumWidth(128);
    item->setMaximumHeight(128);
    item->setMinimumHeight(128);

    QLabel *title = new QLabel(this);
    title->setMaximumWidth(200);
    title->setMinimumWidth(200);
    title->setText(path.file_name().c_str());
    
    QGridLayout *layout = new QGridLayout;
    layout->setContentsMargins(2,2,2,2);
    layout->setHorizontalSpacing(0);
    layout->setVerticalSpacing(0);
    layout->setColumnStretch(1,1);
    layout->addWidget(item,1,0);
    layout->addWidget(title,0,0);

    setLayout(layout);
    
    setMinimumHeight(15+2+128);
    setMinimumWidth(200);
    setMaximumWidth(200);
}
コード例 #7
0
ファイル: param_widget.cpp プロジェクト: ashuang/sceneview
void ParamWidget::AddDouble(const QString& name,
    double min, double max, double step, double initial_value,
    DisplayHint display_hint) {
  ExpectNameNotFound(name);

  if (display_hint == DisplayHint::kSpinBox) {
    QDoubleSpinBox* spinbox = new QDoubleSpinBox(this);
    spinbox->setRange(min, max);
    spinbox->setSingleStep(step);
    spinbox->setValue(initial_value);
    spinbox->setProperty("param_widget_type", kParamDouble);
    widgets_[name] = spinbox;
    AddLabeledRow(name, spinbox);
    connect(spinbox,
        static_cast<void(QDoubleSpinBox::*)(double)>(
          &QDoubleSpinBox::valueChanged),
        [this, name](double value) {
          emit ParamChanged(name);
        });
  } else if (display_hint == DisplayHint::kSlider) {
    QWidget* row_widget = new QWidget(this);
    QHBoxLayout* row_hbox = new QHBoxLayout(row_widget);
    QSlider* slider = new QSlider(Qt::Horizontal, this);
    const int num_steps = static_cast<int>((max - min) / step);
    const int initial_value_int =
      static_cast<int>((initial_value - min) / step);
    slider->setRange(0, num_steps);
    slider->setSingleStep(1);
    slider->setValue(initial_value_int);
    slider->setProperty("min", min);
    slider->setProperty("max", max);
    slider->setProperty("step", step);
    slider->setProperty("param_widget_type", kParamDouble);
    QLabel* label = new QLabel(this);
    label->setText(QString::number((initial_value_int - min) * step));
    row_hbox->addWidget(new QLabel(name, this));
    row_hbox->addWidget(slider);
    row_hbox->addWidget(label);
    widgets_[name] = slider;
    layout_->addWidget(row_widget);
    slider->setProperty("param_widget_label", QVariant::fromValue(label));
    label->setProperty("format_str", "");
    connect(slider, &QSlider::valueChanged,
        [this, name, label, min, step](int position) {
          const double value = min + step * position;
          const QString format_str = label->property("format_str").toString();
          if (format_str == "") {
            label->setText(QString::number(value));
            label->setMinimumWidth(std::max(label->width(), label->minimumWidth()));
          } else {
            QString text;
            text.sprintf(format_str.toStdString().c_str(), value);
            label->setText(text);
          }
          emit ParamChanged(name);
        });
  } else {
    throw std::invalid_argument("Invalid display hint");
  }
}
コード例 #8
0
KeyboardWidget::KeyboardWidget(int width, int height, QWidget *parent):
    FlashableWidget(width, height, parent)
{

    ifstream keyboardLayout;
    keyboardLayout.open("qwerty.txt");
    if(keyboardLayout.fail())
    {
        QMessageBox errorMessage;
        //If the layout isn't working
        errorMessage.setWindowTitle("Error");
        errorMessage.setIcon(QMessageBox::Critical);
        errorMessage.setText("Can't load the keyboard layout!");
        errorMessage.show();
    }
    else
    {
        for(int i = 0; i < vLabels_.size(); ++i)
        {
            string keyboardKey;
            keyboardLayout >> keyboardKey;
            QLabel *key = vLabels_.at(i);
            key->setText(QString::fromStdString(keyboardKey));
            key->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
            key->setMinimumWidth(90);
            key->setMinimumHeight(90);
        }
    }

}
コード例 #9
0
/**
 * Draws neural network layer topology.
 */
void LayerEditWidget::setNeuronImageFrame() {
    QString labelStyle;

    if(inputLayer) {
        labelStyle =
            "background-image: url(:/neuron1w);"
            "background-position: center center;"
            "background-repeat: no-repeat;";
    } else {
        labelStyle =
            "background-image: url(:/neuron3w);"
            "background-position: center center;"
            "background-repeat: no-repeat;";
    }

    for(int i = 0; i < neuronList.count(); i++) {
        ui->neuronImageFrame->layout()->removeWidget(neuronList[i]);
        delete neuronList[i];
    }
    neuronList.clear();

    if(ui->neuronCountSpinBox->value() <= 7) {
        for(int i = 1; i < ui->neuronCountSpinBox->value()+1; i++) {
            QLabel* neuron = new QLabel(ui->neuronImageFrame);
            neuron->setMaximumWidth(36);
            neuron->setMinimumWidth(36);
            neuron->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
            neuron->setStyleSheet(labelStyle);
            neuron->setText(QString::number(i));
            neuronList.append(neuron);
            ui->neuronImageFrame->layout()->addWidget(neuron);
        }
    } else {
        for(int i = 1; i < 8; i++) {
            QLabel* neuron = new QLabel(ui->neuronImageFrame);
            neuron->setMaximumWidth(36);
            neuron->setMinimumWidth(36);
            neuron->setStyleSheet(labelStyle);
            neuron->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
            if(i == 7) neuron->setText(QString::number(ui->neuronCountSpinBox->value()));
            else if(i == 6)	neuron->setText(QString("..."));
            else neuron->setText(QString::number(i));
            neuronList.append(neuron);
            ui->neuronImageFrame->layout()->addWidget(neuron);
        }
    }
}
コード例 #10
0
ファイル: greatwindow.cpp プロジェクト: ricowang/Great
void GreatWindow::setupStatusBar()
{
    QLabel* statusLabel = new QLabel("");
    statusLabel->setAlignment(Qt::AlignLeft);
    statusLabel->setMinimumWidth(100);

    QLabel* resolutionLabel = new QLabel("");
    resolutionLabel->setAlignment(Qt::AlignLeft);
    resolutionLabel->setMinimumWidth(150);

    QLabel* zoomLabel = new QLabel("");
    zoomLabel->setAlignment(Qt::AlignLeft);
    zoomLabel->setMinimumWidth(100);

    QLabel* urlLabel = new QLabel("");
    urlLabel->setAlignment(Qt::AlignLeft);
    urlLabel->setMinimumWidth(400);

    QPushButton* zoomInButton = new QPushButton(QString(0x2295));
    zoomInButton->setMaximumWidth(urlLabel->sizeHint().height());
    zoomInButton->setMaximumHeight(urlLabel->sizeHint().height());
    zoomInButton->setFocusPolicy(Qt::NoFocus);

    QPushButton* zoomOutButton = new QPushButton(QString(0x2296));
    zoomOutButton->setMaximumWidth(urlLabel->sizeHint().height());
    zoomOutButton->setMaximumHeight(urlLabel->sizeHint().height());
    zoomOutButton->setFocusPolicy(Qt::NoFocus);

    statusBar()->addWidget(statusLabel);
    statusBar()->addWidget(resolutionLabel);
    statusBar()->addWidget(zoomLabel);
    statusBar()->addWidget(zoomInButton);
    statusBar()->addWidget(zoomOutButton);
    statusBar()->addWidget(urlLabel, 1);

    m_statusLabels[0] = statusLabel;
    m_statusLabels[1] = resolutionLabel;
    m_statusLabels[2] = zoomLabel;
    m_statusLabels[3] = urlLabel;

    connect(zoomInButton, &QPushButton::clicked,
            m_canvas, [this] {m_canvas->zoom(true); updateZoom(); });
    connect(zoomOutButton, &QPushButton::clicked,
            m_canvas, [this] {m_canvas->zoom(false); updateZoom(); });
}
コード例 #11
0
ファイル: volumeimpl.cpp プロジェクト: Camelek/qtmoko
VolumeDialogImpl::VolumeDialogImpl( QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), m_tid(0), m_oldValue(0), m_d(new VolumeDialogImplPrivate)
{
    screenUpdate();

    QColor c(Qt::black);
    c.setAlpha(255);     //XXX: Make fully opaque for now, for  DirectPainter widgets in the background

    setAttribute(Qt::WA_SetPalette, true);

    QPalette p = palette();
    p.setBrush(QPalette::Window, c);
    setPalette(p);

    QVBoxLayout *vBox = new QVBoxLayout(this);
    QHBoxLayout *hBox = new QHBoxLayout;

    volumeWidget = new VolumeWidget(this);

    QIcon icon(":icon/sound");
    QIcon mute(":icon/mute");

    QLabel* volumeLevel = new QLabel(this);
    volumeLevel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    volumeLevel->setMinimumWidth( fontMetrics().width("100%") );
    volumeLevel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
    connect(this, SIGNAL(setText(QString)), volumeLevel, SLOT(setText(QString)));

    volumeWidget->l = new QLabel(this);
    volumeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    volumeWidget->l->setPixmap(icon.pixmap(64, 64));
    volumeWidget->m = new QLabel(this);

    volumeWidget->m->hide();
    volumeWidget->m->setPixmap(mute.pixmap(64, 64));

    hBox->addStretch();
    hBox->addWidget(volumeWidget->l);
    hBox->addWidget(volumeWidget->m);
    hBox->addStretch();

    QHBoxLayout *wp = new QHBoxLayout;
    wp->addWidget(volumeWidget);
    wp->addWidget(volumeLevel);

    vBox->addLayout(hBox);
    vBox->addLayout(wp);

    connect(m_d->m_vsVolume, SIGNAL(contentsChanged()), this, SLOT(valueSpaceVolumeChanged()));
    initialized = 0;
    old_slot = 0;

    resetTimer();
}
コード例 #12
0
ファイル: savescm.cpp プロジェクト: kthxbyte/KDE1-Linaro
SaveScm::SaveScm( QWidget *parent, const char *name )
	: QDialog( parent, name, TRUE )
{
	setFocusPolicy(QWidget::StrongFocus);
	setCaption( i18n("Add a color scheme"));
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10 );

	QBoxLayout *stackLayout = new QVBoxLayout( 3 );
	topLayout->addLayout( stackLayout );

	nameLine = new QLineEdit( this );
	nameLine->setFocus();
	nameLine->setMaxLength(18);
	nameLine->setFixedHeight( nameLine->sizeHint().height() );
	
	QLabel* tmpQLabel;
	tmpQLabel = new QLabel( nameLine, 
			i18n( "&Enter a name for the new color scheme\n"\
					"to be added to your personal list.\n\n"\
					"The colors currently used in the preview will\n"\
					"be copied into this scheme to begin with." ), this );
	tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix );
	tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() );
	tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() );
	
	stackLayout->addStretch( 10 );
	stackLayout->addWidget( tmpQLabel );
	stackLayout->addWidget( nameLine );
	
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this );
	tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
	tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
	
	topLayout->addWidget( tmpQFrame );
	
	KButtonBox *bbox = new KButtonBox( this );
	bbox->addStretch( 10 );
	
	QPushButton *ok = bbox->addButton( i18n( "&OK" ) );
	connect( ok, SIGNAL( clicked() ), SLOT( accept() ) );
	
	QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) );
	connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
	
	bbox->layout();
	topLayout->addWidget( bbox );

    topLayout->activate();
	
	resize( 250, 0 );
}
コード例 #13
0
QGraphicsProxyWidget *
UpcomingEventsWidget::createLabel( const QString &text, QSizePolicy::Policy hPolicy )
{
    QLabel *label = new QLabel;
    label->setAttribute( Qt::WA_NoSystemBackground );
    label->setMinimumWidth( 10 );
    label->setSizePolicy( hPolicy, QSizePolicy::Preferred );
    label->setText( text );
    label->setWordWrap( false );
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget( this );
    proxy->setWidget( label );
    return proxy;
}
コード例 #14
0
ファイル: modelpanel.cpp プロジェクト: andyjenkinson/opentx
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
  QLabel *label = new QLabel(this);
  label->setFrameShape(QFrame::Panel);
  label->setFrameShadow(QFrame::Raised);
  label->setMidLineWidth(0);
  label->setAlignment(Qt::AlignCenter);
  label->setMargin(5);
  label->setText(text);
  if (!minimize)
    label->setMinimumWidth(100);
  gridLayout->addWidget(label, 0, col, 1, 1);
}
コード例 #15
0
//! [Dialog constructor part1]
Dialog::Dialog()
{
    desktopGeometry = QApplication::desktop()->availableGeometry(0);

    setWindowTitle(tr("SIP Dialog Example"));
    QScrollArea *scrollArea = new QScrollArea(this);
    QGroupBox *groupBox = new QGroupBox(scrollArea);
    groupBox->setTitle(tr("SIP Dialog Example"));
    QGridLayout *gridLayout = new QGridLayout(groupBox);
    groupBox->setLayout(gridLayout);
//! [Dialog constructor part1]

//! [Dialog constructor part2]
    QLineEdit* lineEdit = new QLineEdit(groupBox);
    lineEdit->setText(tr("Open and close the SIP"));
    lineEdit->setMinimumWidth(220);

    QLabel* label = new QLabel(groupBox);
    label->setText(tr("This dialog resizes if the SIP is opened"));
    label->setMinimumWidth(220);

    QPushButton* button = new QPushButton(groupBox);
    button->setText(tr("Close Dialog"));
    button->setMinimumWidth(220);
//! [Dialog constructor part2]

//! [Dialog constructor part3]
    if (desktopGeometry.height() < 400)
        gridLayout->setVerticalSpacing(80);
    else
        gridLayout->setVerticalSpacing(150);

    gridLayout->addWidget(label);
    gridLayout->addWidget(lineEdit);
    gridLayout->addWidget(button);
//! [Dialog constructor part3]

//! [Dialog constructor part4]
    scrollArea->setWidget(groupBox);
    QHBoxLayout* layout = new QHBoxLayout();
    layout->addWidget(scrollArea);
    setLayout(layout);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//! [Dialog constructor part4]

//! [Dialog constructor part5]
    connect(button, SIGNAL(clicked()),
        qApp, SLOT(closeAllWindows()));
    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), 
        this, SLOT(desktopResized(int)));
}
コード例 #16
0
SymbolsFindFilterConfigWidget::SymbolsFindFilterConfigWidget(SymbolsFindFilter *filter)
    : m_filter(filter)
{
    connect(m_filter, SIGNAL(symbolsToSearchChanged()), this, SLOT(getState()));

    QGridLayout *layout = new QGridLayout(this);
    setLayout(layout);
    layout->setMargin(0);

    QLabel *typeLabel = new QLabel(tr("Types:"));
    layout->addWidget(typeLabel, 0, 0);

    m_typeClasses = new QCheckBox(tr("Classes"));
    layout->addWidget(m_typeClasses, 0, 1);

    m_typeMethods = new QCheckBox(tr("Functions"));
    layout->addWidget(m_typeMethods, 0, 2);

    m_typeEnums = new QCheckBox(tr("Enums"));
    layout->addWidget(m_typeEnums, 1, 1);

    m_typeDeclarations = new QCheckBox(tr("Declarations"));
    layout->addWidget(m_typeDeclarations, 1, 2);

    // hacks to fix layouting:
    typeLabel->setMinimumWidth(80);
    typeLabel->setAlignment(Qt::AlignRight);
    m_typeClasses->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_typeMethods->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    connect(m_typeClasses, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeMethods, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeEnums, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeDeclarations, SIGNAL(clicked(bool)), this, SLOT(setState()));

    m_searchProjectsOnly = new QRadioButton(tr("Projects only"));
    layout->addWidget(m_searchProjectsOnly, 2, 1);

    m_searchGlobal = new QRadioButton(tr("All files"));
    layout->addWidget(m_searchGlobal, 2, 2);

    m_searchGroup = new QButtonGroup(this);
    m_searchGroup->addButton(m_searchProjectsOnly);
    m_searchGroup->addButton(m_searchGlobal);

    connect(m_searchProjectsOnly, SIGNAL(clicked(bool)),
            this, SLOT(setState()));
    connect(m_searchGlobal, SIGNAL(clicked(bool)),
            this, SLOT(setState()));
}
コード例 #17
0
ファイル: slider.cpp プロジェクト: milkmiruku/qmidiarp
Slider::Slider(int minValue, int maxValue, int pageStep, int tickStep,
        int value, Qt::Orientation orientation, const QString& label,
        QWidget * parent): QWidget(parent)
{
    slider = new QSlider(orientation, parent);
    slider->setTickInterval(tickStep);
    slider->setTickPosition(QSlider::TicksLeft);
    slider->setRange(minValue, maxValue);
    slider->setSingleStep(pageStep);
    slider->setValue(value);
    if (orientation == Qt::Vertical) {
        slider->setMinimumHeight(150);
    }
    else {
        slider->setMinimumWidth(150);
    }
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(updateSpinBox(int)));
    connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(fillSpinBox(int)));

    sliderSpin = new QSpinBox(this);
    sliderSpin->setRange(minValue, maxValue);
    sliderSpin->setValue(value);
    sliderSpin->setKeyboardTracking(false);
    connect(sliderSpin, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
    connect(sliderSpin, SIGNAL(editingFinished()), this, SLOT(emitAsMoved()));

    QLabel* sliderLabel = new QLabel(this);
    sliderLabel->setText(label);
    sliderLabel->setBuddy(sliderSpin);
    sliderLabel->setMinimumWidth(5*sliderLabel->fontMetrics().maxWidth());
    QBoxLayout *sliderLayout = new QBoxLayout(QBoxLayout::LeftToRight,this);
    sliderLayout->setMargin(0);
    sliderLayout->addWidget(sliderLabel);
    sliderLayout->addWidget(slider);
    sliderLayout->addSpacing(2);
    sliderLayout->addWidget(sliderSpin);
    if (orientation == Qt::Vertical) {
        sliderLayout->setDirection(QBoxLayout::TopToBottom);
        sliderLayout->setAlignment(Qt::AlignHCenter);
    }
    else {
        sliderLayout->setDirection(QBoxLayout::LeftToRight);
        sliderLayout->setAlignment(Qt::AlignTop);
    }
    setMinimumWidth(155 + sliderLabel->width() + sliderLabel->fontMetrics().maxWidth() * 3);
    setLayout(sliderLayout);
}
コード例 #18
0
AvatarSelectionDialog::AvatarSelectionDialog(QWidget * par,const QString &szInitialPath)
: QDialog(par)
{
	setWindowTitle(__tr2qs_ctx("Choose Avatar - KVIrc","options"));

	QGridLayout * g = new QGridLayout(this);

	QString msg = "<center>";
	msg += __tr2qs_ctx("Please select an avatar image. " \
				"The full path to a local file or an image on the Web can be used.<br>" \
				"If you wish to use a local image file, click the \"<b>Browse</b>\"" \
				"button to browse local folders.<br>" \
				"The full URL for an image (including <b>http://</b>) can be entered manually.","options");
	msg += "</center><br>";

	QLabel * l = new QLabel(msg,this);
	l->setMinimumWidth(250);

	g->addWidget(l,0,0,1,3);

	m_pLineEdit = new QLineEdit(this);
	m_pLineEdit->setText(szInitialPath);
	m_pLineEdit->setMinimumWidth(180);

	g->addWidget(m_pLineEdit,1,0,1,2);

	QPushButton * b = new QPushButton(__tr2qs_ctx("&Browse...","options"),this);
	connect(b,SIGNAL(clicked()),this,SLOT(chooseFileClicked()));
	g->addWidget(b,1,2);

	KviTalHBox * h = new KviTalHBox(this);
	h->setSpacing(8);
	g->addWidget(h,2,1,1,2);
	b = new QPushButton(__tr2qs_ctx("&OK","options"),h);
	b->setMinimumWidth(80);
	b->setDefault(true);
	connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));

	b = new QPushButton(__tr2qs_ctx("Cancel","options"),h);
	b->setMinimumWidth(80);
	connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));

	g->setRowStretch(0,1);
	g->setColumnStretch(0,1);
}
コード例 #19
0
ファイル: PasswordDialog.cpp プロジェクト: KDE/trojita
PasswordDialog *PasswordDialog::getPassword(QWidget *parent, const QString &windowTitle, const QString &description,
                                            const QString &errorMessage)
{
    auto d = new PasswordDialog(parent);
    d->setWindowTitle(windowTitle);
    d->ui.descriptionLabel->setText(description);
    d->ui.passwordLineEdit->setEchoMode(QLineEdit::Password);

    // fight the word wrapping beast, also see below
    int l,r,t,b; // we're gonna need the horizontal margins
    d->ui.verticalLayout->getContentsMargins(&l,&t,&r,&b);
    QList<QLabel*> fixedLabels; // and the labels we adjusted

    // 1. fix the dialog width, assuming to be wanted.
    d->setMinimumWidth(d->width());
    // 2. fix the label width
    fixedLabels << d->ui.descriptionLabel;
    // NOTICE: d->ui.descriptionLabel is inside a grid layout, which however has 0 margins
    d->ui.descriptionLabel->setMinimumWidth(d->width() - (l+r));
    // 3. have QLabel figure the size for that width and the content
    d->ui.descriptionLabel->adjustSize();
    // 4. make the label a fixed size element
    d->ui.descriptionLabel->setFixedSize(d->ui.descriptionLabel->size());
    d->adjustSize();

    if (!errorMessage.isEmpty()) {
        QLabel *errorLabel = new QLabel(d);
        d->ui.verticalLayout->insertWidget(0, errorLabel);
        errorLabel->setWordWrap(true);
        errorLabel->setText(errorMessage + QLatin1String("\n<hr>"));
        errorLabel->setTextFormat(Qt::RichText);

        // wordwrapping labels are a problem of its own
        fixedLabels << errorLabel;
        errorLabel->setMinimumWidth(d->width() - (l+r));
        errorLabel->adjustSize();
        errorLabel->setFixedSize(errorLabel->size());
    }

    d->adjustSize();
    d->setMinimumWidth(0);
    foreach(QLabel *label, fixedLabels) {
        label->setMinimumSize(0, 0);
        label->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
    }
コード例 #20
0
ImageComposer::ImageComposer(ImageConnector *conn){
	/**
	 * Create a Qt Window for displaying images and transmitting user commands
	 */
	qRegisterMetaType<Movement>("Movement"); 	// Register Movement struct with Qt
	setFocusPolicy(Qt::ClickFocus);				// Setup window focus behavior
	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);	// Qt window size behavior
	QObject::connect(conn, SIGNAL(transmitImage(int *,Movement,int,int)), this, SLOT(loadImage(int *,Movement,int,int))); // Connect the image loading slots and signals
	QObject::connect(this, SIGNAL(transmitMovement(Movement)), conn, SLOT(receiveMovement(Movement)));	// Connect the user interaction slots and signals
	QObject::connect( qApp, SIGNAL(lastWindowClosed()), conn, SLOT(receiveDone()) ); // Connect the window close slots and signals

	QLabel *resultLabel = new QLabel();	// Place to put images
	resultLabel->setMinimumWidth(resultSize.width());
	resultLabel->setMinimumHeight(resultSize.height());

	QGridLayout *mainLayout = new QGridLayout; 	// Standard adaptable grid windowing system
	mainLayout->addWidget(resultLabel, 0, 0);	// Only one thing to add
	mainLayout->setSizeConstraint(QLayout::SetFixedSize); // Fill screen
	setLayout(mainLayout);						// Place layout

	this->setAutoFillBackground(true);			// Autofill background between frames (no smearing)
	QPalette p( this->palette());				// Define background color
	p.setColor( QPalette::Window, QColor(Qt::black)); // Black
	this->setPalette(p);						// Set background color

	setWindowTitle(tr("Image Composition"));	// Set window head text
	QTimer *timer = new QTimer(this);			// Prepare frame counter
	connect(timer, SIGNAL(timeout()), this, SLOT(update())); // Connect framerate timer with update function
	timer->start(50);							// Run every 50 ms

//	PVMMatrix.perspective(60,45,0.0001,1000);
	Perspective.ortho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);	// Orthographic projection for renderer
	Perspective.scale(0.002);							// Rescale the entire scene (should be in model projection)
	Perspective.translate(250,250,0);					// Move to center of screen
	Perspective.rotate(-90,0,0,1);						// Flip so upright

	lrAmount = 0;	// Initialize left-right rotation angle (degrees)
	udAmount = 0;	//		up-down rotation angle

	updatePVM();	// Initial modelview update

	this->counter = 0;	// Frame count
	this->moved = true;	// Creation is movement...
	sendMovement();		// Tell Legion to create an image
}
コード例 #21
0
CommandEditWidget::CommandEditWidget(QWidget* parent, const QString& subsystemName, const rapid::CommandDef& cmdDef) 
 : QFrame(parent),
   m_subsystemName(subsystemName),
   m_commandName(cmdDef.name)
{
  setFrameStyle(QFrame::Panel | QFrame::Raised);
  QGridLayout* gridLayout = new QGridLayout(this);
  QLabel* label;
  label = new QLabel("<b>"+QString(cmdDef.name)+"<b>", this);
  label->setMinimumWidth(70);
  gridLayout->addWidget(label, 0, 0);
  
  label = new QLabel("", this);
  gridLayout->addWidget(label, 1, 0);
  
  int col = 1;
  const int argc = cmdDef.parameters.length();
  QWidget* widget;
  ParamWidget param;
  for(int i = 0; i < argc; i++) {
    const KeyTypePair& kt = cmdDef.parameters[i];
    label = new QLabel(this);
    label->setText(QString(kt.key));
    label->setAlignment(Qt::AlignCenter);
    gridLayout->addWidget(label, 0, col); 
    widget = ArgWidgetFactory::create(kt.key, kt.type, this);
    gridLayout->addWidget(widget, 1, col);
    param.name   = kt.key;
    param.type   = kt.type;
    param.widget = widget;
    m_params.append(param);
    col++;
  }
  
  gridLayout->addItem(new QSpacerItem(0,0), 0, col++, 1, 2);
  col++;
  
  label = new QLabel("", this);
  gridLayout->addWidget(label, 0, col);
  m_sendBut = new QToolButton(this);
  m_sendBut->setText("Send Command");
  gridLayout->addWidget(m_sendBut, 1, col);
  
  QObject::connect(m_sendBut, SIGNAL(clicked()), SLOT(sendCommandPressed()) );
}
コード例 #22
0
ファイル: mimetypeviewer.cpp プロジェクト: lxde/lxqt-config
void MimetypeViewer::addSearchIcon()
{
    QIcon searchIcon = QIcon::fromTheme("system-search");
    if (searchIcon.isNull())
        return;

    widget.searchTermLineEdit->setTextMargins(0, 0, 30, 0);
    QHBoxLayout *hBoxLayout = new QHBoxLayout(widget.searchTermLineEdit);
    hBoxLayout->setContentsMargins(0,0,0,0);
    widget.searchTermLineEdit->setLayout(hBoxLayout);
    QLabel *searchIconLabel = new QLabel(widget.searchTermLineEdit);
    searchIconLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    searchIconLabel->setMinimumHeight(30);
    searchIconLabel->setMinimumWidth(30);

    searchIconLabel->setPixmap(searchIcon.pixmap(QSize(20,20)));
    hBoxLayout->addWidget(searchIconLabel, 0, Qt::AlignRight | Qt::AlignVCenter);
}
コード例 #23
0
EdLevelPropertyVector2Field::EdLevelPropertyVector2Field (EdLevelPropertiesWindow *parent, std::shared_ptr<PlugNode> node, std::shared_ptr<ArchiveData> data)
{
    //setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    _data = data;
    _node = node;

    buildStatusButtons();

    QLabel *name = new QLabel(this);
    name->setMaximumWidth(130);
    name->setMinimumWidth(130);
    name->setText(MoreStrings::captialize_and_format(_data->title()).c_str());

    _value_x = new EdLevelLineEdit(this);
    _value_y = new EdLevelLineEdit(this);

    _value_x->setObjectName("prop");
    _value_y->setObjectName("prop");

    connect(	_value_x,       SIGNAL(editingFinished()),
                this,           SLOT(doWriteParams())	);
    connect(	_value_y,       SIGNAL(editingFinished()),
                this,           SLOT(doWriteParams())	);

    connect(	this,           SIGNAL(doCommand(QString, bool)),
                parent,         SLOT(onCommand(QString, bool))	);

    QGridLayout *layout = new QGridLayout;
    layout->setContentsMargins(0,0,0,0);
    layout->setHorizontalSpacing(0);
    layout->setVerticalSpacing(0);
    layout->addWidget(keyButton(),0,0);
    layout->addWidget(hasInputButton(),0,1);
    layout->addWidget(hasOutputButton(),0,2);
    layout->addWidget(name,0,3);
    layout->addWidget(_value_x,0,4);
    layout->addWidget(_value_y,0,5);

    setLayout(layout);

    setMinimumHeight(15+2);

    doReadParams();
}
コード例 #24
0
void AxisDetailsWidget::addLed(int row, int column) {
    Led* led = iAnimation.ledAt(Position(row, column));

    if(led == NULL) {
        throw IllegalArgumentException("AnimationDetailsWidget::addLed : NULL led");
    }

    if(!iLedDetails.contains(led->number())) {
        int count = iLedDetails.count();
        qDebug("add new led, %d, %d", row, column);

        QLabel* ledNumberLabel = new QLabel(this);
        ledNumberLabel->setMaximumWidth(LED_LABEL_WIDTH);
        ledNumberLabel->setMinimumWidth(LED_LABEL_WIDTH);

        FrameListWidget* framesListWidget = new FrameListWidget(this, axisData(*led), *this);//, count);
        QToolButton* closeButton = new QToolButton(this);
        closeButton->setObjectName(QString::fromUtf8("detailsClose"));
        closeButton->setIcon(QIcon(":/images/delete.png"));

        iGridLayout->addWidget(closeButton, count, 0);
        iGridLayout->addWidget(ledNumberLabel, count, 1);
        iGridLayout->addWidget(framesListWidget, count, 2);
       // iGridLayout->setColumnStretch(1, 1);
       // iGridLayout->addWidget(new QWidget(), count, 3);
       // iGridLayout->setColumnStretch(3, 2);

        iLedDetails.insert(led->number(), new LedDetails(*this,
                                                         *led,
                                                         *ledNumberLabel,
                                                         *framesListWidget,
                                                         *closeButton));

        iCloseAll->setEnabled(true);
        iScrollAreaWidgetContents->setShowCurrentFrameLine(true);

        doResize();
        layout()->invalidate();
    }
}
コード例 #25
0
void OBSPropertiesView::AddProperty(obs_property_t property,
		QFormLayout *layout)
{
	const char        *name = obs_property_name(property);
	obs_property_type type  = obs_property_get_type(property);

	if (!obs_property_visible(property))
		return;

	QWidget *widget = nullptr;

	switch (type) {
	case OBS_PROPERTY_INVALID:
		return;
	case OBS_PROPERTY_BOOL:
		widget = AddCheckbox(property);
		break;
	case OBS_PROPERTY_INT:
		widget = AddInt(property);
		break;
	case OBS_PROPERTY_FLOAT:
		widget = AddFloat(property);
		break;
	case OBS_PROPERTY_TEXT:
		widget = AddText(property);
		break;
	case OBS_PROPERTY_PATH:
		AddPath(property, layout);
		break;
	case OBS_PROPERTY_LIST:
		widget = AddList(property);
		break;
	case OBS_PROPERTY_COLOR:
		/* TODO */
		break;
	case OBS_PROPERTY_BUTTON:
		widget = AddButton(property);
		break;
	}

	if (!widget)
		return;

	if (!obs_property_enabled(property))
		widget->setEnabled(false);

	QLabel *label = nullptr;
	if (type != OBS_PROPERTY_BOOL &&
	    type != OBS_PROPERTY_BUTTON)
		label = new QLabel(QT_UTF8(obs_property_description(property)));

	if (label && minSize) {
		label->setMinimumWidth(minSize);
		label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	}

	layout->addRow(label, widget);

	if (!lastFocused.empty())
		if (lastFocused.compare(name) == 0)
			lastWidget = widget;
}
コード例 #26
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());
}
コード例 #27
0
void Properties::setupFolders()
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    QFrame *box = new QFrame();
    box->setLayout(layout);
    tabWidget.addTab(box,"System");

    int minledit = 300;

    // Compiler Path Selector
    QLabel *spinCmpLabel = new QLabel("Compiler");
    spinCmpLabel->setMinimumWidth(70);

    QHBoxLayout *spincLayout = new QHBoxLayout();
    spinLeditCompiler = new QLineEdit(this);
    spinLeditCompiler->setMinimumWidth(minledit);
    spinLeditCompiler->setToolTip("Must add a Spin compiler.");
    spincLayout->addWidget(spinCmpLabel);
    spincLayout->addWidget(spinLeditCompiler);
    QPushButton *spinBtnCompilerBrowse = new QPushButton(tr("Browse"), this);
    spincLayout->addWidget(spinBtnCompilerBrowse);

    layout->addLayout(spincLayout);


    // Loader Path Selector
    QLabel *spinLoadLabel = new QLabel("Loader");
    spinLoadLabel->setMinimumWidth(70);

    QHBoxLayout *spinLoadLayout = new QHBoxLayout();
    spinLoadLedit = new QLineEdit(this);
    spinLoadLedit->setMinimumWidth(minledit);
    spinLoadLedit->setToolTip("Must add a loader program.");
    spinLoadLayout->addWidget(spinLoadLabel);
    spinLoadLayout->addWidget(spinLoadLedit);
    QPushButton *spinLoaderBtnBrowse = new QPushButton(tr("Browse"), this);
    spinLoadLayout->addWidget(spinLoaderBtnBrowse);

    layout->addLayout(spinLoadLayout);


    // Library Path Selector
    QLabel *spinIncLabel = new QLabel("Library");
    spinIncLabel->setMinimumWidth(70);

    QHBoxLayout *spiniLayout = new QHBoxLayout();
    spinLeditIncludes = new QLineEdit(this);
    spinLeditIncludes->setMinimumWidth(minledit);
    spinLeditIncludes->setToolTip("Add Spin library folder here.");
    spiniLayout->addWidget(spinIncLabel);
    spiniLayout->addWidget(spinLeditIncludes);
    QPushButton *spinBtnIncludesBrowse = new QPushButton(tr("Browse"), this);
    spiniLayout->addWidget(spinBtnIncludesBrowse);

    layout->addLayout(spiniLayout);

    connect(spinBtnCompilerBrowse, SIGNAL(clicked()), this, SLOT(spinBrowseCompiler()));
    connect(spinBtnIncludesBrowse, SIGNAL(clicked()), this, SLOT(spinBrowseIncludes()));

    QSettings settings(publisherKey, PropellerIdeGuiKey,this);

    QString compiler("/openspin");
#ifdef Q_OS_WIN
    QString library("/spin/");
#else
    QString library("/../spin/");
#endif
    compiler = QApplication::applicationDirPath()+compiler;
    library  = QApplication::applicationDirPath()+library;

#ifdef  Q_OS_WIN
    compiler += ".exe";
#endif

    QVariant compv = settings.value(spinCompilerKey, compiler);
    QVariant incv = settings.value(spinIncludesKey, library);

    if(compv.canConvert(QVariant::String)) {
        QString s = compv.toString();
        s = QDir::fromNativeSeparators(s);
        if(s.length() > 0) {
            spinLeditCompiler->setText(s);
        }
        else {
            spinLeditCompiler->setText(compiler);
        }
    }
    else {
        spinLeditCompiler->setText(compiler);
    }

    if(incv.canConvert(QVariant::String)) {
        QString s = incv.toString();
        s = QDir::fromNativeSeparators(s);
        if(s.length() > 0) {
            spinLeditIncludes->setText(s);
        }
        else {
            spinLeditIncludes->setText(library);
        }
    }
    else {
        spinLeditIncludes->setText(library);
    }

    settings.setValue(spinCompilerKey,spinLeditCompiler->text());
    settings.setValue(spinIncludesKey,spinLeditIncludes->text());

#ifdef EXTERNAL_SPIN_LOADER
    QString loader("/p1load");
#ifdef Q_OS_WIN
    loader += ".exe";
#endif
    loader = QApplication::applicationDirPath()+loader;

    connect(spinLoaderBtnBrowse, SIGNAL(clicked()), this, SLOT(spinBrowseLoader()));
    QVariant loadv = settings.value(spinLoaderKey,loader);

    if(loadv.canConvert(QVariant::String)) {
        QString s = loadv.toString();
        s = QDir::fromNativeSeparators(s);
        if(s.length() > 0) {
            spinLoadLedit->setText(s);
        }
        else {
            spinLoadLedit->setText(loader);
        }
    }
    else {
        spinLoadLedit->setText(loader);
    }

    settings.setValue(spinLoaderKey,spinLoadLedit->text());
#endif

}
コード例 #28
0
StreamPostWidget::StreamPostWidget(DATA::FbStreamPost *post, QWidget *parent) :
    QWidget(parent),
    m_post(post),
    m_triedBothIcons(false)
{



    m_nam = new QNetworkAccessManager(this);
    connect(m_nam,SIGNAL(finished(QNetworkReply*)),
            this, SLOT(gotNetworkReply(QNetworkReply*)));

    //this->setStyleSheet("background : white;");
    this->setAutoFillBackground(true);
    QPalette palette = this->palette();
    palette.setColor(QPalette::Background, Qt::white);
    setPalette(palette);


    QHBoxLayout *mainLayout = new QHBoxLayout();
    QFrame *f = new QFrame();
    f->setMinimumWidth(10);
    f->setFrameShape(QFrame::VLine);
    mainLayout->insertWidget(1,f);
    mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
    m_contentLayout = new QVBoxLayout();
    m_contentLayout->setSizeConstraint(QLayout::SetMinimumSize);

    if (post->isFromUser())
        this->setWindowTitle(post->getPoster().getName());
    else
        this->setWindowTitle(post->getPage().getName());

    if (post->getMessage() != "" || (post->getTargetId().compare("") != 0))
    {
        QLabel *message = new QLabel();
        QString text = post->getMessage();
        if (post->getTargetId().compare("") != 0)
            text.prepend("-> " + post->getTarget().getName() + ": ");
        message->setText(UTIL::hyperLink(text));
        message->setTextInteractionFlags(Qt::TextBrowserInteraction);
        message->setWordWrap(true);
        message->setMinimumWidth(450);
        message->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(message, SIGNAL(linkActivated(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(message,0,Qt::AlignTop);
    }


    QString ageHtml = "<style type=\"text/css\">a { text-decoration: none; }</style>"
                      "<font style=\"font-size : 8pt;\">" +
                      UTIL::ageString(post->getCreatedTime()) + " ";
    if (post->getAttribution() != "" && !post->getAttribution().startsWith("via"))
        ageHtml.append("via ");
    ageHtml.append(post->getAttribution() + "</font>");

    QLabel *age = new QLabel(ageHtml);
    m_ageLineLayout = new QHBoxLayout();
    m_ageLineLayout->insertWidget(1,age,1);

    // Get the app icon, prefer the one in attachment if present
    if (post->getAttachment()->getIcon().toString() != "")
    {
        QNetworkRequest nr;
        nr.setUrl(post->getAttachment()->getIcon());
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }
    else if (m_post->getAppInfo().getIconUrl() != "")
    {
        m_triedBothIcons = true;
        QNetworkRequest nr;
        nr.setUrl(QUrl(m_post->getAppInfo().getIconUrl()));
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }



    if (!post->getAttachment()->isEmpty())
    {
        DATA::FbStreamAttachment *attachment = post->getAttachment();
        FbAttachmentWidget *aw = new FbAttachmentWidget(attachment);
        aw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(aw, SIGNAL(userClickedUrl(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(aw);
    }

    m_contentLayout->addLayout(m_ageLineLayout,0);
    m_contentLayout->addStretch();
    m_contentLayout->addSpacing(10);


    GUI::FbCommentManager *manager = new FbCommentManager(m_post->getPostId(),
                                                          FbCommentManager::PostId,
                                                          m_post->getCommentList()->canRemove());
    manager->setMaximumHeight(400);

    QString fbObjectId = m_post->getPostId();
    GUI::FbLikeManager *likeManager = new FbLikeManager(fbObjectId, m_post->userLikes());
    connect(likeManager, SIGNAL(userChangedLike(bool)),
            this, SLOT(likeChanged(bool)));

    QHBoxLayout *hLayout = new QHBoxLayout();
    m_showAddCommentButton = new QToolButton();
    m_showAddCommentButton->setAutoFillBackground(true);
    palette = m_showAddCommentButton->palette();
    palette.setColor(QPalette::Button,QColor(82,110,166));
    m_showAddCommentButton->setPalette(palette);
    m_showAddCommentButton->setIcon(QIcon(":/uiImages/addComment_50_50.jpg"));
    m_showAddCommentButton->setIconSize(QSize(40,40));
    m_showAddCommentButton->setToolTip("Comment");
    connect(m_showAddCommentButton, SIGNAL(clicked()),
            manager, SLOT(showAddComment()));
    hLayout->addWidget(m_showAddCommentButton,0);

    m_likeButton = new QToolButton();
    this->likeChanged(m_post->userLikes());
    m_likeButton->setIconSize(QSize(40,40));

    connect(m_likeButton, SIGNAL(clicked()),
            likeManager, SLOT(toggleUserLikes()));
    hLayout->addWidget(m_likeButton,0);
    hLayout->addStretch(1);

    m_contentLayout->addLayout(hLayout,0);
    m_contentLayout->addWidget(likeManager,0);
    m_contentLayout->addWidget(manager,2);

    //manager->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    mainLayout->insertLayout(2,m_contentLayout,1);
    setLayout(mainLayout);


    getPosterPixmap();

    QDesktopWidget *dw = QApplication::desktop();
    QRect r = dw->screenGeometry();
    move(r.width() - 240, 40);


}
コード例 #29
0
void StreamPostWidget::gotNetworkReply(QNetworkReply *reply) {

    RequestType t = m_outstandingNetworkRequests.take(reply);

    if (reply->error() == QNetworkReply::NoError)
    {
        if (t == AppIcon)
        {
            QPixmap p;
            p.loadFromData(reply->readAll());
            QLabel *l = new QLabel();
            l->setPixmap(p);
            m_ageLineLayout->insertWidget(0,l,0);

        }
        else if (t == PosterPixmap)
        {
            QPixmap p;
            p.loadFromData(reply->readAll());
            QLabel *l = new QLabel();
            l->setPixmap(p);
            l->setMinimumWidth(p.width());

            QString uid;
            QUrl url;

            if (m_post->isFromUser())
            {
                uid = m_post->getPoster().getUID();
                url = m_post->getPoster().getPicBig();
            }
            else
            {
                uid = m_post->getPage().getPageId();
                url = m_post->getPage().getPicBig();
            }

            UTIL::FbUserPicCache *cache = UTIL::FbUserPicCache::getInstance();
            cache->cachePixmap(uid, UTIL::FbUserPicCache::PicBig,
                               url, p);

            ((QHBoxLayout *)layout())->insertWidget(0,l,0,Qt::AlignTop);
            updateGeometry();
            gotContentUpdate();
            update();
        }
    }
    else
    {
        qDebug() << reply->errorString();
        qDebug() << reply->request().url().toEncoded();

        if (t == AppIcon && !m_triedBothIcons)
        {
            m_triedBothIcons = true;
            if (m_post->getAppInfo().getIconUrl() != "")
            {
                QNetworkRequest nr;
                nr.setUrl(QUrl(m_post->getAppInfo().getIconUrl()));
                QNetworkReply *reply2 = m_nam->get(nr);
                m_outstandingNetworkRequests.insert(reply2, AppIcon);
            }

        }

    }

    reply->deleteLater();

}
コード例 #30
0
ファイル: ActionEditor.cpp プロジェクト: philouvb/KVIrc
SingleActionEditor::SingleActionEditor(QWidget * par,ActionEditor * ed)
: QWidget(par)
{
	m_pActionEditor = ed;
	m_pActionData = 0;

	QGridLayout * g = new QGridLayout(this);

	QLabel * l = new QLabel(__tr2qs_ctx("Name:","editor"),this);
	g->addWidget(l,0,0);
	m_pNameEdit = new QLineEdit(this);
	g->addWidget(m_pNameEdit,0,1);
	m_pNameEdit->setToolTip(__tr2qs_ctx("Internal unique name for the action","editor"));

	l = new QLabel(__tr2qs_ctx("Label:","editor"),this);
	g->addWidget(l,1,0);
	m_pVisibleNameEdit = new QLineEdit(this);
	g->addWidget(m_pVisibleNameEdit,1,1);
	m_pVisibleNameEdit->setToolTip(__tr2qs_ctx("Visible name for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here","editor"));


	QTabWidget * tw = new QTabWidget(this);
	g->addWidget(tw,2,0,1,2);

	// code tab
	QWidget * tab = new QWidget(tw);
	QGridLayout * gl = new QGridLayout(tab);

	m_pScriptEditor = KviScriptEditor::createInstance(tab);
	gl->addWidget(m_pScriptEditor,0,0);
	m_pScriptEditor->setToolTip(__tr2qs_ctx("Action code","editor"));

	tw->addTab(tab,__tr2qs_ctx("Code","editor"));

	// properties tab
	tab = new QWidget(tw);
	gl = new QGridLayout(tab);

	l = new QLabel(__tr2qs_ctx("Category:","editor"),tab);
	gl->addWidget(l,0,0);
	m_pCategoryCombo = new QComboBox(tab);
	gl->addWidget(m_pCategoryCombo,0,1,1,3);
	m_pCategoryCombo->setToolTip(__tr2qs_ctx("Choose the category that best fits for this action","editor"));

	l = new QLabel(__tr2qs_ctx("Description:","editor"),tab);
	gl->addWidget(l,1,0);
	m_pDescriptionEdit = new QLineEdit(tab);
	gl->addWidget(m_pDescriptionEdit,1,1,1,3);
	m_pDescriptionEdit->setToolTip(__tr2qs_ctx("Visible short description for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here","editor"));

	l = new QLabel(__tr2qs_ctx("Small icon:","editor"),tab);
	gl->addWidget(l,2,0);
	m_pSmallIconEdit = new QLineEdit(tab);
	gl->addWidget(m_pSmallIconEdit,2,1);
	m_pSmallIconButton = new QToolButton(tab);
	m_pSmallIconButton->setMinimumSize(QSize(20,20));
	connect(m_pSmallIconButton,SIGNAL(clicked()),this,SLOT(chooseSmallIcon()));
	gl->addWidget(m_pSmallIconButton,2,2);
	QString s= __tr2qs_ctx("The small icon associated to this action.<br>" \
		"It will appear at least in the popup menus when this action is inserted.<br>" \
		"It has to be 16x16 pixels.","editor");
	m_pSmallIconEdit->setToolTip(s);
	m_pSmallIconButton->setToolTip(s);

	l = new QLabel(__tr2qs_ctx("Big icon:","editor"),tab);
	gl->addWidget(l,3,0);
	m_pBigIconEdit = new QLineEdit(tab);
	gl->addWidget(m_pBigIconEdit,3,1);
	m_pBigIconButton = new QToolButton(tab);
	m_pBigIconButton->setMinimumSize(QSize(48,48));
	m_pBigIconButton->setIconSize(QSize(32,32));
	connect(m_pBigIconButton,SIGNAL(clicked()),this,SLOT(chooseBigIcon()));
	gl->addWidget(m_pBigIconButton,3,2,2,2);
	s = __tr2qs_ctx("The big icon associated to this action.<br>" \
		"It will appear at least in the toolbar buttons when this action is inserted.<br>" \
		"It has to be 32x32 pixels.","editor");
	m_pBigIconEdit->setToolTip(s);
	m_pBigIconButton->setToolTip(s);

	l = new QLabel(__tr2qs_ctx("Key sequence:","editor"),tab);
	gl->addWidget(l,4,0,2,1);
	m_pKeySequenceEdit = new QLineEdit(tab);
	gl->addWidget(m_pKeySequenceEdit,4,1,2,1);
	m_pKeySequenceEdit->setToolTip(__tr2qs_ctx("Optional keyboard sequence that will activate this action.<br>" \
		"The sequence has to be expressed as a string of up to four key codes separated by commas " \
		"eventually combined with the modifiers \"Ctrl\",\"Shift\",\"Alt\" and \"Meta\".<br>" \
		"Examples of such sequences are \"Ctrl+X\", \"Ctrl+Alt+Z\", \"Ctrl+X,Ctrl+C\" ...","editor"));

	l = new QLabel(tab);
	gl->addWidget(l,6,0,1,4);

	gl->setColumnStretch(1,1);
	gl->setRowStretch(6,1);

	tw->addTab(tab,__tr2qs_ctx("Properties","editor"));

	// flags tab
	tab = new QWidget(tw);
	gl = new QGridLayout(tab);


	m_pNeedsContextCheck = new QCheckBox(__tr2qs_ctx("Needs IRC context","editor"),tab);
	connect(m_pNeedsContextCheck,SIGNAL(toggled(bool)),this,SLOT(needsContextCheckToggled(bool)));
	m_pNeedsContextCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window belongs to an IRC context","editor"));
	gl->addWidget(m_pNeedsContextCheck,0,0,1,4);


	l = new QLabel(tab);
	l->setMinimumWidth(40);
	gl->addWidget(l,1,0);

	m_pNeedsConnectionCheck = new QCheckBox(__tr2qs_ctx("Needs IRC connection","editor"),tab);
	connect(m_pNeedsConnectionCheck,SIGNAL(toggled(bool)),this,SLOT(needsConnectionCheckToggled(bool)));
	m_pNeedsConnectionCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window has an active IRC connection","editor"));
	gl->addWidget(m_pNeedsConnectionCheck,1,1,1,3);


	l = new QLabel(tab);
	l->setMinimumWidth(40);
	gl->addWidget(l,2,1);

	m_pEnableAtLoginCheck = new QCheckBox(__tr2qs_ctx("Enable at login","editor"),tab);
	m_pEnableAtLoginCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled also during " \
		"the login operations (so when the logical IRC connection hasn't been established yet)","editor"));
	gl->addWidget(m_pEnableAtLoginCheck,2,2,1,2);

	m_pSpecificWindowsCheck = new QCheckBox(__tr2qs_ctx("Enable only in specified windows","editor"),tab);
	connect(m_pSpecificWindowsCheck,SIGNAL(toggled(bool)),this,SLOT(specificWindowsCheckToggled(bool)));
	m_pSpecificWindowsCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window is of a specified type","editor"));
	gl->addWidget(m_pSpecificWindowsCheck,3,0,1,4);


	m_pWindowConsoleCheck = new QCheckBox(__tr2qs_ctx("Enable in console windows","editor"),tab);
	m_pWindowConsoleCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window is a console","editor"));
	connect(m_pWindowConsoleCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
	gl->addWidget(m_pWindowConsoleCheck,4,1,1,3);

	m_pConsoleOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab);
	m_pConsoleOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \
		"selected users in the active window","editor"));
	gl->addWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,2,1,2);

	m_pWindowChannelCheck = new QCheckBox(__tr2qs_ctx("Enable in channel windows","editor"),tab);
	m_pWindowChannelCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window is a channel","editor"));
	connect(m_pWindowChannelCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
	gl->addWidget(m_pWindowChannelCheck,6,1,1,3);

	m_pChannelOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab);
	m_pChannelOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \
		"selected users in the active window","editor"));
	gl->addWidget(m_pChannelOnlyIfUsersSelectedCheck,7,2,1,2);

	m_pWindowQueryCheck = new QCheckBox(__tr2qs_ctx("Enable in query windows","editor"),tab);
	m_pWindowQueryCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window is a query","editor"));
	connect(m_pWindowQueryCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
	gl->addWidget(m_pWindowQueryCheck,8,1,1,3);

	m_pQueryOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab);
	m_pQueryOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \
		"selected users in the active window","editor"));
	gl->addWidget(m_pQueryOnlyIfUsersSelectedCheck,9,2,1,2);

	m_pWindowDccChatCheck = new QCheckBox(__tr2qs_ctx("Enable in DCC chat windows","editor"),tab);
	m_pWindowDccChatCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \
		"the active window is a DCC chat","editor"));
	gl->addWidget(m_pWindowDccChatCheck,10,1,1,2);

	l = new QLabel(tab);
	gl->addWidget(l,11,0,1,4);
	gl->setColumnStretch(3,1);
	gl->setRowStretch(11,1);

	tw->addTab(tab,__tr2qs_ctx("Flags","editor"));
	tw->setCurrentIndex(0);

	g->setRowStretch(2,1);
	g->setColumnStretch(1,1);

	KviPointerHashTableIterator<QString,KviActionCategory> it(*(KviActionManager::instance()->categories()));
	while(KviActionCategory * ac = it.current())
	{
		m_pCategoryCombo->addItem(ac->visibleName() + " (" + ac->name() + ")");
		++it;
	}
}