TestLayout(QGraphicsLayoutItem *parent = 0) : QGraphicsLinearLayout(parent) { setContentsMargins(0,0,0,0); setSpacing(0); }
FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) { setContentsMargins(margin, margin, margin, margin); }
AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) : GcWindow(mainWindow), current(NULL), mainWindow(mainWindow), active(false), stale(true) { setInstanceName("Ride Plot Window"); QWidget *c = new QWidget; QVBoxLayout *cl = new QVBoxLayout(c); setControls(c); setContentsMargins(0,0,0,0); // setup the controls QLabel *showLabel = new QLabel(tr("Show"), c); cl->addWidget(showLabel); showStack = new QCheckBox(tr("Stacked view"), this); showStack->setCheckState(Qt::Unchecked); cl->addWidget(showStack); stackWidth = 15; stackZoomUp = new QwtArrowButton(1, Qt::UpArrow,this); stackZoomUp->setFixedHeight(15); stackZoomUp->setFixedWidth(15); stackZoomUp->setEnabled(false); stackZoomUp->setContentsMargins(0,0,0,0); stackZoomUp->setFlat(true); cl->addWidget(stackZoomUp); stackZoomDown = new QwtArrowButton(1, Qt::DownArrow,this); stackZoomDown->setFixedHeight(15); stackZoomDown->setFixedWidth(15); stackZoomDown->setEnabled(false); stackZoomDown->setContentsMargins(0,0,0,0); stackZoomDown->setFlat(true); cl->addWidget(stackZoomDown); showFull = new QCheckBox(tr("Full plot"), this); showFull->setCheckState(Qt::Checked); cl->addWidget(showFull); paintBrush = new QCheckBox(tr("Fill Curves"), this); paintBrush->setCheckState(Qt::Unchecked); cl->addWidget(paintBrush); showGrid = new QCheckBox(tr("Grid"), this); showGrid->setCheckState(Qt::Checked); cl->addWidget(showGrid); showHr = new QCheckBox(tr("Heart Rate"), this); showHr->setCheckState(Qt::Checked); cl->addWidget(showHr); showSpeed = new QCheckBox(tr("Speed"), this); showSpeed->setCheckState(Qt::Checked); cl->addWidget(showSpeed); showCad = new QCheckBox(tr("Cadence"), this); showCad->setCheckState(Qt::Checked); cl->addWidget(showCad); showAlt = new QCheckBox(tr("Altitude"), this); showAlt->setCheckState(Qt::Checked); cl->addWidget(showAlt); showTemp = new QCheckBox(tr("Temperature"), this); showTemp->setCheckState(Qt::Checked); cl->addWidget(showTemp); showWind = new QCheckBox(tr("Headwind"), this); showWind->setCheckState(Qt::Checked); cl->addWidget(showWind); showTorque = new QCheckBox(tr("Torque"), this); showTorque->setCheckState(Qt::Checked); cl->addWidget(showTorque); showBalance = new QCheckBox(tr("Power balance"), this); showBalance->setCheckState(Qt::Checked); cl->addWidget(showBalance); showPower = new QComboBox(); showPower->addItem(tr("Power + shade")); showPower->addItem(tr("Power - shade")); showPower->addItem(tr("No Power")); cl->addWidget(showPower); showPower->setCurrentIndex(0); comboDistance = new QComboBox(); comboDistance->addItem(tr("X Axis Shows Time")); comboDistance->addItem(tr("X Axis Shows Distance")); cl->addWidget(comboDistance); QLabel *smoothLabel = new QLabel(tr("Smoothing (secs)"), this); smoothLineEdit = new QLineEdit(this); smoothLineEdit->setFixedWidth(40); cl->addWidget(smoothLabel); cl->addWidget(smoothLineEdit); smoothSlider = new QSlider(Qt::Horizontal); smoothSlider->setTickPosition(QSlider::TicksBelow); smoothSlider->setTickInterval(10); smoothSlider->setMinimum(1); smoothSlider->setMaximum(600); smoothLineEdit->setValidator(new QIntValidator(smoothSlider->minimum(), smoothSlider->maximum(), smoothLineEdit)); cl->addWidget(smoothSlider); cl->addStretch(); allPlot = new AllPlot(this, mainWindow); allPlot->setInstanceName("allPlot"); allPlot->setContentsMargins(0,0,0,0); smoothSlider->setValue(allPlot->smooth); smoothLineEdit->setText(QString("%1").arg(allPlot->smooth)); allZoomer = new QwtPlotZoomer(allPlot->canvas()); allZoomer->setRubberBand(QwtPicker::RectRubberBand); allZoomer->setRubberBandPen(GColor(CPLOTSELECT)); allZoomer->setTrackerMode(QwtPicker::AlwaysOff); allZoomer->setEnabled(true); // TODO: Hack for OS X one-button mouse // allZoomer->initMousePattern(1); // RightButton: zoom out by 1 // Ctrl+RightButton: zoom out to full size allZoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ShiftModifier); allZoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); allZoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton); allPanner = new QwtPlotPanner(allPlot->canvas()); allPanner->setMouseButton(Qt::MidButton); // TODO: zoomer doesn't interact well with automatic axis resizing // tooltip on hover over point allPlot->tooltip = new LTMToolTip(QwtPlot::xBottom, QwtPlot::yLeft, QwtPicker::VLineRubberBand, QwtPicker::AlwaysOn, allPlot->canvas(), ""); allPlot->tooltip->setRubberBand(QwtPicker::VLineRubberBand); allPlot->tooltip->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); allPlot->tooltip->setTrackerPen(QColor(Qt::black)); QColor inv(Qt::white); inv.setAlpha(0); allPlot->tooltip->setRubberBandPen(inv); allPlot->tooltip->setEnabled(true); allPlot->_canvasPicker = new LTMCanvasPicker(allPlot); connect(allPlot->_canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), allPlot, SLOT(pointHover(QwtPlotCurve*, int))); connect(allPlot->tooltip, SIGNAL(moved(const QPoint &)), this, SLOT(plotPickerMoved(const QPoint &))); connect(allPlot->tooltip, SIGNAL(appended(const QPoint &)), this, SLOT(plotPickerSelected(const QPoint &))); QwtPlotMarker* allMarker1 = new QwtPlotMarker(); allMarker1->setLineStyle(QwtPlotMarker::VLine); allMarker1->attach(allPlot); allMarker1->setLabelAlignment(Qt::AlignTop|Qt::AlignRight); allPlot->allMarker1=allMarker1; QwtPlotMarker* allMarker2 = new QwtPlotMarker(); allMarker2->setLineStyle(QwtPlotMarker::VLine); allMarker2->attach(allPlot); allMarker2->setLabelAlignment(Qt::AlignTop|Qt::AlignRight); allPlot->allMarker2=allMarker2; // Container widgets should not paint // since they tend to use naff defaults and // 'complicate' or 'make busy' the general // look and feel QPalette palette; palette.setBrush(QPalette::Background, Qt::NoBrush); // // stack view // stackPlotLayout = new QVBoxLayout(); stackPlotLayout->setSpacing(0); stackPlotLayout->setContentsMargins(0,0,0,0); stackWidget = new QWidget(); stackWidget->setAutoFillBackground(false); stackWidget->setPalette(palette); stackWidget->setLayout(stackPlotLayout); stackFrame = new QScrollArea(); stackFrame->hide(); stackFrame->setPalette(palette); stackFrame->setAutoFillBackground(false); stackFrame->setWidgetResizable(true); stackFrame->setWidget(stackWidget); stackFrame->setFrameStyle(QFrame::NoFrame); stackFrame->setContentsMargins(0,0,0,0); // // allPlot view // allPlotLayout = new QVBoxLayout; allPlotLayout->setSpacing(0); allPlotLayout->setContentsMargins(0,0,0,0); allPlotFrame = new QScrollArea(); allPlotFrame->setFrameStyle(QFrame::NoFrame); allPlotFrame->setAutoFillBackground(false); allPlotFrame->setPalette(palette); allPlotFrame->setContentsMargins(0,0,0,0); spanSlider = new QxtSpanSlider(Qt::Horizontal); spanSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping); spanSlider->setLowerValue(0); spanSlider->setUpperValue(15); QFont small; small.setPointSize(6); scrollLeft = new QPushButton("<"); scrollLeft->setFont(small); scrollLeft->setAutoRepeat(true); scrollLeft->setFixedHeight(16); scrollLeft->setFixedWidth(16); scrollLeft->setContentsMargins(0,0,0,0); scrollRight = new QPushButton(">"); scrollRight->setFont(small); scrollRight->setAutoRepeat(true); scrollRight->setFixedHeight(16); scrollRight->setFixedWidth(16); scrollRight->setContentsMargins(0,0,0,0); #ifdef Q_OS_MAC // BUG in QMacStyle and painting of spanSlider // so we use a plain style to avoid it, but only // on a MAC, since win and linux are fine QCleanlooksStyle *style = new QCleanlooksStyle(); spanSlider->setStyle(style); scrollLeft->setStyle(style); scrollRight->setStyle(style); #endif fullPlot = new AllPlot(this, mainWindow); fullPlot->setInstanceName("fullPlot"); fullPlot->grid->enableY(false); QPalette def; //fullPlot->setCanvasBackground(def.color(QPalette::Window)); fullPlot->setCanvasBackground(Qt::white); fullPlot->setCanvasLineWidth(0); fullPlot->enableAxis(QwtPlot::yLeft, false); fullPlot->enableAxis(QwtPlot::yLeft2, false); fullPlot->enableAxis(QwtPlot::yRight, false); fullPlot->enableAxis(QwtPlot::yRight2, false); fullPlot->enableAxis(QwtPlot::xBottom, false); //fullPlot->legend()->clear(); //fullPlot->setTitle(""); fullPlot->setContentsMargins(0,0,0,0); allPlotLayout->addWidget(allPlot); allPlotFrame->setLayout(allPlotLayout); // controls... controlsLayout = new QGridLayout; controlsLayout->setSpacing(0); controlsLayout->setContentsMargins(5,5,5,5); controlsLayout->addWidget(fullPlot, 0,1); controlsLayout->addWidget(spanSlider, 1,1); controlsLayout->addWidget(scrollLeft,1,0); controlsLayout->addWidget(scrollRight,1,2); controlsLayout->setRowStretch(0, 10); controlsLayout->setRowStretch(1, 1); controlsLayout->setContentsMargins(0,0,0,0); #ifdef Q_OS_MAC // macs dpscing is weird //controlsLayout->setSpacing(5); #else controlsLayout->setSpacing(0); #endif allPlotLayout->addLayout(controlsLayout); allPlotLayout->setStretch(0,100); allPlotLayout->setStretch(1,20); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(2,2,2,2); vlayout->setSpacing(0); vlayout->addWidget(allPlotFrame); vlayout->addWidget(stackFrame); vlayout->setSpacing(1); setLayout(vlayout); setContentsMargins(0,0,0,0); // common controls connect(showPower, SIGNAL(currentIndexChanged(int)), this, SLOT(setShowPower(int))); connect(showHr, SIGNAL(stateChanged(int)), this, SLOT(setShowHr(int))); connect(showSpeed, SIGNAL(stateChanged(int)), this, SLOT(setShowSpeed(int))); connect(showCad, SIGNAL(stateChanged(int)), this, SLOT(setShowCad(int))); connect(showAlt, SIGNAL(stateChanged(int)), this, SLOT(setShowAlt(int))); connect(showTemp, SIGNAL(stateChanged(int)), this, SLOT(setShowTemp(int))); connect(showWind, SIGNAL(stateChanged(int)), this, SLOT(setShowWind(int))); connect(showTorque, SIGNAL(stateChanged(int)), this, SLOT(setShowTorque(int))); connect(showBalance, SIGNAL(stateChanged(int)), this, SLOT(setShowBalance(int))); connect(showGrid, SIGNAL(stateChanged(int)), this, SLOT(setShowGrid(int))); connect(showFull, SIGNAL(stateChanged(int)), this, SLOT(setShowFull(int))); connect(showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackChanged(int))); connect(paintBrush, SIGNAL(stateChanged(int)), this, SLOT(setPaintBrush(int))); connect(comboDistance, SIGNAL(currentIndexChanged(int)), this, SLOT(setByDistance(int))); connect(smoothSlider, SIGNAL(valueChanged(int)), this, SLOT(setSmoothingFromSlider())); connect(smoothLineEdit, SIGNAL(editingFinished()), this, SLOT(setSmoothingFromLineEdit())); // normal view connect(spanSlider, SIGNAL(lowerPositionChanged(int)), this, SLOT(zoomChanged())); connect(spanSlider, SIGNAL(upperPositionChanged(int)), this, SLOT(zoomChanged())); // stacked view connect(stackZoomUp, SIGNAL(clicked()), this, SLOT(setStackZoomUp())); connect(stackZoomDown, SIGNAL(clicked()), this, SLOT(setStackZoomDown())); connect(scrollLeft, SIGNAL(clicked()), this, SLOT(moveLeft())); connect(scrollRight, SIGNAL(clicked()), this, SLOT(moveRight())); // GC signals //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(rideDirty()), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(zonesChanged())); connect(mainWindow, SIGNAL(intervalsChanged()), this, SLOT(intervalsChanged())); connect(mainWindow, SIGNAL(intervalZoom(IntervalItem*)), this, SLOT(zoomInterval(IntervalItem*))); connect(mainWindow, SIGNAL(intervalSelected()), this, SLOT(intervalSelected())); connect(mainWindow, SIGNAL(configChanged()), allPlot, SLOT(configChanged())); connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged())); connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(rideDeleted(RideItem*))); }
PropertiesDialog::PropertiesDialog(std::shared_ptr<ObjectProperties> objectProperties, GraphNode* node, QWidget* parent) : QDialog(parent) , m_graphNode(node) , m_objectProperties(objectProperties) { setMinimumSize(300, 200); resize(500, 600); setWindowTitle(QString::fromStdString(m_objectProperties->name())); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); auto tabWidget = new QTabWidget; auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Reset | QDialogButtonBox::Ok); auto applyButton = buttonBox->button(QDialogButtonBox::Apply); auto resetButton = buttonBox->button(QDialogButtonBox::Reset); auto OkButton = buttonBox->button(QDialogButtonBox::Ok); connect(applyButton, &QPushButton::clicked, this, &PropertiesDialog::apply); connect(resetButton, &QPushButton::clicked, this, &PropertiesDialog::resetWidgets); connect(OkButton, &QPushButton::clicked, this, &PropertiesDialog::applyAndClose); connect(buttonBox, &QDialogButtonBox::rejected, this, &PropertiesDialog::reject); auto mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); mainLayout->addWidget(buttonBox); mainLayout->setContentsMargins(5, 5, 5, 5); std::map<std::string, std::vector<int>> propertyGroups; m_propertyWidgets.reserve(m_objectProperties->properties().size()); // Create the property widgets for(const auto& prop : m_objectProperties->properties()) { // create property type specific widget std::shared_ptr<BasePropertyWidget> propWidget = PropertyWidgetFactory::instance().create(prop, this); if(propWidget) { connect(propWidget.get(), &BasePropertyWidget::stateChanged, this, &PropertiesDialog::stateChanged); int id = m_propertyWidgets.size(); propertyGroups[prop->group()].push_back(id); PropertyStruct propStruct; propStruct.property = prop; propStruct.widget = propWidget; m_propertyWidgets.push_back(propStruct); } else { std::cerr << "Couldn't create a widget for the property " << prop->name() << std::endl; } } // Group the widgets and add them to the dialog for(const auto& group : propertyGroups) { QString name = QString::fromStdString(group.first); if(name.isEmpty()) name = "Property"; const int maxPerTab = 10; // TODO: use combined default height of widgets instead const auto& properties = group.second; const int nb = properties.size(); if(nb > maxPerTab) { int nbTabs = (properties.size() + maxPerTab - 1) / maxPerTab; auto beginIt = properties.begin(); for(int i = 0; i < nbTabs; ++i) { QString tabName = name + " " + QString::number(i+1) + "/" + QString::number(nbTabs); auto startDist = i * maxPerTab; auto endDist = std::min(nb, startDist + maxPerTab); addTab(tabWidget, tabName, beginIt + startDist, beginIt + endDist); } } else addTab(tabWidget, name, properties.begin(), properties.end()); } setLayout(mainLayout); m_objectProperties->addModifiedCallback([this](){ readFromProperties(); }); }
MeasuresTabView::MeasuresTabView() : PatMainTabView() { setTitle("Organize and Edit Measures for Project"); // Main Content mainContent = new QWidget(); auto mainContentVLayout = new QVBoxLayout(); mainContentVLayout->setContentsMargins(0,0,0,0); mainContentVLayout->setSpacing(0); mainContentVLayout->setAlignment(Qt::AlignTop); mainContent->setLayout(mainContentVLayout); viewSwitcher->setView(mainContent); // Select Baseline Header auto selectBaselineHeader = new QWidget(); selectBaselineHeader->setFixedHeight(30); selectBaselineHeader->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); selectBaselineHeader->setObjectName("SelectBaselineHeader"); selectBaselineHeader->setStyleSheet("QWidget#SelectBaselineHeader { background: #494949; }"); mainContentVLayout->addWidget(selectBaselineHeader); auto baselineHeaderHLayout = new QHBoxLayout(); baselineHeaderHLayout->setContentsMargins(5,5,5,5); baselineHeaderHLayout->setSpacing(10); selectBaselineHeader->setLayout(baselineHeaderHLayout); baselineCautionLabel = new QLabel(); baselineCautionLabel->setPixmap(QPixmap(":shared_gui_components/images/warning_icon.png")); baselineHeaderHLayout->addWidget(baselineCautionLabel); QLabel * selectBaselineLabel = new QLabel("Select Your Baseline Model"); selectBaselineLabel->setStyleSheet("QLabel { color: white; font: bold; }"); baselineHeaderHLayout->addWidget(selectBaselineLabel); baselineNameBackground = new QWidget(); baselineNameBackground->setObjectName("BaselineNameBackground"); baselineNameBackground->setStyleSheet("QWidget#BaselineNameBackground { background: #D9D9D9 }"); baselineNameBackground->setMinimumWidth(250); auto baselineNameBackgroundLayout = new QHBoxLayout(); baselineNameBackgroundLayout->setContentsMargins(5,2,5,2); baselineNameBackgroundLayout->setSpacing(5); baselineNameBackground->setLayout(baselineNameBackgroundLayout); baselineHeaderHLayout->addWidget(baselineNameBackground); baselineLabel = new QLabel(); baselineNameBackgroundLayout->addWidget(baselineLabel); selectBaselineButton = new GrayButton(); selectBaselineButton->setText("Browse"); baselineHeaderHLayout->addWidget(selectBaselineButton); baselineHeaderHLayout->addStretch(); variableGroupListView = new OSListView(true); variableGroupListView->setContentsMargins(0,0,0,0); variableGroupListView->setSpacing(0); mainContentVLayout->addWidget(variableGroupListView); QString style; style.append("QWidget#Footer {"); style.append("border-top: 1px solid black; "); style.append("background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop: 0 #B6B5B6, stop: 1 #737172); "); style.append("}"); auto footer = new QWidget(); footer->setObjectName("Footer"); footer->setStyleSheet(style); mainContentVLayout->addWidget(footer); auto layout = new QHBoxLayout(); layout->setSpacing(0); footer->setLayout(layout); m_updateMeasuresButton = new BlueButton(); m_updateMeasuresButton->setText("Sync Project Measures with Library"); m_updateMeasuresButton->setToolTip("Check the Library for Newer Versions of the Measures in Your Project and Provides Sync Option"); layout->addStretch(); layout->addWidget(m_updateMeasuresButton); connect(m_updateMeasuresButton, &QPushButton::clicked, this, &MeasuresTabView::openUpdateMeasuresDlg); }
SettingsDialog::SettingsDialog( QWidget *parent ) : QDialog( parent ) , ui( new Ui_StackedSettingsDialog ) , m_proxySettings( this ) , m_rejected( false ) , m_sipModel( 0 ) , m_resolversModel( 0 ) { ui->setupUi( this ); TomahawkSettings* s = TomahawkSettings::instance(); ui->checkBoxHttp->setChecked( s->httpEnabled() ); ui->checkBoxStaticPreferred->setChecked( s->preferStaticHostPort() ); ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp ); ui->checkBoxUpnp->setEnabled( !s->preferStaticHostPort() ); createIcons(); #ifdef Q_WS_X11 ui->listWidget->setFrameShape( QFrame::StyledPanel ); ui->listWidget->setFrameShadow( QFrame::Sunken ); setContentsMargins( 4, 4, 4, 4 ); #else ui->verticalLayout->removeItem( ui->verticalSpacer_3 ); #endif #ifdef Q_WS_MAC // Avoid resize handles on sheets on osx m_proxySettings.setSizeGripEnabled( true ); QSizeGrip* p = m_proxySettings.findChild< QSizeGrip* >(); p->setFixedSize( 0, 0 ); #endif // SIP PLUGINS SipConfigDelegate* sipdel = new SipConfigDelegate( this ); ui->accountsView->setItemDelegate( sipdel ); ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu ); connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) ); connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) ); connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) ); m_sipModel = new SipModel( this ); ui->accountsView->setModel( m_sipModel ); setupSipButtons(); ui->staticHostName->setText( s->externalHostname() ); ui->staticPort->setValue( s->externalPort() ); ui->proxyButton->setVisible( true ); // MUSIC SCANNER //FIXME: MULTIPLECOLLECTIONDIRS if ( s->scannerPaths().count() ) ui->lineEditMusicPath_2->setText( s->scannerPaths().first() ); else { ui->lineEditMusicPath_2->setText( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ); } // WATCH CHANGES // FIXME: QFileSystemWatcher is broken (as we know) and deprecated. Find another way. ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() ); ui->checkBoxWatchForChanges->setVisible( false ); // LAST FM ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() ); ui->lineEditLastfmUsername->setText( s->lastFmUsername() ); ui->lineEditLastfmPassword->setText(s->lastFmPassword() ); connect( ui->pushButtonTestLastfmLogin, SIGNAL( clicked( bool) ), this, SLOT( testLastFmLogin() ) ); // SCRIPT RESOLVER ui->removeScript->setEnabled( false ); ResolverConfigDelegate* del = new ResolverConfigDelegate( this ); connect( del, SIGNAL( openConfig( QString ) ), this, SLOT( openResolverConfig( QString ) ) ); ui->scriptList->setItemDelegate( del ); m_resolversModel = new ResolversModel( s->allScriptResolvers(), s->enabledScriptResolvers(), this ); ui->scriptList->setModel( m_resolversModel ); connect( ui->scriptList->selectionModel(), SIGNAL( selectionChanged( QItemSelection,QItemSelection ) ), this, SLOT( scriptSelectionChanged() ) ); connect( ui->addScript, SIGNAL( clicked( bool ) ), this, SLOT( addScriptResolver() ) ); connect( ui->removeScript, SIGNAL( clicked( bool ) ), this, SLOT( removeScriptResolver() ) ); connect( ui->buttonBrowse_2, SIGNAL( clicked() ), SLOT( showPathSelector() ) ); connect( ui->proxyButton, SIGNAL( clicked() ), SLOT( showProxySettings() ) ); connect( ui->checkBoxStaticPreferred, SIGNAL( toggled(bool) ), SLOT( toggleUpnp(bool) ) ); connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) ); ui->listWidget->setCurrentRow( 0 ); }
StyleButtonBox::StyleButtonBox(QWidget* parent, int rows, int columns) : QWidget(parent) , d(new Private(rows, columns)) { //setMinimumSize(45, 70); setContentsMargins(0, 0, 0, 0); QGridLayout * layout = new QGridLayout(this); d->group = new QButtonGroup(this); // The button for no fill QToolButton* button = new QToolButton(this); //button->setIcon(QPixmap((const char **) buttonnone)); button->setIcon(koIcon("edit-delete")); button->setToolTip(QObject::tr("No stroke or fill")); d->group->addButton(button, None); // The button for solid fill button = new QToolButton(this); button->setIcon(QPixmap((const char **) buttonsolid)); button->setToolTip(QObject::tr("Solid color stroke or fill")); d->group->addButton(button, Solid); // The button for gradient fill button = new QToolButton(this); button->setIcon(QPixmap((const char **) buttongradient)); button->setToolTip(QObject::tr("Gradient")); d->group->addButton(button, Gradient); // The button for pattern fill button = new QToolButton(this); button->setIcon(QPixmap((const char **) buttonpattern)); button->setToolTip(QObject::tr("Pattern")); d->group->addButton(button, Pattern); // The button for even-odd fill rule button = new QToolButton(this); button->setIcon(QPixmap((const char **) buttonevenodd)); button->setToolTip(QObject::tr("Even-Odd Fill")); d->group->addButton(button, EvenOdd); // The button for winding fill-rule button = new QToolButton(this); button->setIcon(QPixmap((const char **) buttonwinding)); button->setToolTip(QObject::tr("Winding Fill")); d->group->addButton(button, Winding); int index = 1; for(int row = 0; row < d->rowCount; ++row) { for(int col = 0; col < d->columnCount; ++col) { layout->addWidget(d->group->button(index), row, col); index = index<<1; if(index > Winding) break; } if(index > Winding) break; } layout->setMargin(0); layout->setSpacing(1); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 1); layout->setRowStretch(3, 1); connect(d->group, SIGNAL(buttonClicked(int)), this, SIGNAL(buttonPressed(int))); }
void ptToolBox::createGui() { GInfo->Assert(FBodyWidget, "The toolbox cannot have a null body widget.", AT); GInfo->Assert(FFilter, "The filter associated with the toolbox cannot be null.", AT); this->setObjectName(FFilter->uniqueName()); FIsFolded = Settings->m_IniSettings->value(this->objectName() + "/Folded", true).toBool(); FHeaderWidget = new QWidget; FHeaderWidget->setContextMenuPolicy(Qt::NoContextMenu); // event filter handles context menu FHeaderWidget->installEventFilter(this); // The header contains from left to right: // left-justified: FStatusArrow, FCaption; right-justified: FHelpIcon, FSlowIcon FStatusArrow = new QLabel; connect(FFilter, SIGNAL(activityChanged()), this, SLOT(updateGui())); FCaption = new QLabel(FFilter->caption()); FCaption->setTextFormat(Qt::PlainText); FCaption->setTextInteractionFlags(Qt::NoTextInteraction); auto hFont = FCaption->font(); hFont.setBold(true); FCaption->setFont(hFont); FHelpIcon = new QLabel; FHelpIcon->setPixmap(*Theme->ptIconQuestion); FHelpIcon->setCursor(QCursor(Qt::PointingHandCursor)); FHelpIcon->setToolTip(tr("Open help page in web browser.")); FHelpIcon->hide(); FHelpIcon->installEventFilter(this); FSlowIcon = new QLabel; FSlowIcon->setPixmap(QPixmap(QString::fromUtf8(":/dark/ui-graphics/bubble-attention.png"))); FSlowIcon->setToolTip(tr("Complex filter. Might be slow.")); FSlowIcon->hide(); // layout for the header auto hHeaderLayout = new QHBoxLayout(FHeaderWidget); hHeaderLayout->addWidget(FStatusArrow); hHeaderLayout->addWidget(FCaption); hHeaderLayout->addStretch(); hHeaderLayout->addWidget(FHelpIcon); hHeaderLayout->addWidget(FSlowIcon); hHeaderLayout->setContentsMargins(3,3,3,3); hHeaderLayout->setSpacing(4); // body widget with the main filter config widgets FBodyWidget->setParent(this); FBodyWidget->setObjectName("ToolBoxBody"); FBodyWidget->setVisible(!FIsFolded); // Toolbox handles margins and spacing of the body widget’s main layout to ensure consistency. auto hBodyLayout = FBodyWidget->layout(); GInfo->Assert(hBodyLayout, QString("Error! GUI widget of filter \"%1\" does not have a layout.") .arg(FFilter->uniqueName()), AT); hBodyLayout->setContentsMargins(8,5,2,5); hBodyLayout->setSpacing(4); // assemble the toolbox: place header and body in a vertical layout auto hBoxLayout = new QVBoxLayout(this); hBoxLayout->addWidget(FHeaderWidget); hBoxLayout->addWidget(FBodyWidget); hBoxLayout->setContentsMargins(0,0,0,0); hBoxLayout->setSpacing(0); hBoxLayout->setAlignment(Qt::AlignTop); }
MIDIInstrumentParameterPanel::MIDIInstrumentParameterPanel( RosegardenDocument *doc, QWidget *parent) : InstrumentParameterPanel(doc, parent), m_rotaryFrame(NULL), m_rotaryGrid(NULL) { RG_DEBUG << "MIDIInstrumentParameterPanel ctor"; setObjectName("MIDI Instrument Parameter Panel"); // Font QFont f; f.setPointSize(f.pointSize() * 90 / 100); f.setBold(false); QFontMetrics metrics(f); // Compute a width for the labels that will prevent them from becoming // so large that they make a mess out of the layout. const int labelWidth = metrics.width("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); // Widgets // Instrument Label m_instrumentLabel->setFont(f); // Set a fixed width to prevent the label from growing too large. m_instrumentLabel->setFixedWidth(labelWidth); m_instrumentLabel->setAlignment(Qt::AlignCenter); // Connection Label m_connectionLabel = new SqueezedLabel; m_connectionLabel->setFont(f); // Set a fixed width to prevent the label from growing too large. m_connectionLabel->setFixedWidth(labelWidth); m_connectionLabel->setAlignment(Qt::AlignCenter); // Percussion Label QLabel *percussionLabel = new QLabel(tr("Percussion"), this); percussionLabel->setFont(f); // Percussion CheckBox m_percussionCheckBox = new QCheckBox; m_percussionCheckBox->setFont(f); m_percussionCheckBox->setToolTip(tr("<qt><p>Check this to tell Rosegarden that this is a percussion instrument. This allows you access to any percussion key maps and drum kits you may have configured in the studio</p></qt>")); connect(m_percussionCheckBox, SIGNAL(clicked(bool)), SLOT(slotPercussionClicked(bool))); // Bank Label m_bankLabel = new QLabel; m_bankLabel->setText(tr("Bank")); m_bankLabel->setFont(f); // Bank CheckBox m_bankCheckBox = new QCheckBox; m_bankCheckBox->setFont(f); m_bankCheckBox->setToolTip(tr("<qt>Send bank select</qt>")); connect(m_bankCheckBox, SIGNAL(clicked(bool)), SLOT(slotBankClicked(bool))); // Since these ComboBoxes may have a very large number of items, // expand the maximum dropdown size (normally 10) to show more of // them at a time. const int maxVisibleItems = 20; // Ensure the comboboxes are all at least this wide (in characters). const int minimumContentsLength = 25; // Bank ComboBox m_bankComboBox = new QComboBox; m_bankComboBox->setFont(f); m_bankComboBox->setToolTip(tr("<qt>Set the MIDI bank from which to select programs</qt>")); m_bankComboBox->setMaxVisibleItems(maxVisibleItems); m_bankComboBox->setMinimumContentsLength(minimumContentsLength); connect(m_bankComboBox, SIGNAL(activated(int)), SLOT(slotSelectBank(int))); // Program Label m_programLabel = new QLabel; m_programLabel->setText(tr("Program")); m_programLabel->setFont(f); // Program CheckBox m_programCheckBox = new QCheckBox; m_programCheckBox->setFont(f); m_programCheckBox->setToolTip(tr("<qt>Send program change</qt>")); connect(m_programCheckBox, SIGNAL(clicked(bool)), SLOT(slotProgramClicked(bool))); // Program ComboBox m_programComboBox = new QComboBox; m_programComboBox->setFont(f); m_programComboBox->setToolTip(tr("<qt>Set the MIDI program or "patch"</p></qt>")); m_programComboBox->setMaxVisibleItems(maxVisibleItems); m_programComboBox->setMinimumContentsLength(minimumContentsLength); connect(m_programComboBox, SIGNAL(activated(int)), SLOT(slotSelectProgram(int))); // Variation Label m_variationLabel = new QLabel; m_variationLabel->setText(tr("Variation")); m_variationLabel->setFont(f); // Variation CheckBox m_variationCheckBox = new QCheckBox; m_variationCheckBox->setFont(f); m_variationCheckBox->setToolTip(tr("<qt>Send bank select for variation</qt>")); connect(m_variationCheckBox, SIGNAL(clicked(bool)), SLOT(slotVariationClicked(bool))); // Variation ComboBox m_variationComboBox = new QComboBox; m_variationComboBox->setFont(f); m_variationComboBox->setToolTip(tr("<qt>Set variations on the program above, if available in the studio</qt>")); m_variationComboBox->setMaxVisibleItems(maxVisibleItems); m_variationComboBox->setMinimumContentsLength(minimumContentsLength); connect(m_variationComboBox, SIGNAL(activated(int)), SLOT(slotSelectVariation(int))); // Channel Label QLabel *channelLabel = new QLabel(tr("Channel"), this); channelLabel->setFont(f); QString channelTip(tr("<qt><p><i>Auto</i>, allocate channel automatically; <i>Fixed</i>, fix channel to instrument number</p></qt>")); channelLabel->setToolTip(channelTip); // Channel ComboBox m_channelValue = new QComboBox; m_channelValue->setFont(f); m_channelValue->setToolTip(channelTip); m_channelValue->setMaxVisibleItems(2); // Everything else sets up elsewhere, but these don't vary per instrument: m_channelValue->addItem(tr("Auto")); m_channelValue->addItem(tr("Fixed")); m_channelValue->setMinimumContentsLength(minimumContentsLength); connect(m_channelValue, SIGNAL(activated(int)), SLOT(slotSelectChannel(int))); // Receive External Label QLabel *receiveExternalLabel = new QLabel(tr("Receive external"), this); receiveExternalLabel->setFont(f); QString receiveExternalTip = tr("<qt>Use program changes from an external source to manipulate these controls (only valid for the currently-active track) [Shift + P]</qt>"); receiveExternalLabel->setToolTip(receiveExternalTip); // Receive External CheckBox m_receiveExternalCheckBox = new QCheckBox; m_receiveExternalCheckBox->setFont(f); m_receiveExternalCheckBox->setToolTip(receiveExternalTip); m_receiveExternalCheckBox->setShortcut((QKeySequence)"Shift+P"); m_receiveExternalCheckBox->setChecked(false); // Rotary Frame and Grid m_rotaryFrame = new QFrame(this); m_rotaryFrame->setContentsMargins(8, 8, 8, 8); m_rotaryGrid = new QGridLayout(m_rotaryFrame); m_rotaryGrid->setSpacing(1); m_rotaryGrid->setMargin(0); m_rotaryGrid->addItem(new QSpacerItem(10, 4), 0, 1); m_rotaryFrame->setLayout(m_rotaryGrid); // Rotary Mapper m_rotaryMapper = new QSignalMapper(this); connect(m_rotaryMapper, SIGNAL(mapped(int)), SLOT(slotControllerChanged(int))); connect(Instrument::getStaticSignals().data(), SIGNAL(changed(Instrument *)), SLOT(slotInstrumentChanged(Instrument *))); // Layout QGridLayout *mainGrid = new QGridLayout(this); mainGrid->setMargin(0); mainGrid->setSpacing(3); mainGrid->setColumnStretch(2, 1); mainGrid->addWidget(m_instrumentLabel, 0, 0, 1, 4, Qt::AlignCenter); mainGrid->addWidget(m_connectionLabel, 1, 0, 1, 4, Qt::AlignCenter); mainGrid->addItem(new QSpacerItem(1, 5), 2, 0, 1, 4); mainGrid->addWidget(percussionLabel, 3, 0, 1, 2, Qt::AlignLeft); mainGrid->addWidget(m_percussionCheckBox, 3, 3, Qt::AlignLeft); mainGrid->addWidget(m_bankLabel, 4, 0, Qt::AlignLeft); mainGrid->addWidget(m_bankCheckBox, 4, 1, Qt::AlignRight); mainGrid->addWidget(m_bankComboBox, 4, 2, 1, 2, Qt::AlignRight); mainGrid->addWidget(m_programLabel, 5, 0, Qt::AlignLeft); mainGrid->addWidget(m_programCheckBox, 5, 1, Qt::AlignRight); mainGrid->addWidget(m_programComboBox, 5, 2, 1, 2, Qt::AlignRight); mainGrid->addWidget(m_variationLabel, 6, 0); mainGrid->addWidget(m_variationCheckBox, 6, 1); mainGrid->addWidget(m_variationComboBox, 6, 2, 1, 2, Qt::AlignRight); mainGrid->addWidget(channelLabel, 7, 0, Qt::AlignLeft); mainGrid->addWidget(m_channelValue, 7, 2, 1, 2, Qt::AlignRight); mainGrid->addWidget(m_receiveExternalCheckBox, 8, 3, Qt::AlignLeft); mainGrid->addWidget(receiveExternalLabel, 8, 0, 1, 3, Qt::AlignLeft); mainGrid->addItem(new QSpacerItem(1, 5), 9, 0, 1, 4); // Add the rotary frame to the main grid layout. mainGrid->addWidget(m_rotaryFrame, 10, 0, 1, 4, Qt::AlignHCenter); mainGrid->addItem(new QSpacerItem(1, 1), 11, 0, 1, 4); // Let the last row take up the rest of the space. This keeps // the widgets above compact vertically. mainGrid->setRowStretch(11, 1); setLayout(mainGrid); setContentsMargins(2, 7, 2, 2); }
void EditWidget::majMargin(int left, int right) { setContentsMargins(left, 5, right, 5); }
DataPointRunContentView::DataPointRunContentView() : OSListView() { setContentsMargins(0,5,0,5); }
LuminaireDefinitionInspectorView::LuminaireDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent) : ModelObjectInspectorView(model, true, parent) { m_isIP = isIP; auto visibleWidget = new QWidget(); this->stackedWidget()->addWidget(visibleWidget); auto mainGridLayout = new QGridLayout(); mainGridLayout->setContentsMargins(7,7,7,7); mainGridLayout->setSpacing(14); visibleWidget->setLayout(mainGridLayout); // Name QLabel * label = new QLabel("Name: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,0,0); m_nameEdit = new OSLineEdit(); mainGridLayout->addWidget(m_nameEdit,1,0,1,2); // Lighting Power label = new QLabel("Lighting Power: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,2,0); m_lightingPowerEdit = new OSQuantityEdit(m_isIP); connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_lightingPowerEdit, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_lightingPowerEdit,3,0); // Fraction Radiant label = new QLabel("Fraction Radiant: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,4,0); m_fractionRadiantEdit = new OSQuantityEdit(m_isIP); connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_fractionRadiantEdit, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_fractionRadiantEdit,5,0); // Fraction Visible label = new QLabel("Fraction Visible: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,4,1); m_fractionVisibleEdit = new OSQuantityEdit(m_isIP); connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_fractionVisibleEdit, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_fractionVisibleEdit,5,1); // Return Air Fraction label = new QLabel("Return Air Fraction: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,6,0); m_returnAirFractionEdit = new OSQuantityEdit(m_isIP); connect(this, &LuminaireDefinitionInspectorView::toggleUnitsClicked, m_returnAirFractionEdit, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_returnAirFractionEdit,7,0); // Stretch mainGridLayout->setRowStretch(8,100); mainGridLayout->setColumnStretch(2,100); }
VolumeRenderWidget::VolumeRenderWidget(QWidget *parent) :m_renderMode(0), QWidget(parent) { m_openGLWidget = new QVTKOpenGLWidget(this); vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; m_openGLWidget->SetRenderWindow(renderWindow); m_renderer = vtkSmartPointer<vtkOpenGLRenderer>::New(); m_renderer->BackingStoreOn(); renderWindow->AddRenderer(m_renderer); renderWindow->Render(); // making opengl context vtkSmartPointer<vtkVolumeProperty> volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New(); vtkSmartPointer<vtkColorTransferFunction> colorFun = vtkSmartPointer<vtkColorTransferFunction>::New(); vtkSmartPointer<vtkPiecewiseFunction> opacityFun = vtkSmartPointer<vtkPiecewiseFunction>::New(); vtkSmartPointer<vtkPiecewiseFunction> gradientFun = vtkSmartPointer<vtkPiecewiseFunction>::New(); volumeProperty->SetColor(colorFun); volumeProperty->SetScalarOpacity(opacityFun); volumeProperty->SetGradientOpacity(gradientFun); volumeProperty->ShadeOn(); volumeProperty->SetInterpolationTypeToLinear(); volumeProperty->SetAmbient(0.6); volumeProperty->SetDiffuse(0.9); volumeProperty->SetSpecular(0.5); volumeProperty->SetSpecularPower(10.0); //volumeProperty->IndependentComponentsOff(); m_settingsWidget = new VolumeRenderSettingsWidget(volumeProperty, this); connect(this, &VolumeRenderWidget::imageDataChanged, m_settingsWidget, &VolumeRenderSettingsWidget::setImage); connect(m_settingsWidget, &VolumeRenderSettingsWidget::propertyChanged, this, &VolumeRenderWidget::updateRendering); connect(m_settingsWidget, &VolumeRenderSettingsWidget::renderModeChanged, this, &VolumeRenderWidget::setRenderMode); connect(m_settingsWidget, &VolumeRenderSettingsWidget::cropPlanesChanged, this, &VolumeRenderWidget::setCropPlanes); auto layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_openGLWidget); this->setLayout(layout); //adding orientation prop m_orientationProp = std::make_shared<OrientationActorContainer>(); auto orientationPropPtr = std::static_pointer_cast<VolumeActorContainer>(m_orientationProp).get(); m_volumeProps.push_back(orientationPropPtr); m_renderer->AddActor(m_orientationProp->getActor()); //window settings m_renderer->SetBackground(0, 0, 0); auto menuIcon = QIcon(QString("resources/icons/settings.svg")); auto menuButton = new QPushButton(menuIcon, QString(), m_openGLWidget); menuButton->setIconSize(QSize(24, 24)); menuButton->setStyleSheet("QPushButton {background-color:transparent;}"); auto menu = new QMenu(menuButton); menuButton->setMenu(menu); auto showAdvancedAction = menu->addAction(tr("Advanced")); connect(showAdvancedAction, &QAction::triggered, m_settingsWidget, &VolumeRenderSettingsWidget::toggleVisibility); auto showGrapicsAction = menu->addAction(tr("Show graphics")); showGrapicsAction->setCheckable(true); showGrapicsAction->setChecked(true); connect(showGrapicsAction, &QAction::toggled, this, &VolumeRenderWidget::setActorsVisible); menu->addAction(QString(tr("Set background color")), [=]() { auto color = QColorDialog::getColor(Qt::black, this); if (color.isValid()) m_renderer->SetBackground(color.redF(), color.greenF(), color.blueF()); updateRendering(); }); menu->addAction(QString(tr("Save image to file")), [=]() { auto filename = QFileDialog::getSaveFileName(this, tr("Save File"), "untitled.png", tr("Images (*.png)")); if (!filename.isEmpty()) { auto renderWindow = m_openGLWidget->GetRenderWindow(); vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New(); windowToImageFilter->SetInput(renderWindow); windowToImageFilter->SetScale(3, 3); //set the resolution of the output image (3 times the current resolution of vtk render window) windowToImageFilter->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel windowToImageFilter->ReadFrontBufferOff(); // read from the back buffer windowToImageFilter->Update(); vtkSmartPointer<vtkPNGWriter> writer = vtkSmartPointer<vtkPNGWriter>::New(); writer->SetFileName(filename.toLatin1().data()); writer->SetInputConnection(windowToImageFilter->GetOutputPort()); writer->Write(); } }); }
ChartBar::ChartBar(Context *context) : QWidget(context->mainWindow), context(context) { // left / right scroller icon static QIcon leftIcon = iconFromPNG(":images/mac/left.png"); static QIcon rightIcon = iconFromPNG(":images/mac/right.png"); setContentsMargins(0,0,0,0); // main layout QHBoxLayout *mlayout = new QHBoxLayout(this); mlayout->setSpacing(0); mlayout->setContentsMargins(0,0,0,0); // buttonBar Widget buttonBar = new ButtonBar(this); buttonBar->setContentsMargins(0,0,0,0); QHBoxLayout *vlayout = new QHBoxLayout(buttonBar); vlayout->setSpacing(0); vlayout->setContentsMargins(0,0,0,0); layout = new QHBoxLayout; layout->setSpacing(2); layout->setContentsMargins(0,0,0,0); vlayout->addLayout(layout); vlayout->addStretch(); // scrollarea scrollArea = new QScrollArea(this); scrollArea->setAutoFillBackground(false); scrollArea->setWidgetResizable(true); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setContentsMargins(0,0,0,0); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); QFontMetrics fs(buttonFont); setFixedHeight(fs.height()+spacing_); scrollArea->setFixedHeight(fs.height()+spacing_); buttonBar->setFixedHeight(fs.height()+spacing_); scrollArea->setWidget(buttonBar); // scroll area turns it on .. we turn it off! buttonBar->setAutoFillBackground(false); // scroller buttons left = new QToolButton(this); left->setStyleSheet("QToolButton { border: none; padding: 0px; }"); left->setAutoFillBackground(false); left->setFixedSize(20,20); left->setIcon(leftIcon); left->setIconSize(QSize(20,20)); left->setFocusPolicy(Qt::NoFocus); mlayout->addWidget(left); connect(left, SIGNAL(clicked()), this, SLOT(scrollLeft())); // menu bar in the middle of the buttons mlayout->addWidget(scrollArea); right = new QToolButton(this); right->setStyleSheet("QToolButton { border: none; padding: 0px; }"); right->setAutoFillBackground(false); right->setFixedSize(20,20); right->setIcon(rightIcon); right->setIconSize(QSize(20,20)); right->setFocusPolicy(Qt::NoFocus); mlayout->addWidget(right); connect(right, SIGNAL(clicked()), this, SLOT(scrollRight())); // spacer to make the menuButton on the right QLabel *spacer = new QLabel("", this); spacer->setAutoFillBackground(false); spacer->setFixedHeight(20); spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); mlayout->addWidget(spacer); menuButton = new QToolButton(this); menuButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); menuButton->setAutoFillBackground(false); menuButton->setFixedSize(20,20); menuButton->setIcon(iconFromPNG(":images/sidebar/extra.png")); menuButton->setIconSize(QSize(10,10)); menuButton->setFocusPolicy(Qt::NoFocus); mlayout->addWidget(menuButton); //connect(p, SIGNAL(clicked()), action, SLOT(trigger())); signalMapper = new QSignalMapper(this); // maps each option connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(clicked(int))); barMenu = new QMenu("Add"); chartMenu = barMenu->addMenu(tr("Add Chart")); #ifdef GC_HAS_CLOUD_DB barMenu->addAction(tr("Upload Chart..."), context->mainWindow, SLOT(exportChartToCloudDB())); barMenu->addAction(tr("Download Chart..."), context->mainWindow, SLOT(addChartFromCloudDB())); #endif // menu connect(menuButton, SIGNAL(clicked()), this, SLOT(menuPopup())); connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu())); connect(chartMenu, SIGNAL(triggered(QAction*)), context->mainWindow, SLOT(addChart(QAction*))); // trap resize / mouse events installEventFilter(this); // appearance update connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32))); }
ViewerToolBar::ViewerToolBar(QWidget *parent) : QToolBar(parent) { downloadIsCompleted = true; //start_Action = new QAction(this); //start_Action->setIcon(QIcon::fromTheme("start")); //start_Action->setToolTip(tr("Start")); //start_Menu = new QMenu(this); //restore_Action = start_Menu->addAction(tr("Restore")); //restore_Action->setIcon(QIcon::fromTheme("start")); //start_Action->setMenu(start_Menu); pause_Action = new QAction(this); pause_Action->setIcon(QIcon::fromTheme("pause")); pause_Action->setToolTip(tr("Pause")); destroy_Menu = new QMenu(this); reboot_Action = destroy_Menu->addAction(tr("Reboot")); reboot_Action->setIcon(QIcon::fromTheme("reboot")); reset_Action = destroy_Menu->addAction(tr("Reset")); reset_Action->setIcon(QIcon::fromTheme("reset")); destroy_Menu->addSeparator(); shutdown_Action = destroy_Menu->addAction(tr("Shutdown")); shutdown_Action->setIcon(QIcon::fromTheme("shutdown")); save_Action = destroy_Menu->addAction(tr("Save")); save_Action->setIcon(QIcon::fromTheme("save")); destroy_Action = new QAction(this); destroy_Action->setIcon(QIcon::fromTheme("destroy")); destroy_Action->setToolTip(tr("Stop")); destroy_Action->setMenu(destroy_Menu); snapshot_Menu = new QMenu(this); createSnapshot = snapshot_Menu->addAction( tr("create Snapshot of Current Domain")); createSnapshot->setIcon(QIcon::fromTheme("camera-photo")); moreSnapshot_Actions = snapshot_Menu->addAction( tr("more Snapshot actions for Domain")); moreSnapshot_Actions->setIcon(QIcon::fromTheme("camera-photo")); snapshot_Action = new QAction(this); snapshot_Action->setIcon(QIcon::fromTheme("camera-photo")); snapshot_Action->setToolTip(tr("Snapshot now!")); snapshot_Action->setMenu(snapshot_Menu); reconnect_Action = new QAction(this); reconnect_Action->setIcon(QIcon::fromTheme("view-refresh")); reconnect_Action->setToolTip(tr("Reconnect")); keySeq_Action = new QAction(this); keySeq_Action->setIcon(QIcon::fromTheme("input-keyboard")); keySeq_Action->setToolTip(tr("Send key sequence")); keySequenceMenu = new QMenu(this); keySeq_Action->setMenu(keySequenceMenu); sendKeySeq_BackSpc = keySequenceMenu->addAction("Ctrl+Alt+BackSpace"); sendKeySeq_Del = keySequenceMenu->addAction("Ctrl+Alt+Del"); keySequenceMenu->addSeparator(); sendKeySeq_1 = keySequenceMenu->addAction("Ctrl+Alt+F1"); sendKeySeq_2 = keySequenceMenu->addAction("Ctrl+Alt+F2"); sendKeySeq_3 = keySequenceMenu->addAction("Ctrl+Alt+F3"); sendKeySeq_4 = keySequenceMenu->addAction("Ctrl+Alt+F4"); sendKeySeq_5 = keySequenceMenu->addAction("Ctrl+Alt+F5"); sendKeySeq_6 = keySequenceMenu->addAction("Ctrl+Alt+F6"); sendKeySeq_7 = keySequenceMenu->addAction("Ctrl+Alt+F7"); sendKeySeq_8 = keySequenceMenu->addAction("Ctrl+Alt+F8"); keySequenceMenu->addSeparator(); getScreenshot = keySequenceMenu->addAction(tr("get Guest Screenshot")); copyFiles_Action = new QAction(this); copyFiles_Action->setIcon(QIcon::fromTheme("document-send")); copyFiles_Action->setToolTip(tr("Copy Files to Guest")); copyToClipboard = new QAction(this); copyToClipboard->setIcon(QIcon::fromTheme("edit-copy")); copyToClipboard->setToolTip(tr("Copy from Guest to Clipboard")); pasteClipboard = new QAction(this); pasteClipboard->setIcon(QIcon::fromTheme("edit-paste")); pasteClipboard->setToolTip(tr("Paste Clipboard to Guest")); fullScreen = new QAction(this); fullScreen->setIcon(QIcon::fromTheme("fullscreen")); fullScreen->setToolTip(tr("FullScreen")); scaled_to = new QAction(this); scaled_to->setIcon(QIcon::fromTheme("scaled_to_window")); scaled_to->setToolTip(tr("Scale to window")); vm_stateWdg = new VM_State_Widget(this); //addAction(start_Action); addAction(pause_Action); addAction(destroy_Action); sep1 = addSeparator(); addAction(snapshot_Action); sep2 = addSeparator(); addAction(reconnect_Action); addSeparator(); addAction(keySeq_Action); addAction(copyFiles_Action); addAction(copyToClipboard); addAction(pasteClipboard); addSeparator(); addAction(fullScreen); addAction(scaled_to); addSeparator(); stateWdg_Action = addWidget(vm_stateWdg); connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(detectTriggeredAction(QAction*))); setContentsMargins(0,0,0,0); }
TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0), abandonAction(0) { // Build filter row setContentsMargins(0,0,0,0); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0,0,0,0); if (platformStyle->getUseExtraSpacing()) { hlayout->setSpacing(5); hlayout->addSpacing(26); } else { hlayout->setSpacing(0); hlayout->addSpacing(23); } watchOnlyWidget = new QComboBox(this); watchOnlyWidget->setFixedWidth(24); watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All); watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes); watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No); hlayout->addWidget(watchOnlyWidget); dateWidget = new QComboBox(this); if (platformStyle->getUseExtraSpacing()) { dateWidget->setFixedWidth(121); } else { dateWidget->setFixedWidth(120); } dateWidget->addItem(tr("All"), All); dateWidget->addItem(tr("Today"), Today); dateWidget->addItem(tr("This week"), ThisWeek); dateWidget->addItem(tr("This month"), ThisMonth); dateWidget->addItem(tr("Last month"), LastMonth); dateWidget->addItem(tr("This year"), ThisYear); dateWidget->addItem(tr("Range..."), Range); hlayout->addWidget(dateWidget); typeWidget = new QComboBox(this); if (platformStyle->getUseExtraSpacing()) { typeWidget->setFixedWidth(121); } else { typeWidget->setFixedWidth(120); } typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES); typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) | TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther)); typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) | TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); hlayout->addWidget(typeWidget); addressWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 addressWidget->setPlaceholderText(tr("Enter address or label to search")); #endif hlayout->addWidget(addressWidget); amountWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 amountWidget->setPlaceholderText(tr("Min amount")); #endif if (platformStyle->getUseExtraSpacing()) { amountWidget->setFixedWidth(97); } else { amountWidget->setFixedWidth(100); } amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); hlayout->addWidget(amountWidget); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(0,0,0,0); vlayout->setSpacing(0); QTableView *view = new QTableView(this); vlayout->addLayout(hlayout); vlayout->addWidget(createDateRangeWidget()); vlayout->addWidget(view); vlayout->setSpacing(0); int width = view->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing if (platformStyle->getUseExtraSpacing()) { hlayout->addSpacing(width+2); } else { hlayout->addSpacing(width); } // Always show scroll bar view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setTabKeyNavigation(false); view->setContextMenuPolicy(Qt::CustomContextMenu); view->installEventFilter(this); transactionView = view; // Actions abandonAction = new QAction(tr("Abandon transaction"), this); QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this); QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this); QAction *copyTxPlainText = new QAction(tr("Copy full transaction details"), this); QAction *editLabelAction = new QAction(tr("Edit label"), this); QAction *showDetailsAction = new QAction(tr("Show transaction details"), this); contextMenu = new QMenu(); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyAmountAction); contextMenu->addAction(copyTxIDAction); contextMenu->addAction(copyTxHexAction); contextMenu->addAction(copyTxPlainText); contextMenu->addAction(showDetailsAction); contextMenu->addSeparator(); contextMenu->addAction(abandonAction); contextMenu->addAction(editLabelAction); mapperThirdPartyTxUrls = new QSignalMapper(this); // Connect actions connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString))); connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int))); connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex())); connect(copyTxPlainText, SIGNAL(triggered()), this, SLOT(copyTxPlainText())); connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); }
void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) { QRect scr = QApplication::desktop()->screenGeometry(pos); QSize sh = sizeHint(); const int border = 1; const int ah = 18, ao = 18, aw = 18, rc = 7; bool arrowAtTop = (pos.y() + sh.height() + ah < scr.height()); bool arrowAtLeft = (pos.x() + sh.width() - ao < scr.width()); setContentsMargins(border + 3, border + (arrowAtTop ? ah : 0) + 2, border + 3, border + (arrowAtTop ? 0 : ah) + 2); updateGeometry(); sh = sizeHint(); int ml, mr, mt, mb; QSize sz = sizeHint(); if (!arrowAtTop) { ml = mt = 0; mr = sz.width() - 1; mb = sz.height() - ah - 1; } else { ml = 0; mt = ah; mr = sz.width() - 1; mb = sz.height() - 1; } QPainterPath path; #if defined(QT_NO_XSHAPE) && defined(Q_WS_X11) // XShape is required for setting the mask, so we just // draw an ugly square when its not available path.moveTo(0, 0); path.lineTo(sz.width() - 1, 0); path.lineTo(sz.width() - 1, sz.height() - 1); path.lineTo(0, sz.height() - 1); path.lineTo(0, 0); move(qMax(pos.x() - sz.width(), scr.left()), pos.y()); #else path.moveTo(ml + rc, mt); if (arrowAtTop && arrowAtLeft) { if (showArrow) { path.lineTo(ml + ao, mt); path.lineTo(ml + ao, mt - ah); path.lineTo(ml + ao + aw, mt); } move(qMax(pos.x() - ao, scr.left() + 2), pos.y()); } else if (arrowAtTop && !arrowAtLeft) { if (showArrow) { path.lineTo(mr - ao - aw, mt); path.lineTo(mr - ao, mt - ah); path.lineTo(mr - ao, mt); } move(qMin(pos.x() - sh.width() + ao, scr.right() - sh.width() - 2), pos.y()); } path.lineTo(mr - rc, mt); path.arcTo(QRect(mr - rc*2, mt, rc*2, rc*2), 90, -90); path.lineTo(mr, mb - rc); path.arcTo(QRect(mr - rc*2, mb - rc*2, rc*2, rc*2), 0, -90); if (!arrowAtTop && !arrowAtLeft) { if (showArrow) { path.lineTo(mr - ao, mb); path.lineTo(mr - ao, mb + ah); path.lineTo(mr - ao - aw, mb); } move(qMin(pos.x() - sh.width() + ao, scr.right() - sh.width() - 2), pos.y() - sh.height()); } else if (!arrowAtTop && arrowAtLeft) { if (showArrow) { path.lineTo(ao + aw, mb); path.lineTo(ao, mb + ah); path.lineTo(ao, mb); } move(qMax(pos.x() - ao, scr.x() + 2), pos.y() - sh.height()); } path.lineTo(ml + rc, mb); path.arcTo(QRect(ml, mb - rc*2, rc*2, rc*2), -90, -90); path.lineTo(ml, mt + rc); path.arcTo(QRect(ml, mt, rc*2, rc*2), 180, -90); // Set the mask QBitmap bitmap = QBitmap(sizeHint()); bitmap.fill(Qt::color0); QPainter painter1(&bitmap); painter1.setPen(QPen(Qt::color1, border)); painter1.setBrush(QBrush(Qt::color1)); painter1.drawPath(path); setMask(bitmap); #endif // Draw the border pixmap = QPixmap(sz); QPainter painter2(&pixmap); painter2.setPen(QPen(palette().color(QPalette::Window).darker(160), border)); painter2.setBrush(palette().color(QPalette::Window)); painter2.drawPath(path); if (msecs > 0) timerId = startTimer(msecs); show(); }
void LostCloudConnectionDialog::createWidgets(bool internetAvailable, bool authenticated, bool cloudRunning) { //// OS SETTINGS #ifdef Q_OS_MAC setWindowFlags(Qt::FramelessWindowHint); #else setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); #endif ///// BUTTONS this->cancelButton()->hide(); this->okButton()->hide(); this->backButton()->hide(); QLabel * label = nullptr; QVBoxLayout * mainLayout = this->upperLayout(); mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); label = new QLabel; label->setWordWrap(true); label->setText("The cloud connection was interrupted. The cloud may still be running and accruing charges."); mainLayout->addWidget(label); label = new QLabel; label->setText("<b>" + (tr("Requirements for cloud:")) + "</b>"); mainLayout->addWidget(label); auto vLayout = new QVBoxLayout; vLayout->setContentsMargins(QMargins(0,0,0,0)); vLayout->setSpacing(5); vLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); mainLayout->addLayout(vLayout); // 1 Determine if there is an internet connection label = new QLabel; vLayout->addWidget(label); if(internetAvailable){ label->setText("<FONT COLOR = GREEN>1. <FONT COLOR = BLACK>" + tr("Internet Connection: ") + "<b> <FONT COLOR = GREEN>" + tr("yes") + "</b>"); } else { label->setText("<FONT COLOR = RED>1. <FONT COLOR = BLACK>" + tr("Internet Connection: ") + "<b> <FONT COLOR = RED>" + tr("no") + "</b>"); } // 2 Determine if the cloud login is accepted label = new QLabel; vLayout->addWidget(label); if(authenticated){ label->setText("<FONT COLOR = GREEN>2. <FONT COLOR = BLACK>" + tr("Cloud Log-in: ") + "<b> <FONT COLOR = GREEN>" + tr("accepted") + "</b>"); } else { label->setText("<FONT COLOR = RED>2. <FONT COLOR = BLACK>" + tr("Cloud Log-in: ") + "<b> <FONT COLOR = RED>" + tr("denied") + "</b>"); } // 3 Determine if there is a cloud connection label = new QLabel; vLayout->addWidget(label); if(cloudRunning){ label->setText("<FONT COLOR = GREEN>3. <FONT COLOR = BLACK>" + tr("Cloud Connection: ") + "<b> <FONT COLOR = GREEN>" + tr("reconnected") + "</b>"); } else { label->setWordWrap(true); label->setText("<FONT COLOR = RED>3. <FONT COLOR = BLACK>" + tr("Cloud Connection: ") + "<b> <FONT COLOR = RED>" + tr("unable to reconnect. ") + "</b>" + "<FONT COLOR = BLACK>" + tr("Remember that cloud charges may currently be accruing.")); createCloudConnectionWidgets(vLayout); } }
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent) { #if defined(Q_OS_WIN) || defined(Q_OS_LINUX) resize(530, 620); setMinimumSize(530, 620); #elif defined(Q_OS_MAC) resize(660, 690); setMinimumSize(660, 690); #endif setWindowModality(Qt::WindowModal); QString titleText = tr("About %1").arg(Defs::APP_NAME); setWindowTitle(titleText); WidgetUtils::removeContextHelpButton(this); auto introduction = new QLabel; introduction->setText( tr("<h2>%1<sup>®</sup> v%2%3</h2>" "<h6>Built on %4 at %5<br />With %6<br /></h6>" ).arg(Defs::APP_NAME, Defs::APP_VERSION_STR, Defs::APP_STAGE_STR, QStringLiteral(__DATE__), QStringLiteral(__TIME__)) #if defined(Q_OS_WIN) .arg(Defs::WIN_COMPILER) #elif defined(Q_OS_MAC) .arg(Defs::MAC_COMPILER) #elif defined(Q_OS_LINUX) .arg(Defs::LIN_COMPILER) #endif ); auto icon = new QLabel; auto app_logo_2x = QPixmap(QStringLiteral(":/icons/app-logo-about")); #if defined(Q_OS_MAC) app_logo_2x.setDevicePixelRatio(2.0); #endif icon->setPixmap(app_logo_2x); // About information auto infoWidget = new QWidget; auto infoLabel = new QLabel; infoLabel-> setText( tr("<br />%1 is an open source software application that is developed, " "maintained, supported by LI-COR Biosciences. It originates from " "ECO2S, the Eddy COvariance COmmunity Software project, which was " "developed as part of the IMECC-EU research project.</p>" "<p>We gratefully acknowledge the IMECC consortium, the ECO2S " "development team, the University of Tuscia (Italy) and scientists " "around the world who assisted with development and testing of the " "original version of this software." "<p>Copyright © 2011-%2 LI-COR Inc.</p>" "<div>Contact LI-COR Inc.:</div><br />" "<div style=\"text-indent: 20px;\">4647 Superior Street</div>" "<div style=\"text-indent: 20px;\">P.O. Box 4000</div>" "<div style=\"text-indent: 20px;\">Lincoln, Nebraska, 68504, USA</div><br />" "<div style=\"text-indent: 20px;\">Phone: 1-402-467-3576</div>" "<div style=\"text-indent: 20px;\">Toll Free: 800-447-3576</div>" "<div style=\"text-indent: 20px;\">Fax: 1-402-467-2819</div>" "<div style=\"text-indent: 20px;\">Email: <a href=\"mailto:[email protected]?subject=EddyPro %3\">[email protected]</a></div>" "<div style=\"text-indent: 20px;\">Website: <a href=\"http://www.licor.com\">http://www.licor.com</a></div>" ).arg(Defs::APP_NAME, Defs::CURRENT_COPYRIGHT_YEAR, Defs::APP_VERSION_STR) ); infoLabel->setOpenExternalLinks(true); infoLabel->setWordWrap(true); auto infoLayout = new QVBoxLayout; infoLayout->addWidget(infoLabel); infoLayout->addStretch(); infoWidget->setLayout(infoLayout); // Thanks auto thanksWidget = new QWidget; auto thanksLabel = new QLabel; thanksLabel->setText( tr("<br />We would like to thank the whole " "Eddy Covariance community, the authors, testers, the users and the " "following people (and the missing ones), in no special " "order, for their collaboration and source code contribution " "to create this free software." )); thanksLabel->setWordWrap(true); auto thanksEdit = new QTextEdit; thanksEdit->setText( tr("<h4>Original Authors</h4>" "<ul type=\"square\">" "<li>Gerardo Fratini ([email protected]): processing engines designer and developer</li>" "<li>Antonio Forgione ([email protected]): GUI designer and developer</li>" "<li>Dario Papale ([email protected]): project manager and coordinator</li>" "</ul>" "<h4>Others contributors</h4>" "<ul type=\"square\">" "<li>Carlo Trotta: code harmonization and documentation</li>" "<li>Natascha Kljun: code for footprint estimation, Kljun et al. (2004, BLM)</li>" "<li>Taro Nakai: code for angle of attack correction, Nakai et al. (2006, AFM)</li>" "<li>Andreas Ibrom: supervision during implementation of a spectral correction procedure, Ibrom et al. (2007, AFM)</li>" "<li>Stephen Chan: Revision, refinement and testing of implementation of Massman 2000/2001 spectral correction.</li>" "</ul>" "<h4>Software validation (intercomparison)</h4>" "<ul type=\"square\">" "<li>Juha-Pekka Tuovinen</li>" "<li>Andreas Ibrom</li>" "<li>Ivan Mammarella</li>" "<li>Robert Clement</li>" "<li>Meelis Molder</li>" "<li>Olaf Kolle</li>" "<li>Corinna Rebmann</li>" "<li>Matthias Mauder</li>" "<li>Jan Elbers</li>" "</ul>" "<h4>User testing and bug notifications</h4>" "<ul type=\"square\">" "<li>Tarek El-Madany</li>" "<li>Sergiy Medinets</li>" "<li>Beniamino Gioli</li>" "<li>Nicola Arriga</li>" "<li>Luca Belelli</li>" "<li>Michal Heliasz</li>" "<li>Bernard Heinesch</li>" "<li>Arnaud Carrara</li>" "<li>Patrik Vestin</li>" "<li>Matthias Barthel</li>" "<li>Karoline Wischnewski</li>" "<li>Matthew Wilkinson</li>" "<li>Simone Sabbatini</li>" "</ul>" "<h4>Software discussions</h4>" "<ul type=\"square\">" "<li>Ian Elbers</li>" "<li>George Burba</li>" "<li>Christian Wille</li>" "</ul>" "<h4>Libraries</h4>" "<ul type=\"square\">" "<li>Arjan van Dijk: libdate module</li>" "<li>Michael Baudin, Arjen Markus: m_logging module</li>" "<li>University of Chicago: m_levenberg_marquardt from the MINPACK package</li>" "<li>netlib.org: FFT routines from the SLATEC Common Mathematical Library</li>" "<li>The Qt Company: Qt framework</li>" "<li>Boost::math</li>" "<li>Trenton Schulz (Trolltech AS): Fader widget</li>" "<li>Morgan Leborgne: QProgressIndicator widget</li>" "<li>Witold Wysota: Debug helper class</li>" "<li>Sergey A. Tachenov: QuaZIP</li>" "<li>Mark Summerfield: classes from the book 'Advanced Qt Programming'</li>" "</ul>" "<h4>Tools</h4>" "<ul type=\"square\">" "<li>GFortran compiler</li>" "<li>MinGW compiler and GDB debugger</li>" "<li>Clang compiler</li>" "<li>The Qt Company: Qt Creator IDE</li>" "<li>Code::Blocks IDE</li>" "<li>\n</li>" "</ul>")); thanksEdit->setReadOnly(true); auto thanksLayout = new QVBoxLayout; thanksLayout->addWidget(thanksLabel); thanksLayout->addWidget(thanksEdit); thanksWidget->setLayout(thanksLayout); // License auto licenseWidget = new QWidget; auto licenseLabel = new QLabel; licenseLabel->setText( tr("<br />The %1 software application is Copyright © 2011-%2 " "LI-COR Inc.\n\n" "You may use, distribute and copy the %1 programs suite under " "the terms of the GNU General Public License version 3, " "which is displayed below. If you would like to obtain " "a copy of the source package please contact LI-COR " "Biosciences at " "<a href=\"mailto:[email protected]?subject=%1 %3&body=" "Please, send me a copy of the source package." "\">[email protected]</a>." ).arg(Defs::APP_NAME, Defs::CURRENT_COPYRIGHT_YEAR, Defs::APP_VERSION_STR)); licenseLabel->setWordWrap(true); licenseLabel->setOpenExternalLinks(true); auto licenseEdit = new QTextEdit; QFile licenseFile(QStringLiteral(":/docs/license")); licenseFile.open(QIODevice::ReadOnly | QIODevice::Text); licenseEdit->setText(QLatin1String(licenseFile.readAll())); licenseEdit->setReadOnly(true); licenseFile.close(); auto licenseLayout = new QVBoxLayout; licenseLayout->addWidget(licenseLabel); licenseLayout->addWidget(licenseEdit); licenseWidget->setLayout(licenseLayout); // Changelog auto changelogWidget = new QWidget; auto changelogLabel = new QLabel; changelogLabel->setText( tr("<br />Software updates include bug fixes, usability " "improvements\n\n and feature enhancements. These are summarized " "in the change log below.")); changelogLabel->setWordWrap(true); changelogLabel->setOpenExternalLinks(true); auto changelogEdit = new QTextEdit; QFile changelogFile(QStringLiteral(":/docs/changelog")); changelogFile.open(QIODevice::ReadOnly | QIODevice::Text); changelogEdit->setText(QLatin1String(changelogFile.readAll())); changelogEdit->setReadOnly(true); changelogFile.close(); auto changelogLayout = new QVBoxLayout; changelogLayout->addWidget(changelogLabel); changelogLayout->addWidget(changelogEdit); changelogWidget->setLayout(changelogLayout); // Dialog Tabs auto tab = new QTabWidget; tab->addTab(infoWidget, tr("About")); tab->addTab(thanksWidget, tr("Acknowledgments")); tab->addTab(licenseWidget, tr("License")); tab->addTab(changelogWidget, tr("Changes")); auto okButton = WidgetUtils::createCommonButton(this, tr("Ok")); auto dialogLayout = new QVBoxLayout(this); dialogLayout->addWidget(icon, 0, Qt::AlignCenter); dialogLayout->addWidget(introduction, 0, Qt::AlignCenter); dialogLayout->addWidget(tab); dialogLayout->addWidget(okButton, 0, Qt::AlignCenter); dialogLayout->setContentsMargins(30, 30, 30, 30); setLayout(dialogLayout); connect(okButton, &QPushButton::clicked, [=](){ if (this->isVisible()) hide(); }); }
QWidget* MainPage::showNoContactsYetSuggestions(QWidget *parent, std::function<void()> addNewContactsRoutine) { if (!noContactsYetSuggestions_) { noContactsYetSuggestions_ = new QWidget(parent); noContactsYetSuggestions_->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding); noContactsYetSuggestions_->setStyleSheet("background-color: white;"); { auto l = new QVBoxLayout(noContactsYetSuggestions_); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); l->setAlignment(Qt::AlignCenter); { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new QWidget(p); w->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); w->setStyleSheet("image: url(:/resources/main_window/content_logo_200.png);"); w->setFixedSize(Utils::scale_value(64), Utils::scale_value(64)); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(44)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "Install ICQ on mobile")); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(30)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "to synchronize your contacts")); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, Utils::scale_value(28), 0, 0); pl->setSpacing(Utils::scale_value(8)); pl->setAlignment(Qt::AlignCenter); { auto as = new QPushButton(p); as->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); as->setFlat(true); auto asu = QString(":/resources/placeholders/content_badge_appstore_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper()); auto asi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(asu).arg(asu); as->setStyleSheet(asi); as->setFixedSize(Utils::scale_value(152), Utils::scale_value(44)); as->setCursor(Qt::PointingHandCursor); parent->connect(as, &QPushButton::clicked, []() { QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/id302707408?pid=icq_win")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_ios); }); pl->addWidget(as); auto gp = new QPushButton(p); gp->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); gp->setFlat(true); auto gpu = QString(":/resources/placeholders/content_badge_gplay_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper()); auto gpi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(gpu).arg(gpu); gp->setStyleSheet(gpi); gp->setFixedSize(Utils::scale_value(152), Utils::scale_value(44)); gp->setCursor(Qt::PointingHandCursor); parent->connect(gp, &QPushButton::clicked, []() { QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/com.icq.mobile.client?pid=icq_win")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_android); }); pl->addWidget(gp); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setSpacing(0); pl->setAlignment(Qt::AlignCenter); { auto w1 = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(18), QColor("#282828"), Utils::scale_value(46)); w1->setSizePolicy(QSizePolicy::Policy::Preferred, w1->sizePolicy().verticalPolicy()); w1->setText(QT_TRANSLATE_NOOP("placeholders", "or ")); pl->addWidget(w1); auto w2 = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(18), QColor("#579e1c"), Utils::scale_value(46)); w2->setSizePolicy(QSizePolicy::Policy::Preferred, w2->sizePolicy().verticalPolicy()); w2->setText(QT_TRANSLATE_NOOP("placeholders", "find friends")); w2->setCursor(Qt::PointingHandCursor); parent->connect(w2, &Ui::TextEmojiWidget::clicked, addNewContactsRoutine); pl->addWidget(w2); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(15), QColor("#696969"), Utils::scale_value(20)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "by phone number or UIN")); pl->addWidget(w); } l->addWidget(p); } } } return noContactsYetSuggestions_; }
void SelectorWidget::setItems(QStringList items, QStringList tooltips) { m_itemBoxes.clear(); m_items = items; m_tooltips = tooltips; auto layout = this->layout(); if (layout) QWidget().setLayout(layout); // Clean up auto mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(5, 5, 5, 5); mainLayout->setSpacing(0); auto addFilterContainsIcon = QIcon("://icons/Add.png"); auto addFilterDoesNotContainIcon = QIcon("://icons/Remove.png"); auto removeFilterIcon = QIcon("://icons/Delete.png"); int addFilterContainsMask = static_cast<int>(FilterActionType::addFilterContains) << 16; int addFilterDoesNotContainMask = static_cast<int>(FilterActionType::addFilterDoesNotContain) << 16; int removeFilterMask = static_cast<int>(FilterActionType::RemoveFilter) << 16; const int buttonSize = 24; for (int i = 0, nb = items.size(); i < nb; ++i) { auto boxWidget = new QWidget; auto boxLayout = new QHBoxLayout; boxLayout->setContentsMargins(0, 0, 0, 0); boxLayout->setSpacing(2); auto addFilterContainsAction = new QAction(boxWidget); addFilterContainsAction->setData(QVariant(i + addFilterContainsMask)); auto addFilterContainsButton = new QPushButton(addFilterContainsIcon, "", boxWidget); addFilterContainsButton->setMaximumSize(buttonSize, buttonSize); addFilterContainsButton->setFlat(true); addFilterContainsButton->setToolTip(tr("Only show potions that contain this item")); connect(addFilterContainsButton, SIGNAL(clicked(bool)), addFilterContainsAction, SLOT(trigger())); connect(addFilterContainsAction, SIGNAL(triggered(bool)), this, SLOT(modifyFilter())); auto addFilterDoesNotContainAction = new QAction(boxWidget); addFilterDoesNotContainAction->setData(QVariant(i + addFilterDoesNotContainMask)); auto addFilterDoesNotContainButton = new QPushButton(addFilterDoesNotContainIcon, "", boxWidget); addFilterDoesNotContainButton->setMaximumSize(buttonSize, buttonSize); addFilterDoesNotContainButton->setFlat(true); addFilterDoesNotContainButton->setToolTip(tr("Hide potions containing this item")); connect(addFilterDoesNotContainButton, SIGNAL(clicked(bool)), addFilterDoesNotContainAction, SLOT(trigger())); connect(addFilterDoesNotContainAction, SIGNAL(triggered(bool)), this, SLOT(modifyFilter())); auto removeFilterAction = new QAction(boxWidget); removeFilterAction->setData(QVariant(i + removeFilterMask)); auto removeFilterButton = new QPushButton(removeFilterIcon, "", boxWidget); removeFilterButton->setMaximumSize(buttonSize, buttonSize); removeFilterButton->setFlat(true); connect(removeFilterButton, SIGNAL(clicked(bool)), removeFilterAction, SLOT(trigger())); connect(removeFilterAction, SIGNAL(triggered(bool)), this, SLOT(modifyFilter())); removeFilterButton->hide(); boxLayout->addWidget(addFilterContainsButton); boxLayout->addWidget(removeFilterButton); boxLayout->addWidget(addFilterDoesNotContainButton); auto label = new QLabel(m_items[i]); label->setToolTip(m_tooltips[i]); boxLayout->addWidget(label); boxWidget->setLayout(boxLayout); mainLayout->addWidget(boxWidget); ItemBox itemBox; itemBox.widget = boxWidget; itemBox.addContainsButton = addFilterContainsButton; itemBox.addDoesNotContainButton = addFilterDoesNotContainButton; itemBox.removeButton = removeFilterButton; m_itemBoxes.push_back(itemBox); } }
FacilityShadingGridView::FacilityShadingGridView(bool isIP, const model::Model & model, QWidget * parent) : GridViewSubTab(isIP, model, parent) { auto modelObjects = subsetCastVector<model::ModelObject>(model.getModelObjects<model::ShadingSurfaceGroup>()); std::sort(modelObjects.begin(), modelObjects.end(), ModelObjectNameSorter()); m_gridController = new FacilityShadingGridController(isIP, "Shading Surface Group", IddObjectType::OS_ShadingSurfaceGroup, model, modelObjects); m_gridView = new OSGridView(m_gridController, "Shading Surface Group", "Drop\nShading Surface Group", false, parent); setGridController(m_gridController); setGridView(m_gridView); // Filters QLabel * label = nullptr; QVBoxLayout * layout = nullptr; auto filterGridLayout = new QGridLayout(); filterGridLayout->setContentsMargins(7, 4, 0, 8); filterGridLayout->setSpacing(5); label = new QLabel(); label->setText("Filters:"); label->setObjectName("H2"); filterGridLayout->addWidget(label, filterGridLayout->rowCount(), filterGridLayout->columnCount(), Qt::AlignTop | Qt::AlignLeft); // SHADINGSURFACEGROUPNAME layout = new QVBoxLayout(); label = new QLabel(); label->setText(SHADINGSURFACENAME); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_nameFilter = new QLineEdit(); m_nameFilter->setFixedWidth(OSItem::ITEM_WIDTH); // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke) connect(m_nameFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::nameFilterChanged); QRegExp nameRegex("^\\S.*"); auto nameValidator = new QRegExpValidator(nameRegex, this); m_nameFilter->setValidator(nameValidator); layout->addWidget(m_nameFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); // SHADINGSURFACETYPE layout = new QVBoxLayout(); label = new QLabel(); label->setText(SHADINGSURFACETYPE); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_typeFilter = new QComboBox(); m_typeFilter->addItem("Site"); m_typeFilter->addItem("Building"); m_typeFilter->addItem("Space"); m_typeFilter->setFixedWidth(OSItem::ITEM_WIDTH); connect(m_typeFilter, &QComboBox::currentTextChanged, this, &openstudio::FacilityShadingGridView::typeFilterChanged); layout->addWidget(m_typeFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); // TILTGREATERTHAN layout = new QVBoxLayout(); label = new QLabel(); label->setText(TILTGREATERTHAN); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_tiltGreaterThanFilter = new QLineEdit(); m_tiltGreaterThanFilter->setFixedWidth(OSItem::ITEM_WIDTH); connect(m_tiltGreaterThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::tiltFilterChanged); QRegExp regex("^(-?\\d*\\.?\\d+)?$"); auto validator = new QRegExpValidator(regex, this); m_tiltGreaterThanFilter->setValidator(validator); layout->addWidget(m_tiltGreaterThanFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); //TILTLESSTHAN layout = new QVBoxLayout(); label = new QLabel(); label->setText(TILTLESSTHAN); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_tiltLessThanFilter = new QLineEdit(); m_tiltLessThanFilter->setFixedWidth(OSItem::ITEM_WIDTH); // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke) connect(m_tiltLessThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::tiltFilterChanged); validator = new QRegExpValidator(regex, this); m_tiltLessThanFilter->setValidator(validator); layout->addWidget(m_tiltLessThanFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); // ORIENTATIONGREATERTHAN layout = new QVBoxLayout(); label = new QLabel(); label->setText(ORIENTATIONGREATERTHAN); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_orientationGreaterThanFilter = new QLineEdit(); m_orientationGreaterThanFilter->setFixedWidth(OSItem::ITEM_WIDTH); connect(m_orientationGreaterThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::orientationFilterChanged); validator = new QRegExpValidator(regex, this); m_orientationGreaterThanFilter->setValidator(validator); layout->addWidget(m_orientationGreaterThanFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); // ORIENTATIONLESSTHAN layout = new QVBoxLayout(); label = new QLabel(); label->setText(ORIENTATIONLESSTHAN); label->setObjectName("H3"); layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft); m_orientationLessThanFilter = new QLineEdit(); m_orientationLessThanFilter->setFixedWidth(OSItem::ITEM_WIDTH); // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke) connect(m_orientationLessThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::orientationFilterChanged); validator = new QRegExpValidator(regex, this); m_orientationLessThanFilter->setValidator(validator); layout->addWidget(m_orientationLessThanFilter, Qt::AlignTop | Qt::AlignLeft); layout->addStretch(); filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount()); filterGridLayout->setRowStretch(filterGridLayout->rowCount(), 100); filterGridLayout->setColumnStretch(filterGridLayout->columnCount(), 100); m_gridView->m_contentLayout->addLayout(filterGridLayout); m_gridView->m_contentLayout->addSpacing(7); }
ColorListWidget::ColorListWidget(Map* map, MainWindow* window, QWidget* parent) : QWidget(parent) , map(map) , window(window) { react_to_changes = true; setWhatsThis(Util::makeWhatThis("color_dock_widget.html")); // Color table color_table = new QTableWidget(map->getNumColors(), 7); color_table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::AnyKeyPressed); color_table->setSelectionMode(QAbstractItemView::SingleSelection); color_table->setSelectionBehavior(QAbstractItemView::SelectRows); color_table->verticalHeader()->setVisible(false); color_table->setHorizontalHeaderLabels(QStringList() << QString{} << tr("Name") << tr("Spot color") << tr("CMYK") << tr("RGB") << tr("K.o.") << tr("Opacity") ); color_table->setItemDelegateForColumn(0, new ColorItemDelegate(this)); color_table->setItemDelegateForColumn(6, new PercentageDelegate(this)); color_table->setColumnHidden(6, true); auto new_button_menu = new QMenu(this); (void) new_button_menu->addAction(tr("New"), this, SLOT(newColor())); duplicate_action = new_button_menu->addAction(tr("Duplicate"), this, SLOT(duplicateColor())); duplicate_action->setIcon(QIcon(QString::fromLatin1(":/images/tool-duplicate.png"))); // Buttons auto new_button = newToolButton(QIcon(QString::fromLatin1(":/images/plus.png")), tr("New")); new_button->setPopupMode(QToolButton::DelayedPopup); // or MenuButtonPopup new_button->setMenu(new_button_menu); delete_button = newToolButton(QIcon(QString::fromLatin1(":/images/minus.png")), tr("Delete")); auto add_remove_layout = new SegmentedButtonLayout(); add_remove_layout->addWidget(new_button); add_remove_layout->addWidget(delete_button); move_up_button = newToolButton(QIcon(QString::fromLatin1(":/images/arrow-up.png")), tr("Move Up")); move_up_button->setAutoRepeat(true); move_down_button = newToolButton(QIcon(QString::fromLatin1(":/images/arrow-down.png")), tr("Move Down")); move_down_button->setAutoRepeat(true); auto up_down_layout = new SegmentedButtonLayout(); up_down_layout->addWidget(move_up_button); up_down_layout->addWidget(move_down_button); // TODO: In Mapper >= 0.6, switch to ColorWidget (or generic) translation context. edit_button = newToolButton(QIcon(QString::fromLatin1(":/images/settings.png")), QApplication::translate("OpenOrienteering::MapEditorController", "&Edit").remove(QLatin1Char('&'))); edit_button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); auto help_button = newToolButton(QIcon(QString::fromLatin1(":/images/help.png")), tr("Help")); help_button->setAutoRaise(true); // The buttons row layout auto buttons_group_layout = new QHBoxLayout(); buttons_group_layout->addLayout(add_remove_layout); buttons_group_layout->addLayout(up_down_layout); buttons_group_layout->addWidget(edit_button); buttons_group_layout->addWidget(new QLabel(QString::fromLatin1(" ")), 1); buttons_group_layout->addWidget(help_button); // The layout of all components below the table auto bottom_layout = new QVBoxLayout(); QStyleOption style_option(QStyleOption::Version, QStyleOption::SO_DockWidget); bottom_layout->setContentsMargins( style()->pixelMetric(QStyle::PM_LayoutLeftMargin, &style_option) / 2, 0, // Covered by the main layout's spacing. style()->pixelMetric(QStyle::PM_LayoutRightMargin, &style_option) / 2, style()->pixelMetric(QStyle::PM_LayoutBottomMargin, &style_option) / 2 ); bottom_layout->addLayout(buttons_group_layout); bottom_layout->addWidget(new QLabel(tr("Double-click a color value to open a dialog."))); // The main layout auto layout = new QVBoxLayout(); layout->setContentsMargins(QMargins()); layout->addWidget(color_table, 1); layout->addLayout(bottom_layout); setLayout(layout); for (int i = 0; i < map->getNumColors(); ++i) addRow(i); auto header_view = color_table->horizontalHeader(); header_view->setSectionResizeMode(QHeaderView::Interactive); header_view->resizeSections(QHeaderView::ResizeToContents); header_view->setSectionResizeMode(0, QHeaderView::Fixed); // Color header_view->resizeSection(0, 32); header_view->setSectionResizeMode(1, QHeaderView::Stretch); // Name header_view->setSectionResizeMode(1, QHeaderView::Interactive); // Spot colors header_view->setSectionResizeMode(5, QHeaderView::Fixed); // Knockout header_view->resizeSection(5, 32); header_view->setSectionsClickable(false); currentCellChange(color_table->currentRow(), 0, 0, 0); // enable / disable move color buttons // Connections connect(color_table, &QTableWidget::cellChanged, this, &ColorListWidget::cellChange); connect(color_table, &QTableWidget::currentCellChanged, this, &ColorListWidget::currentCellChange); connect(color_table, &QTableWidget::cellDoubleClicked, this, &ColorListWidget::editCurrentColor); connect(new_button, &QAbstractButton::clicked, this, &ColorListWidget::newColor); connect(delete_button, &QAbstractButton::clicked, this, &ColorListWidget::deleteColor); connect(move_up_button, &QAbstractButton::clicked, this, &ColorListWidget::moveColorUp); connect(move_down_button, &QAbstractButton::clicked, this, &ColorListWidget::moveColorDown); connect(edit_button, &QAbstractButton::clicked, this, &ColorListWidget::editCurrentColor); connect(help_button, &QAbstractButton::clicked, this, &ColorListWidget::showHelp); connect(map, &Map::colorAdded, this, &ColorListWidget::colorAdded); connect(map, &Map::colorChanged, this, &ColorListWidget::colorChanged); connect(map, &Map::colorDeleted, this, &ColorListWidget::colorDeleted); }
EPGChannels::EPGChannels( QWidget *parent, EPGView *m_epgView ) : QWidget( parent ), m_epgView( m_epgView ), m_offset( 0 ) { setContentsMargins( 0, 0, 0, 0 ); }
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) : QWidget( _par ), p_intf ( _p_i ) { setContentsMargins( 0, 3, 0, 3 ); QGridLayout *layout = new QGridLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); /******************* * Left * *******************/ /* We use a QSplitter for the left part */ leftSplitter = new QSplitter( Qt::Vertical, this ); /* Source Selector */ selector = new PLSelector( this, p_intf ); leftSplitter->addWidget( selector ); /* Create a Container for the Art Label in order to have a beautiful resizing for the selector above it */ artContainer = new QStackedWidget; artContainer->setMaximumHeight( 256 ); /* Art label */ CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf ); art->setToolTip( qtr( "Double click to get media information" ) ); artContainer->addWidget( art ); CONNECT( THEMIM->getIM(), artChanged( QString ), art, showArtUpdate( const QString& ) ); CONNECT( THEMIM->getIM(), artChanged( input_item_t * ), art, showArtUpdate( input_item_t * ) ); leftSplitter->addWidget( artContainer ); /******************* * Right * *******************/ /* Initialisation of the playlist */ playlist_t * p_playlist = THEPL; PL_LOCK; playlist_item_t *p_root = p_playlist->p_playing; PL_UNLOCK; setMinimumWidth( 400 ); PLModel *model = PLModel::getPLModel( p_intf ); #ifdef MEDIA_LIBRARY MLModel *mlmodel = new MLModel( p_intf, this ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel ); #else mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL ); #endif /* Location Bar */ locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0, 1, 2 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), mainView, browseInto( const QModelIndex & ) ); QHBoxLayout *topbarLayout = new QHBoxLayout(); layout->addLayout( topbarLayout, 0, 1 ); topbarLayout->setSpacing( 10 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview") ); topbarLayout->addWidget( viewButton ); viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView )); CONNECT( viewButton, clicked(), mainView, cycleViews() ); /* Search */ searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); searchEdit->setToolTip( qtr("Search the playlist") ); topbarLayout->addWidget( searchEdit ); CONNECT( searchEdit, textChanged( const QString& ), mainView, search( const QString& ) ); CONNECT( searchEdit, searchDelayedChanged( const QString& ), mainView, searchDelayed( const QString & ) ); CONNECT( mainView, viewChanged( const QModelIndex& ), this, changeView( const QModelIndex &) ); /* Connect the activation of the selector to a redefining of the PL */ DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), mainView, setRootItem( playlist_item_t *, bool ) ); mainView->setRootItem( p_root, false ); CONNECT( selector, SDCategorySelected(bool), mainView, setWaiting(bool) ); /* */ split = new PlaylistSplitter( this ); /* Add the two sides of the QSplitter */ split->addWidget( leftSplitter ); split->addWidget( mainView ); QList<int> sizeList; sizeList << 180 << 420 ; split->setSizes( sizeList ); split->setStretchFactor( 0, 0 ); split->setStretchFactor( 1, 3 ); split->setCollapsible( 1, false ); leftSplitter->setMaximumWidth( 250 ); /* In case we want to keep the splitter information */ // components shall never write there setting to a fixed location, may infer // with other uses of the same component... getSettings()->beginGroup("Playlist"); split->restoreState( getSettings()->value("splitterSizes").toByteArray()); leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() ); getSettings()->endGroup(); layout->addWidget( split, 1, 0, 1, -1 ); setAcceptDrops( true ); setWindowTitle( qtr( "Playlist" ) ); setWindowRole( "vlc-playlist" ); setWindowIcon( QApplication::windowIcon() ); }
BinarySettingsDialog::BinarySettingsDialog(QWidget* parent, EcProject *ecProject) : QDialog(parent), ecProject_(ecProject) { setWindowModality(Qt::WindowModal); setWindowTitle(tr("Generic Binary File Settings")); WidgetUtils::removeContextHelpButton(this); auto groupTitle = new QLabel; groupTitle->setText(tr("Please provide details of your binary format.")); auto hrLabel = new QLabel; hrLabel->setObjectName(QStringLiteral("hrLabel")); binaryHLinesLabel = new ClickLabel(tr("Number of ASCII header lines :")); binaryHLinesLabel->setToolTip(tr("<b>Number of ASCII header lines:</b> Enter the number of ASCII (readable text) header lines present at the beginning of your binary files. Enter 0 if there is no ASCII header.")); binaryHLinesSpin = new QSpinBox(this); binaryHLinesSpin->setRange(-1, 100); binaryHLinesSpin->setSingleStep(1); binaryHLinesSpin->setSpecialValueText(tr("Not set")); binaryHLinesSpin->setAccelerated(true); binaryHLinesSpin->setToolTip(binaryHLinesLabel->toolTip()); qDebug() << "binaryHLinesSpin 1" << binaryHLinesSpin->focusPolicy(); binaryEolLabel = new ClickLabel(tr("ASCII header end of line :")); binaryEolLabel->setToolTip(tr("<b>ASCII header end of line:</b> If an ASCII header is present in the files, specify the line terminator. Typically, Windows OS uses <i>CR+LF</i> (0x0D+0x0A), Linux OS and Mac OS X use <i>LF</i> (0x0A), while Mac OS up to version 9 and OS-9 use <i>CR</i> (0x0D).")); binaryEolCombo = new QComboBox; binaryEolCombo->addItem(tr("CR+LF")); binaryEolCombo->addItem(tr("CR")); binaryEolCombo->addItem(tr("LF")); binaryEolCombo->setToolTip(binaryEolLabel->toolTip()); binaryNBytesLabel = new ClickLabel(tr("Number of bytes per variable :")); binaryNBytesLabel->setToolTip(tr("<b>Number of bytes per variable:</b> Specify the number of bytes reserved for each variable stored as a single precision number. Typically 2 bytes are reserved for each number.")); binaryNBytesSpin = new QSpinBox(this); binaryNBytesSpin->setRange(0, 8); binaryNBytesSpin->setSingleStep(1); binaryNBytesSpin->setSpecialValueText(tr("Not set")); binaryNBytesSpin->setAccelerated(true); binaryNBytesSpin->setToolTip(binaryNBytesLabel->toolTip()); binaryEndianessLabel = new ClickLabel(tr("Endianess :")); binaryEndianessLabel->setToolTip(tr("<b>Endianess:</b> In a multi-bytes binary word, <i>Little endian</i> means that the most significant byte is the last byte (highest address); <i>Big endian</i> means that the most significant byte is the first byte (lowest address).")); binaryEndianessCombo = new QComboBox; binaryEndianessCombo->addItem(tr("Big endian")); binaryEndianessCombo->addItem(tr("Little endian")); binaryEndianessCombo->setMinimumWidth(10); binaryEndianessCombo->setToolTip(binaryEndianessLabel->toolTip()); auto binPropertiesLayout = new QGridLayout; binPropertiesLayout->addWidget(binaryHLinesLabel, 0, 0, 1, 1, Qt::AlignRight); binPropertiesLayout->addWidget(binaryHLinesSpin, 0, 1); binPropertiesLayout->addWidget(binaryEolLabel, 1, 0, 1, 1, Qt::AlignRight); binPropertiesLayout->addWidget(binaryEolCombo, 1, 1); binPropertiesLayout->addWidget(binaryNBytesLabel, 2, 0, 1, 1, Qt::AlignRight); binPropertiesLayout->addWidget(binaryNBytesSpin, 2, 1); binPropertiesLayout->addWidget(binaryEndianessLabel, 3, 0, 1, 1, Qt::AlignRight); binPropertiesLayout->addWidget(binaryEndianessCombo, 3, 1); binPropertiesLayout->setVerticalSpacing(3); binPropertiesLayout->setContentsMargins(3, 3, 3, 3); auto binPropertiesWidget = new QWidget; binPropertiesWidget->setLayout(binPropertiesLayout); auto okButton = WidgetUtils::createCommonButton(this, tr("Ok")); auto mainLayout = new QGridLayout(this); mainLayout->addWidget(groupTitle, 0, 0); mainLayout->addWidget(hrLabel, 1, 0); mainLayout->addWidget(binPropertiesWidget, 2, 0); mainLayout->addWidget(okButton, 3, 0, 1, 1, Qt::AlignCenter); mainLayout->setVerticalSpacing(10); mainLayout->setContentsMargins(30, 30, 30, 30); mainLayout->setSizeConstraint(QLayout::SetFixedSize); setLayout(mainLayout); connect(binaryHLinesLabel, &ClickLabel::clicked, this, &BinarySettingsDialog::onBinaryHLinesLabelClicked); connect(binaryHLinesSpin, SIGNAL(valueChanged(int)), this, SLOT(updateBinaryHLine(int))); connect(binaryEolLabel, &ClickLabel::clicked, this, &BinarySettingsDialog::onBinaryClickEolLabel); connect(binaryEolCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateBinaryEol(int))); connect(binaryNBytesLabel, &ClickLabel::clicked, this, &BinarySettingsDialog::onBinaryNBytesLabelClicked); connect(binaryNBytesSpin, SIGNAL(valueChanged(int)), this, SLOT(updateBinaryNBytes(int))); connect(binaryEndianessLabel, &ClickLabel::clicked, this, &BinarySettingsDialog::onBinaryClickEndianessLabel); connect(binaryEndianessCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateBinaryEndianess(int))); connect(okButton, &QPushButton::clicked, this, &BinarySettingsDialog::close); }
FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) : m_hSpace(hSpacing), m_vSpace(vSpacing) { setContentsMargins(margin, margin, margin, margin); }
PeriodogramDisplay::PeriodogramDisplay(void): _mainPlot(new PothosPlotter(this, POTHOS_PLOTTER_GRID | POTHOS_PLOTTER_ZOOM)), _sampleRate(1.0), _sampleRateWoAxisUnits(1.0), _centerFreq(0.0), _centerFreqWoAxisUnits(0.0), _numBins(1024), _refLevel(0.0), _dynRange(100.0), _autoScale(false), _freqLabelId("rxFreq"), _rateLabelId("rxRate"), _averageFactor(0.0), _fullScale(1.0), _fftModeComplex(true), _fftModeAutomatic(true) { //setup block this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, widget)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setTitle)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setSampleRate)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setCenterFrequency)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setNumFFTBins)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setWindowType)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setFullScale)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setFFTMode)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setReferenceLevel)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setDynamicRange)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setAutoScale)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, title)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, sampleRate)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, centerFrequency)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, numFFTBins)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, referenceLevel)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, dynamicRange)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, autoScale)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setAverageFactor)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, enableXAxis)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, enableYAxis)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setYAxisTitle)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setFreqLabelId)); this->registerCall(this, POTHOS_FCN_TUPLE(PeriodogramDisplay, setRateLabelId)); this->registerSignal("frequencySelected"); this->setupInput(0); //layout auto layout = new QHBoxLayout(this); layout->setSpacing(0); layout->setContentsMargins(QMargins()); layout->addWidget(_mainPlot); //setup plotter { connect(_mainPlot->zoomer(), SIGNAL(selected(const QPointF &)), this, SLOT(handlePickerSelected(const QPointF &))); connect(_mainPlot->zoomer(), SIGNAL(zoomed(const QRectF &)), this, SLOT(handleZoomed(const QRectF &))); auto legend = new QwtLegend(_mainPlot); legend->setDefaultItemMode(QwtLegendData::Checkable); connect(legend, SIGNAL(checked(const QVariant &, bool, int)), this, SLOT(handleLegendChecked(const QVariant &, bool, int))); _mainPlot->insertLegend(legend); } }
TransactionView::TransactionView(QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0) { // Build filter row setContentsMargins(0,0,0,0); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0,0,0,0); #ifdef Q_OS_MAC hlayout->setSpacing(5); hlayout->addSpacing(26); #else hlayout->setSpacing(0); hlayout->addSpacing(23); #endif dateWidget = new QComboBox(this); #ifdef Q_OS_MAC dateWidget->setFixedWidth(121); #else dateWidget->setFixedWidth(120); #endif dateWidget->addItem(tr("All"), All); dateWidget->addItem(tr("Today"), Today); dateWidget->addItem(tr("This week"), ThisWeek); dateWidget->addItem(tr("This month"), ThisMonth); dateWidget->addItem(tr("Last month"), LastMonth); dateWidget->addItem(tr("This year"), ThisYear); dateWidget->addItem(tr("Range..."), Range); hlayout->addWidget(dateWidget); typeWidget = new QComboBox(this); #ifdef Q_OS_MAC typeWidget->setFixedWidth(121); #else typeWidget->setFixedWidth(120); #endif typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES); typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) | TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther)); typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) | TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); hlayout->addWidget(typeWidget); addressWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ addressWidget->setPlaceholderText(tr("Enter address or label to search")); #endif hlayout->addWidget(addressWidget); amountWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ amountWidget->setPlaceholderText(tr("Min amount")); #endif #ifdef Q_OS_MAC amountWidget->setFixedWidth(97); #else amountWidget->setFixedWidth(100); #endif amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); hlayout->addWidget(amountWidget); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(0,0,0,0); vlayout->setSpacing(0); QTableView *view = new QTableView(this); vlayout->addLayout(hlayout); vlayout->addWidget(createDateRangeWidget()); vlayout->addWidget(view); vlayout->setSpacing(0); int width = view->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing #ifdef Q_OS_MAC hlayout->addSpacing(width+2); #else hlayout->addSpacing(width); #endif // Always show scroll bar view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setTabKeyNavigation(false); view->setContextMenuPolicy(Qt::CustomContextMenu); transactionView = view; // Actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this); QAction *editLabelAction = new QAction(tr("Edit label"), this); QAction *showDetailsAction = new QAction(tr("Show transaction details"), this); contextMenu = new QMenu(); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyAmountAction); contextMenu->addAction(copyTxIDAction); contextMenu->addAction(editLabelAction); contextMenu->addAction(showDetailsAction); // Connect actions connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); }
PopupView::PopupView(const QModelIndex &index, const QPoint &pos, const bool &showPreview, const QStringList &previewPlugins, const IconView *parentView) : QWidget(0, Qt::X11BypassWindowManagerHint), m_view(0), m_parentView(parentView), m_busyWidget(0), m_iconView(0), m_parentViewModel(0), m_dirModel(0), m_model(0), m_actionCollection(this), m_newMenu(0), m_itemActions(0), m_showingMenu(false), m_showPreview(showPreview), m_delayedClose(false), m_previewPlugins(previewPlugins) { setAttribute(Qt::WA_TranslucentBackground); #ifdef Q_WS_X11 if (KWindowSystem::compositingActive()) { setAttribute(Qt::WA_NoSystemBackground, false); } #endif #ifdef Q_WS_WIN setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); #endif KWindowSystem::setState(effectiveWinId(), NET::SkipTaskbar | NET::SkipPager); setAcceptDrops(true); QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::transparent); pal.setColor(QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); setPalette(pal); m_parentViewModel = static_cast<const ProxyModel*>(index.model()); KFileItem item = m_parentViewModel->itemForIndex(index); if (item.isDesktopFile()) { KDesktopFile file(item.localPath()); m_url = file.readUrl(); } else { m_url = item.targetUrl(); } m_background = new Plasma::FrameSvg(this); m_background->setImagePath("dialogs/background"); int left = m_background->marginSize(Plasma::LeftMargin); int top = m_background->marginSize(Plasma::TopMargin); int right = m_background->marginSize(Plasma::RightMargin); int bottom = m_background->marginSize(Plasma::BottomMargin); setContentsMargins(left, top, right, bottom); resize(parentView->sizeForRowsColumns(2, 3) + QSize(left + right, top + bottom)); const QRect available = QApplication::desktop()->availableGeometry(pos); QPoint pt = pos; if (pt.x() + width() > available.right()) { pt.rx() -= width(); } if (pt.x() < available.left()) { pt.rx() = available.left(); } if (pt.y() + height() > available.bottom()) { pt.ry() -= height(); } if (pt.y() < available.top()) { pt.ry() = available.top(); } Plasma::WindowEffects::overrideShadow(winId(), true); move(pt); show(); QTimer::singleShot(10, this, SLOT(init())); s_lastOpenClose.restart(); }