lb303SynthView::lb303SynthView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { // GUI m_vcfCutKnob = new knob( knobBright_26, this ); m_vcfCutKnob->move( 75, 130 ); m_vcfCutKnob->setHintText( tr( "Cutoff Freq:" ) + " ", "" ); m_vcfCutKnob->setLabel( tr("CUT") ); m_vcfResKnob = new knob( knobBright_26, this ); m_vcfResKnob->move( 120, 130 ); m_vcfResKnob->setHintText( tr( "Resonance:" ) + " ", "" ); m_vcfResKnob->setLabel( tr("RES") ); m_vcfModKnob = new knob( knobBright_26, this ); m_vcfModKnob->move( 165, 130 ); m_vcfModKnob->setHintText( tr( "Env Mod:" ) + " ", "" ); m_vcfModKnob->setLabel( tr("ENV MOD") ); m_vcfDecKnob = new knob( knobBright_26, this ); m_vcfDecKnob->move( 210, 130 ); m_vcfDecKnob->setHintText( tr( "Decay:" ) + " ", "" ); m_vcfDecKnob->setLabel( tr("DEC") ); m_slideToggle = new ledCheckBox( "Slide", this ); m_slideToggle->move( 10, 180 ); m_accentToggle = new ledCheckBox( "Accent", this ); m_accentToggle->move( 10, 200 ); m_accentToggle->setDisabled(true); m_deadToggle = new ledCheckBox( "Dead", this ); m_deadToggle->move( 10, 220 ); m_db24Toggle = new ledCheckBox( "24dB/oct", this ); m_db24Toggle->setWhatsThis( tr( "303-es-que, 24dB/octave, 3 pole filter" ) ); m_db24Toggle->move( 10, 150); m_slideDecKnob = new knob( knobBright_26, this ); m_slideDecKnob->move( 210, 75 ); m_slideDecKnob->setHintText( tr( "Slide Decay:" ) + " ", "" ); m_slideDecKnob->setLabel( tr( "SLIDE")); m_distKnob = new knob( knobBright_26, this ); m_distKnob->move( 210, 190 ); m_distKnob->setHintText( tr( "DIST:" ) + " ", "" ); m_distKnob->setLabel( tr( "DIST")); m_waveKnob = new knob( knobBright_26, this ); m_waveKnob->move( 120, 75 ); m_waveKnob->setHintText( tr( "WAVE:" ) + " ", "" ); m_waveKnob->setLabel( tr( "WAVE")); setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); }
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) : QSplashScreen(pixmap, f) { setAutoFillBackground(true); // set reference point, paddings int paddingRight = 50; int paddingTop = 50; int titleVersionVSpace = 17; int titleCopyrightVSpace = 40; float fontFactor = 1.0; // define text to place QString titleText = tr("Dogecoin Core"); QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion())); QString copyrightText = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers\n")) + QChar(0xA9)+QString(" 2013-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Dogecoin Core developers")); QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object QString font = "Comic Sans MS"; // load the bitmap for writing some text over it QPixmap newPixmap; if(isTestNet) { newPixmap = QPixmap(":/images/splash_testnet"); } else { newPixmap = QPixmap(":/images/splash"); } QPainter pixPaint(&newPixmap); pixPaint.setPen(QColor(100,100,100)); // check font size and drawing with pixPaint.setFont(QFont(font, 33*fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); int titleTextWidth = fm.width(titleText); if(titleTextWidth > 160) { // strange font rendering, Arial probably not found fontFactor = 0.75; } pixPaint.setFont(QFont(font, 33*fontFactor)); fm = pixPaint.fontMetrics(); titleTextWidth = fm.width(titleText); pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop,titleText); pixPaint.setFont(QFont(font, 15*fontFactor)); // if the version string is to long, reduce size fm = pixPaint.fontMetrics(); int versionTextWidth = fm.width(versionText); if(versionTextWidth > titleTextWidth+paddingRight-10) { pixPaint.setFont(QFont(font, 10*fontFactor)); titleVersionVSpace -= 5; } pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText); // draw copyright stuff pixPaint.setFont(QFont(font, 10*fontFactor)); QRect copyrightRect = QRect(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,fm.width(copyrightText),fm.height()*2); pixPaint.drawText(copyrightRect,Qt::TextWordWrap,copyrightText); // draw testnet string if testnet is on if(isTestNet) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); int testnetAddTextWidth = fm.width(testnetAddText); pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,15,testnetAddText); } pixPaint.end(); this->setPixmap(newPixmap); subscribeToCoreSignals(); }
Drawable::Drawable(DirectDrawWriter &writer) : isOK(false), isOverlay(false), paused(false), writer(writer), flip(0), DDraw(NULL), DDClipper(NULL), DDSPrimary(NULL), DDSSecondary(NULL), DDSBackBuffer(NULL), DDrawColorCtrl(NULL), DwmEnableComposition(NULL) { setMouseTracking(true); grabGesture(Qt::PinchGesture); if (DirectDrawCreate(NULL, &DDraw, NULL) == DD_OK && DDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL) == DD_OK) { DDSURFACEDESC ddsd_primary = { sizeof ddsd_primary }; ddsd_primary.dwFlags = DDSD_CAPS; ddsd_primary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; if (DDraw->CreateSurface(&ddsd_primary, &DDSPrimary, NULL) == DD_OK) { LPDIRECTDRAWSURFACE DDrawTestSurface; DDSURFACEDESC ddsd_test = { sizeof ddsd_test }; ddsd_test.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; ddsd_test.dwWidth = 8; ddsd_test.dwHeight = 2; ddsd_test.ddpfPixelFormat.dwSize = sizeof ddsd_test.ddpfPixelFormat; ddsd_test.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd_test.ddpfPixelFormat.dwFourCC = MAKEFOURCC('Y', 'V', '1', '2'); /* Overlay YV12 test */ if (QSysInfo::windowsVersion() < QSysInfo::WV_6_2) //Windows 8 and 10 can't disable DWM, so overlay won't work { DDCAPS ddCaps = { sizeof ddCaps }; DDraw->GetCaps(&ddCaps, NULL); if (ddCaps.dwCaps & (DDCAPS_OVERLAY | DDCAPS_OVERLAYFOURCC | DDCAPS_OVERLAYSTRETCH)) { ddsd_test.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; if (DDraw->CreateSurface(&ddsd_test, &DDrawTestSurface, NULL) == DD_OK) { RECT destRect = { 0, 0, 1, 1 }; HRESULT res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL); if (res == DDERR_OUTOFCAPS && QSysInfo::windowsVersion() >= QSysInfo::WV_6_0) { /* Disable DWM to use overlay */ DwmEnableComposition = (DwmEnableCompositionProc)GetProcAddress(GetModuleHandleA("dwmapi.dll"), "DwmEnableComposition"); if (DwmEnableComposition) { if (DwmEnableComposition(DWM_EC_DISABLECOMPOSITION) == S_OK) res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL); else DwmEnableComposition = NULL; } } if (res == DD_OK) { DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, NULL, DDOVER_HIDE, NULL); setAutoFillBackground(true); setPalette(QColor(ColorKEY)); connect(&QMPlay2Core, SIGNAL(videoDockMoved()), this, SLOT(updateOverlay())); connect(&QMPlay2Core, SIGNAL(videoDockVisible(bool)), this, SLOT(overlayVisible(bool))); connect(&QMPlay2Core, SIGNAL(mainWidgetNotMinimized(bool)), this, SLOT(overlayVisible(bool))); connect(&visibleTim, SIGNAL(timeout()), this, SLOT(doOverlayVisible())); visibleTim.setSingleShot(true); isOK = isOverlay = true; }
bitInvaderView::bitInvaderView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); m_sampleLengthKnob = new Knob( knobDark_28, this ); m_sampleLengthKnob->move( 6, 201 ); m_sampleLengthKnob->setHintText( tr( "Sample Length" ), "" ); m_graph = new Graph( this, Graph::NearestStyle, 204, 134 ); m_graph->move(23,59); // 55,120 - 2px border m_graph->setAutoFillBackground( true ); m_graph->setGraphColor( QColor( 255, 255, 255 ) ); ToolTip::add( m_graph, tr ( "Draw your own waveform here " "by dragging your mouse on this graph." )); pal = QPalette(); pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap("wavegraph") ); m_graph->setPalette( pal ); m_sinWaveBtn = new PixmapButton( this, tr( "Sine wave" ) ); m_sinWaveBtn->move( 131, 205 ); m_sinWaveBtn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); m_sinWaveBtn->setInactiveGraphic( embed::getIconPixmap( "sin_wave_inactive" ) ); ToolTip::add( m_sinWaveBtn, tr( "Click for a sine-wave." ) ); m_triangleWaveBtn = new PixmapButton( this, tr( "Triangle wave" ) ); m_triangleWaveBtn->move( 131 + 14, 205 ); m_triangleWaveBtn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); m_triangleWaveBtn->setInactiveGraphic( embed::getIconPixmap( "triangle_wave_inactive" ) ); ToolTip::add( m_triangleWaveBtn, tr( "Click here for a triangle-wave." ) ); m_sawWaveBtn = new PixmapButton( this, tr( "Saw wave" ) ); m_sawWaveBtn->move( 131 + 14*2, 205 ); m_sawWaveBtn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); m_sawWaveBtn->setInactiveGraphic( embed::getIconPixmap( "saw_wave_inactive" ) ); ToolTip::add( m_sawWaveBtn, tr( "Click here for a saw-wave." ) ); m_sqrWaveBtn = new PixmapButton( this, tr( "Square wave" ) ); m_sqrWaveBtn->move( 131 + 14*3, 205 ); m_sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); m_sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "square_wave_inactive" ) ); ToolTip::add( m_sqrWaveBtn, tr( "Click here for a square-wave." ) ); m_whiteNoiseWaveBtn = new PixmapButton( this, tr( "White noise wave" ) ); m_whiteNoiseWaveBtn->move( 131 + 14*4, 205 ); m_whiteNoiseWaveBtn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); m_whiteNoiseWaveBtn->setInactiveGraphic( embed::getIconPixmap( "white_noise_wave_inactive" ) ); ToolTip::add( m_whiteNoiseWaveBtn, tr( "Click here for white-noise." ) ); m_usrWaveBtn = new PixmapButton( this, tr( "User defined wave" ) ); m_usrWaveBtn->move( 131 + 14*5, 205 ); m_usrWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); m_usrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "usr_wave_inactive" ) ); ToolTip::add( m_usrWaveBtn, tr( "Click here for a user-defined shape." ) ); m_smoothBtn = new PixmapButton( this, tr( "Smooth" ) ); m_smoothBtn->move( 131 + 14*6, 205 ); m_smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) ); m_smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_inactive" ) ); ToolTip::add( m_smoothBtn, tr( "Click here to smooth waveform." ) ); m_interpolationToggle = new LedCheckBox( "Interpolation", this, tr( "Interpolation" ), LedCheckBox::Yellow ); m_interpolationToggle->move( 131, 221 ); m_normalizeToggle = new LedCheckBox( "Normalize", this, tr( "Normalize" ), LedCheckBox::Green ); m_normalizeToggle->move( 131, 236 ); connect( m_sinWaveBtn, SIGNAL (clicked () ), this, SLOT ( sinWaveClicked() ) ); connect( m_triangleWaveBtn, SIGNAL ( clicked () ), this, SLOT ( triangleWaveClicked() ) ); connect( m_sawWaveBtn, SIGNAL (clicked () ), this, SLOT ( sawWaveClicked() ) ); connect( m_sqrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( sqrWaveClicked() ) ); connect( m_whiteNoiseWaveBtn, SIGNAL ( clicked () ), this, SLOT ( noiseWaveClicked() ) ); connect( m_usrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( usrWaveClicked() ) ); connect( m_smoothBtn, SIGNAL ( clicked () ), this, SLOT ( smoothClicked() ) ); connect( m_interpolationToggle, SIGNAL( toggled( bool ) ), this, SLOT ( interpolationToggled( bool ) ) ); connect( m_normalizeToggle, SIGNAL( toggled( bool ) ), this, SLOT ( normalizeToggled( bool ) ) ); }
RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* parent) : AnimatedWidget(AnimatedWidget::Down, 300, parent) , ui(new Ui::RSSNotification) , m_title(title) , m_url(url) , m_view(parent) { setAutoFillBackground(true); setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); ui->closeButton->setIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton)); ui->label->setText(tr("RSS feed <b>\"%1\"</b>").arg(title)); RssApp bloglines; bloglines.type = WebApplication; bloglines.title = "Bloglines"; bloglines.icon = QIcon(":/icons/sites/bloglines.png"); bloglines.address = "http://www.bloglines.com/sub?url="; RssApp greader; greader.type = WebApplication; greader.title = "Google Reader"; greader.icon = QIcon(":/icons/sites/google.png"); greader.address = "http://www.google.com/ig/add?feedurl="; RssApp myaol; myaol.type = WebApplication; myaol.title = "My AOL"; myaol.icon = QIcon(":/icons/sites/aol.png"); myaol.address = "http://feeds.my.aol.com/add.jsp?url="; RssApp netvibes; netvibes.type = WebApplication; netvibes.title = "Netvibes"; netvibes.icon = QIcon(":/icons/sites/netvibes.png"); netvibes.address = "http://www.netvibes.com/subscribe.php?url="; RssApp yahoo; yahoo.type = WebApplication; yahoo.title = "Yahoo!"; yahoo.icon = QIcon(":/icons/sites/yahoo.png"); yahoo.address = "http://add.my.yahoo.com/rss?url="; m_rssApps << bloglines << greader << myaol << netvibes << yahoo; #ifdef QZ_WS_X11 const QString &akregatorBin = QzTools::resolveFromPath("akregator"); const QString &lifereaBin = QzTools::resolveFromPath("liferea"); const QString &lifereaAddFeedBin = QzTools::resolveFromPath("liferea-add-feed"); if (!akregatorBin.isEmpty()) { RssApp akregator; akregator.type = DesktopApplication; akregator.title = "Akregator"; akregator.icon = QIcon(":/icons/sites/akregator.png"); akregator.executable = akregatorBin; akregator.arguments = "-a"; m_rssApps << akregator; } if (!lifereaBin.isEmpty() && !lifereaAddFeedBin.isEmpty()) { RssApp liferea; liferea.type = DesktopApplication; liferea.title = "Liferea"; liferea.icon = QIcon(":/icons/sites/liferea.png"); liferea.executable = lifereaAddFeedBin; m_rssApps << liferea; } #endif foreach(const RssApp & app, m_rssApps) { ui->comboBox->addItem(app.icon, app.title, QVariant(app.type)); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- tNASBar::tNASBar( tFusionClientAgent& fusionClientAgent, quint8 sourceId, QWidget* pParent ) : tPanel( pParent ) , m_pSourceIcon( 0 ) , m_pSourceName( 0 ) , m_pStatusIcon( 0 ) , m_pTicker( 0 ) , m_pNotice( 0 ) , m_pTimeRemaining( 0 ) , m_pRepeatIcon( 0 ) , m_pShuffleIcon( 0 ) , m_pVolumeWidget( 0 ) , m_pVolumeAction( 0 ) , m_pMuteAction( 0 ) , m_pPowerAction( 0 ) , m_pSelectAudioServerAction( 0 ) , m_pAudioSourceAction( 0 ) , m_pVirtualHeadAction( 0 ) , m_pZoneSetupAction( 0 ) , m_pOptionsAction( 0 ) , m_pVideoOptionsAction( 0 ) , m_pBluetoothDevicesAction( 0 ) , m_pMixerActions( 0 ) , m_pSettingsMenuAction( 0 ) , m_pOpenDialog( 0 ) , m_pPopupWidget( 0 ) , m_MySourceId( sourceId ) , m_MyZoneId( 0 ) // TODO A: Make this a zone ID , m_pDummyAction( 0 ) , m_FlashTimerID( -1 ) , m_FlashTime( false ) , m_FlashOn( false ) , m_ButtonPressed( false ) , m_PressedPosition( eCP_None ) , m_FusionClientAgent( fusionClientAgent ) { // Should not access the NAS from this constructor TRACE_FUNCTION; setObjectName( QString( "NasBar%1" ).arg( sourceId ) ); m_ShowSettingsMenu = false; setFocusPolicy( Qt::StrongFocus ); setAutoFillBackground( true ); // Setup colours please. Connect( tSystemSettings::Instance(), SIGNAL( NightModeChanged(bool, bool) ), this, SLOT( UpdateColors() )); Connect( tUiSettings::Instance(), SIGNAL( NightModeTextColorChanged(eNightModeTextColor) ), this, SLOT( UpdateColors() )); tNASBar::UpdateColors(); setHeight( AudioBarHeight( this ) ); // Clear the dialog/menu pointers m_pMenu = 0; m_pVolumeAction = 0; m_pMuteAction = 0; m_pAudioSourceAction = 0; // Audio sources to choose from m_pVirtualHeadAction = 0; m_pZoneSetupAction = 0; m_pDummyAction = 0; m_pPowerAction = 0; // use a transparent placeholder for all icons to maintain the size and location of all widgets in the layout QPixmap trans28( tPath::ResourceFile( "audio/trans28.png" ) ); m_pSourceIcon = new QLabel(); m_pSourceIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pSourceIcon->setPixmap( trans28 ); m_pSourceIcon->resize( sizeHint() ); m_pSourceName = new QLabel(); m_pSourceName->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pVertSep1 = new QFrame(); m_pVertSep1->setFrameShape( QFrame::VLine ); m_pVertSep1->setMaximumHeight( 24 ); m_pStatusIcon = new QLabel(); m_pStatusIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pStatusIcon->hide(); // only widget i want hidden since the ticker will grow into its unused space. m_pTimeRemaining = new QLabel(); m_pTimeRemaining->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pTimeRemaining->hide(); m_pVertSep2 = new QFrame(); m_pVertSep2->setFrameShape( QFrame::VLine ); m_pVertSep2->setMaximumHeight( 24 ); m_pRepeatIcon = new QLabel(); m_pRepeatIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pRepeatIcon->setPixmap( trans28 ); m_pRepeatIcon->resize( sizeHint() ); m_pShuffleIcon = new QLabel(); m_pShuffleIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_pShuffleIcon->setPixmap( trans28 ); m_pShuffleIcon->resize( sizeHint() ); m_pVolumeWidget = new tVolumeWidget( true, m_FusionClientAgent.IsMuted(), this ); m_pVolumeWidget->SetRange( m_FusionClientAgent.MinVolumeLevel(), m_FusionClientAgent.MaxVolumeLevel() ); m_pVolumeWidget->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); m_pVolumeWidget->resize( 60, ( AudioBarHeight( this ) / 3 ) ); m_pTicker = new tTicker( this ); m_pNotice = new tNoticeManager( this ); m_pNotice->hide(); Connect( m_pNotice, SIGNAL( ShowMe() ), this, SLOT( NoticeOnTop() ) ); Connect( m_pNotice, SIGNAL( AllClear() ), this, SLOT( NoticeAllClear() ) ); QGridLayout* pLayout = new QGridLayout(); pLayout->setContentsMargins( 4, 0, 4, 0 ); pLayout->setSpacing( 6 ); setLayout( pLayout ); m_pLayout = pLayout; pLayout->addWidget( m_pSourceIcon, 0, 0 ); pLayout->addWidget( m_pSourceName, 0, 1 ); pLayout->addWidget( m_pVertSep1, 0, 2 ); pLayout->addWidget( m_pStatusIcon, 0, 3 ); pLayout->addWidget( m_pTicker, 0, 4 ); pLayout->addWidget( m_pNotice, 0, 4 ); m_TimeRemainingColumn = 5; pLayout->addWidget( m_pTimeRemaining, 0, m_TimeRemainingColumn ); pLayout->addWidget( m_pVertSep2, 0, 6 ); pLayout->addWidget( m_pRepeatIcon, 0, 7 ); pLayout->addWidget( m_pShuffleIcon, 0, 8 ); pLayout->addWidget( m_pVolumeWidget, 0, 9 ); m_MySourceString = m_FusionClientAgent.GetSourceName( m_MySourceId ); }
LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ) : ControllerDialog( _model, _parent ) { QString title = tr( "LFO" ); title.append( " (" ); title.append( _model->name() ); title.append( ")" ); setWindowTitle( title ); setWindowIcon( embed::getIconPixmap( "controller" ) ); setFixedSize( 240, 80 ); ToolTip::add( this, tr( "LFO Controller" ) ); m_baseKnob = new Knob( knobBright_26, this ); m_baseKnob->setLabel( tr( "BASE" ) ); m_baseKnob->move( CD_LFO_BASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y ); m_baseKnob->setHintText( tr( "Base amount:" ), "" ); m_baseKnob->setWhatsThis( tr("todo") ); m_speedKnob = new TempoSyncKnob( knobBright_26, this ); m_speedKnob->setLabel( tr( "SPD" ) ); m_speedKnob->move( CD_LFO_SPEED_CD_KNOB_X, CD_LFO_CD_KNOB_Y ); m_speedKnob->setHintText( tr( "LFO-speed:" ), "" ); m_speedKnob->setWhatsThis( tr( "Use this knob for setting speed of the LFO. The " "bigger this value the faster the LFO oscillates and " "the faster the effect." ) ); m_amountKnob = new Knob( knobBright_26, this ); m_amountKnob->setLabel( tr( "AMT" ) ); m_amountKnob->move( CD_LFO_AMOUNT_CD_KNOB_X, CD_LFO_CD_KNOB_Y ); m_amountKnob->setHintText( tr( "Modulation amount:" ), "" ); m_amountKnob->setWhatsThis( tr( "Use this knob for setting modulation amount of the " "LFO. The bigger this value, the more the connected " "control (e.g. volume or cutoff-frequency) will " "be influenced by the LFO." ) ); m_phaseKnob = new Knob( knobBright_26, this ); m_phaseKnob->setLabel( tr( "PHS" ) ); m_phaseKnob->move( CD_LFO_PHASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y ); m_phaseKnob->setHintText( tr( "Phase offset:" ) , "" + tr( "degrees" ) ); m_phaseKnob->setWhatsThis( tr( "With this knob you can set the phase offset of " "the LFO. That means you can move the " "point within an oscillation where the " "oscillator begins to oscillate. For example " "if you have a sine-wave and have a phase-" "offset of 180 degrees the wave will first go " "down. It's the same with a square-wave." ) ); PixmapButton * sin_wave_btn = new PixmapButton( this, NULL ); sin_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y ); sin_wave_btn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); sin_wave_btn->setInactiveGraphic( embed::getIconPixmap( "sin_wave_inactive" ) ); ToolTip::add( sin_wave_btn, tr( "Click here for a sine-wave." ) ); PixmapButton * triangle_wave_btn = new PixmapButton( this, NULL ); triangle_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y ); triangle_wave_btn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); triangle_wave_btn->setInactiveGraphic( embed::getIconPixmap( "triangle_wave_inactive" ) ); ToolTip::add( triangle_wave_btn, tr( "Click here for a triangle-wave." ) ); PixmapButton * saw_wave_btn = new PixmapButton( this, NULL ); saw_wave_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y ); saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); saw_wave_btn->setInactiveGraphic( embed::getIconPixmap( "saw_wave_inactive" ) ); ToolTip::add( saw_wave_btn, tr( "Click here for a saw-wave." ) ); PixmapButton * sqr_wave_btn = new PixmapButton( this, NULL ); sqr_wave_btn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y ); sqr_wave_btn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); sqr_wave_btn->setInactiveGraphic( embed::getIconPixmap( "square_wave_inactive" ) ); ToolTip::add( sqr_wave_btn, tr( "Click here for a square-wave." ) ); PixmapButton * moog_saw_wave_btn = new PixmapButton( this, NULL ); moog_saw_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y + 15 ); moog_saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "moog_saw_wave_active" ) ); moog_saw_wave_btn->setInactiveGraphic( embed::getIconPixmap( "moog_saw_wave_inactive" ) ); ToolTip::add( moog_saw_wave_btn, tr( "Click here for a moog saw-wave." ) ); PixmapButton * exp_wave_btn = new PixmapButton( this, NULL ); exp_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y + 15 ); exp_wave_btn->setActiveGraphic( embed::getIconPixmap( "exp_wave_active" ) ); exp_wave_btn->setInactiveGraphic( embed::getIconPixmap( "exp_wave_inactive" ) ); ToolTip::add( exp_wave_btn, tr( "Click here for an exponential wave." ) ); PixmapButton * white_noise_btn = new PixmapButton( this, NULL ); white_noise_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y + 15 ); white_noise_btn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); white_noise_btn->setInactiveGraphic( embed::getIconPixmap( "white_noise_wave_inactive" ) ); ToolTip::add( white_noise_btn, tr( "Click here for white-noise." ) ); m_userWaveBtn = new PixmapButton( this, NULL ); m_userWaveBtn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 ); m_userWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); m_userWaveBtn->setInactiveGraphic( embed::getIconPixmap( "usr_wave_inactive" ) ); connect( m_userWaveBtn, SIGNAL( doubleClicked() ), this, SLOT( askUserDefWave() ) ); ToolTip::add( m_userWaveBtn, tr( "Click here for a user-defined shape.\nDouble click to pick a file." ) ); m_waveBtnGrp = new automatableButtonGroup( this ); m_waveBtnGrp->addButton( sin_wave_btn ); m_waveBtnGrp->addButton( triangle_wave_btn ); m_waveBtnGrp->addButton( saw_wave_btn ); m_waveBtnGrp->addButton( sqr_wave_btn ); m_waveBtnGrp->addButton( moog_saw_wave_btn ); m_waveBtnGrp->addButton( exp_wave_btn ); m_waveBtnGrp->addButton( white_noise_btn ); m_waveBtnGrp->addButton( m_userWaveBtn ); PixmapButton * x1 = new PixmapButton( this, NULL ); x1->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y ); x1->setActiveGraphic( embed::getIconPixmap( "lfo_x1_active" ) ); x1->setInactiveGraphic( embed::getIconPixmap( "lfo_x1_inactive" ) ); PixmapButton * x100 = new PixmapButton( this, NULL ); x100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y - 15 ); x100->setActiveGraphic( embed::getIconPixmap( "lfo_x100_active" ) ); x100->setInactiveGraphic( embed::getIconPixmap( "lfo_x100_inactive" ) ); PixmapButton * d100 = new PixmapButton( this, NULL ); d100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 15 ); d100->setActiveGraphic( embed::getIconPixmap( "lfo_d100_active" ) ); d100->setInactiveGraphic( embed::getIconPixmap( "lfo_d100_inactive" ) ); m_multiplierBtnGrp = new automatableButtonGroup( this ); m_multiplierBtnGrp->addButton( x1 ); m_multiplierBtnGrp->addButton( x100 ); m_multiplierBtnGrp->addButton( d100 ); setModel( _model ); setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), embed::getIconPixmap( "lfo_controller_artwork" ) ); setPalette( pal ); }
SceneMaterialItem::SceneMaterialItem(ButelLive *parent,QString name,int type,int Index): QWidget(parent) { m_pParent= parent; m_LabelName.setText(name); if(type == Dianbo) m_LabelType.setText(tr("VOD source")); else if(type == Shexiang) m_LabelType.setText(tr("Video capture source")); else if(type == Hudong) m_LabelType.setText(tr("Interactive link source")); else if(type == Tupian) m_LabelType.setText(tr("Picture source")); else if(type == Datetime) m_LabelType.setText(tr("Datetime source")); else if(type == AudioCapture) m_LabelType.setText(tr("Audio capture source")); else if(type == Text) m_LabelType.setText(tr("Text source")); else if(type == AgentSource) m_LabelType.setText(tr("Agent source")); else if(type == Live) m_LabelType.setText(tr("Live source")); else if(type == MonitorCapture) m_LabelType.setText(tr("MonitorCapture source")); else if(type == WindowCapture) m_LabelType.setText(tr("WindowCapture source")); else if(type == ProcTopWindow) m_LabelType.setText(tr("ProcTopWindow source")); m_Index = Index; m_CheckBox.setChecked(true); m_LabelName.setStyleSheet("QLabel{color:rgba(255,255,255,255);font: 10pt;}"); m_LabelType.setStyleSheet("QLabel{color:rgba(255,255,255,255);font: 10pt;}"); setFixedHeight(50); m_LabelName.setFixedWidth(140); m_LabelType.setFixedWidth(110); m_BtnOperator.setFixedSize(30,30); m_BtnOperator.setText(""); m_BtnOperator.setStyleSheet("QPushButton{border-image:url(:images/scene_edit.png);}" "QPushButton:hover{border-image:url(:images/scene_edit_hover.png);}" "QPushButton:pressed{border-image:url(:images/scene_edit_selected.png);}"); QHBoxLayout *hBoxLayout = new QHBoxLayout(this); hBoxLayout->addWidget(&m_CheckBox); hBoxLayout->addWidget(&m_LabelName); hBoxLayout->addWidget(&m_LabelType); hBoxLayout->addWidget(&m_BtnOperator); setLayout(hBoxLayout); QObject::connect(&m_CheckBox,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxClicked(int))); QObject::connect(&m_BtnOperator,SIGNAL(clicked()),this,SLOT(OnEditClicked())); QObject::connect(this,SIGNAL(EditClicked()),parent,SLOT(OnSceneMaterialEditClicked())); setAutoFillBackground(true); QPalette palette; palette.setColor(QPalette::Base, QColor(35,35,37)); setPalette(palette); m_CheckBox.setStyleSheet("QCheckBox{color:rgba(255,255,255,255);background-color:rgba(35,35,37,255);font: 10pt;}"); m_LabelName.setStyleSheet("QLabel{color:rgba(255,255,255,255);background-color:rgba(35,35,37,255);font: 10pt;}"); m_LabelType.setStyleSheet("QLabel{color:rgba(255,255,255,255);background-color:rgba(35,35,37,255);font: 10pt;}"); m_BtnOperator.setStyleSheet("QPushButton{background-color:rgba(35,35,37,255);}" "QPushButton{border-image:url(:images/scene_edit.png);}" "QPushButton:hover{border-image:url(:images/scene_edit_hover.png);}" "QPushButton:pressed{border-image:url(:images/scene_edit_selected.png);}"); }
void MainView::construct() { m_scene = new QGraphicsScene; #ifndef QT_NO_OPENGL if (m_enableOpenGL) { qDebug() << "OpenGL enabled"; setViewport(new QGLWidget); // Qt doc says: This is the preferred update mode for // viewports that do not support partial updates, such as QGLWidget... setViewportUpdateMode(QGraphicsView::FullViewportUpdate); } else #endif setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); setScene(m_scene); m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); //setCacheMode(QGraphicsView::CacheBackground); setAlignment(Qt::AlignLeft | Qt::AlignTop); // Turn off automatic background setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoBackground); setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(false); //Background m_backGround = new BackgroundItem("background.svg"); m_scene->addItem(m_backGround); m_backGround->setZValue(0); //Menu m_menu = new Menu(this); m_scene->addItem(m_menu); //Add menu to the scene directly m_menu->setZValue(10); //Bring to front m_mainLayout = new QGraphicsLinearLayout(Qt::Vertical); m_mainLayout->setContentsMargins(0,0,0,0); m_mainLayout->setSpacing(0); m_mainWidget = new QGraphicsWidget; m_mainWidget->setLayout(m_mainLayout); m_mainWidget->setZValue(1); m_scene->addItem(m_mainWidget); //Topbar m_topBar = new TopBar(this, 0); m_mainLayout->addItem(m_topBar); m_topBar->setZValue(1); connect(m_topBar, SIGNAL(clicked(bool)), m_menu, SLOT(menuShowHide())); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setContentsMargins(0,0,0,0); setViewportMargins(0,0,0,0); setFrameShape(QFrame::NoFrame); fpsReset(); m_fpsUpdated.start(); }
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) : QSplashScreen(pixmap, f) { setAutoFillBackground(true); // set reference point, paddings int paddingLeft = 14; int paddingTop = 26; int titleVersionVSpace = 17; int titleCopyrightVSpace = 32; float fontFactor = 1.0; // define text to place QString titleText = tr("Flaxscript Core"); QString versionText = QString(tr("Version %1")).arg(QString::fromStdString(FormatFullVersion())); QString copyrightTextBtc = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers")); QString copyrightTextDrk = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Dash Core developers")); QString copyrightTextChc = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Flaxscript Core developers")); QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object QString font = "Arial"; // load the bitmap for writing some text over it QPixmap newPixmap; if(isTestNet) { newPixmap = QPixmap(":/images/splash_testnet"); } else { newPixmap = QPixmap(":/images/splash"); } QPainter pixPaint(&newPixmap); pixPaint.setPen(QColor(100,100,100)); // check font size and drawing with pixPaint.setFont(QFont(font, 28*fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); int titleTextWidth = fm.width(titleText); if(titleTextWidth > 160) { // strange font rendering, Arial probably not found fontFactor = 0.75; } pixPaint.setFont(QFont(font, 28*fontFactor)); fm = pixPaint.fontMetrics(); titleTextWidth = fm.width(titleText); pixPaint.drawText(paddingLeft,paddingTop,titleText); pixPaint.setFont(QFont(font, 15*fontFactor)); pixPaint.drawText(paddingLeft,paddingTop+titleVersionVSpace,versionText); // draw copyright stuff pixPaint.setFont(QFont(font, 10*fontFactor)); pixPaint.drawText(paddingLeft,paddingTop+titleCopyrightVSpace,copyrightTextBtc); pixPaint.drawText(paddingLeft,paddingTop+titleCopyrightVSpace+12,copyrightTextDrk); pixPaint.drawText(paddingLeft,paddingTop+titleCopyrightVSpace+24,copyrightTextChc); // draw testnet string if testnet is on if(isTestNet) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); int testnetAddTextWidth = fm.width(testnetAddText); pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,newPixmap.height()-25,testnetAddText); } pixPaint.end(); this->setPixmap(newPixmap); subscribeToCoreSignals(); }
KviIrcViewToolWidget::KviIrcViewToolWidget(KviIrcView * pParent) : QWidget(pParent) { m_pIrcView = pParent; setAutoFillBackground(true); setContentsMargins(0,0,0,0); QHBoxLayout * pLayout = new QHBoxLayout(this); pLayout->setMargin(2); pLayout->setSpacing(2); QPushButton * pButton = new QPushButton(QIcon(*g_pIconManager->getSmallIcon(KviIconManager::Close)), QString(),this); pButton->setFixedSize(16,16); pButton->setFlat(true); connect(pButton,SIGNAL(clicked()),m_pIrcView,SLOT(toggleToolWidget())); pLayout->addWidget(pButton); m_pStringToFind = new KviThemedLineEdit(this, m_pIrcView->parentKviWindow(), "search_lineedit"); pLayout->addWidget(m_pStringToFind); connect(m_pStringToFind,SIGNAL(returnPressed()),this,SLOT(findNext())); connect(m_pStringToFind,SIGNAL(textChanged(QString)),this,SLOT(findNextHelper(QString))); pButton = new QPushButton(__tr2qs("&Next"),this); pButton->setDefault(true); connect(pButton,SIGNAL(clicked()),this,SLOT(findNext())); pLayout->addWidget(pButton); pButton = new QPushButton(__tr2qs("&Previous"),this); connect(pButton,SIGNAL(clicked()),this,SLOT(findPrev())); pLayout->addWidget(pButton); m_pOptionsButton = new QPushButton(this); m_pOptionsButton->setText(__tr2qs("&Options")); pLayout->addWidget(m_pOptionsButton); m_pOptionsWidget = new QMenu(m_pOptionsButton); QGridLayout * pOptionsLayout = new QGridLayout(m_pOptionsWidget); pOptionsLayout->setSpacing(2); connect(m_pOptionsButton, SIGNAL(clicked()), this, SLOT(toggleOptions())); // Filter tab QLabel * pLabel = new QLabel(__tr2qs("Message types"), m_pOptionsWidget); pOptionsLayout->addWidget(pLabel,0,0,1,2); m_pFilterView = new QTreeWidget(m_pOptionsWidget); m_pFilterView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_pFilterView->setRootIsDecorated(false); //FIXME hardcoded size sucks m_pFilterView->setMinimumSize(QSize(200,150)); m_pFilterView->setColumnCount(1); m_pFilterView->header()->hide(); pOptionsLayout->addWidget(m_pFilterView,1,0,4,2); m_pFilterItems = (KviIrcMessageCheckListItem **)KviMemory::allocate(KVI_NUM_MSGTYPE_OPTIONS * sizeof(KviIrcMessageCheckListItem *)); for(int i=0;i<KVI_NUM_MSGTYPE_OPTIONS;i++) { m_pFilterItems[i] = new KviIrcMessageCheckListItem(m_pFilterView,this,i); } pButton = new QPushButton(__tr2qs("Set &All"),m_pOptionsWidget); connect(pButton,SIGNAL(clicked()),this,SLOT(filterEnableAll())); pOptionsLayout->addWidget(pButton,6,0); pButton = new QPushButton(__tr2qs("Set &None"),m_pOptionsWidget); connect(pButton,SIGNAL(clicked()),this,SLOT(filterEnableNone())); pOptionsLayout->addWidget(pButton,6,1); pButton = new QPushButton(__tr2qs("&Load From..."),m_pOptionsWidget); connect(pButton,SIGNAL(clicked()),this,SLOT(filterLoad())); pOptionsLayout->addWidget(pButton,7,0); pButton = new QPushButton(__tr2qs("&Save As..."),m_pOptionsWidget); connect(pButton,SIGNAL(clicked()),this,SLOT(filterSave())); pOptionsLayout->addWidget(pButton,7,1); pLabel = new QLabel(__tr2qs("Pattern:"),m_pOptionsWidget); pOptionsLayout->addWidget(pLabel,8,0); m_pSearchMode = new QComboBox(m_pOptionsWidget); m_pSearchMode->insertItem(PlainText, __tr2qs("Plain Text")); m_pSearchMode->insertItem(Wildcards, __tr2qs("Wildcards")); m_pSearchMode->insertItem(RegExp, __tr2qs("RegExp")); pOptionsLayout->addWidget(m_pSearchMode,8,1); pLabel = new QLabel(__tr2qs("Match:"),m_pOptionsWidget); pOptionsLayout->addWidget(pLabel,9,0); m_pCaseSensitive = new QCheckBox(__tr2qs("&Case sensitive"),m_pOptionsWidget); pOptionsLayout->addWidget(m_pCaseSensitive,9,1); // m_pFindResult = new QLabel(this); // m_pFindResult->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); // pOptionsLayout->addWidget(m_pFindResult,0,6); // Focussing the 'string to find' widget has been moved to the toggle function so that it happens whenever the widget is shown KviShortcut::create(Qt::Key_Escape,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut); KviShortcut::create(KVI_SHORTCUTS_WIN_SEARCH,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut); }
ccCompassDlg::ccCompassDlg(QWidget* parent/*=0*/) : ccOverlayDialog(parent) , Ui::compassDlg() { setupUi(this); //setup "algorithm" dropdown m_cost_algorithm_menu = new QMenu(this); m_cost_algorithm_menu->setTitle("Algorithm"); m_dark = new QAction("Darkness", this); m_dark->setCheckable(true); m_dark->setChecked(true); m_light = new QAction("Lightness", this); m_light->setCheckable(true); m_rgb = new QAction("RGB similarity", this); m_rgb->setCheckable(true); m_grad = new QAction("RGB gradient", this); m_grad->setCheckable(true); //m_grad->setEnabled(true); m_curve = new QAction("Curvature", this); m_curve->setCheckable(true); //m_curve->setEnabled(false); m_dist = new QAction("Distance", this); m_dist->setCheckable(true); m_scalar = new QAction("Scalar field", this); m_scalar->setCheckable(true); m_scalar_inv = new QAction("Inverse scalar field", this); m_scalar_inv->setCheckable(true); m_recalculate = new QAction("Recalculate selection", this); //used to recalculate selected traces with new cost function m_plane_fit = new QAction("Fit planes", this); m_plane_fit->setCheckable(true); m_plane_fit->setChecked(true); //setup tool-tips m_dark->setToolTip("Traces follow 'dark' points. Good for shadowed fracture traces."); m_light->setToolTip("Traces follow 'light' points. Good for thin quartz veins etc."); m_rgb->setToolTip("Traces follow points that have a similar color to the start and end points. Useful if structures being traced have a distinct color."); m_grad->setToolTip("Traces follow points in neighbourhoods with high colour gradients. Good for contacts."); m_curve->setToolTip("Traces follow ridges and valleys. Good for fractures with high relief, especially in combination with \"Darkness\"."); m_dist->setToolTip("Traces take the shortest euclidean path (how booring...)"); m_scalar->setToolTip("Use the active scalar field to define path cost (i.e. the path follows low scalar values)."); m_scalar_inv->setToolTip("Use the inverse of the active scalar field to define path cost (i.e. the path follows high scalar values)."); m_recalculate->setToolTip("Recalculate the selected traces using the latest cost function"); //add to menu m_cost_algorithm_menu->addAction(m_dark); m_cost_algorithm_menu->addAction(m_light); m_cost_algorithm_menu->addAction(m_rgb); m_cost_algorithm_menu->addAction(m_grad); m_cost_algorithm_menu->addAction(m_curve); m_cost_algorithm_menu->addAction(m_dist); m_cost_algorithm_menu->addAction(m_scalar); m_cost_algorithm_menu->addAction(m_scalar_inv); m_cost_algorithm_menu->addSeparator(); m_cost_algorithm_menu->addAction(m_recalculate); //add callbacks ccCompassDlg::connect(m_dark, SIGNAL(triggered()), this, SLOT(setDarkCost())); ccCompassDlg::connect(m_light, SIGNAL(triggered()), this, SLOT(setLightCost())); ccCompassDlg::connect(m_rgb, SIGNAL(triggered()), this, SLOT(setRGBCost())); ccCompassDlg::connect(m_grad, SIGNAL(triggered()), this, SLOT(setGradCost())); ccCompassDlg::connect(m_curve, SIGNAL(triggered()), this, SLOT(setCurveCost())); ccCompassDlg::connect(m_dist, SIGNAL(triggered()), this, SLOT(setDistCost())); ccCompassDlg::connect(m_scalar, SIGNAL(triggered()), this, SLOT(setScalarCost())); ccCompassDlg::connect(m_scalar_inv, SIGNAL(triggered()), this, SLOT(setInvScalarCost())); //setup settings menu m_settings_menu = new QMenu(this); m_plane_fit = new QAction("Fit planes", this); m_plane_fit->setCheckable(true); m_plane_fit->setChecked(false); m_showStippled = new QAction("Show stippled", this); m_showStippled->setCheckable(true); m_showStippled->setChecked(true); m_showNormals = new QAction("Show normals", this); m_showNormals->setCheckable(true); m_showNormals->setChecked(true); m_showNames = new QAction("Show names", this); m_showNames->setCheckable(true); m_showNames->setChecked(false); m_plane_fit->setToolTip("If checked, a plane will automatically be fitted to traces matching the criteria defined in the ccCompass description."); m_showStippled->setToolTip("If checked, planes will be drawn partially transparent (stippled)."); m_showNormals->setToolTip("If checked, plane normals will be drawn."); m_showNames->setToolTip("If checked, plane orientations will be displayed in the 3D view."); m_settings_menu->addAction(m_plane_fit); m_settings_menu->addAction(m_showStippled); m_settings_menu->addAction(m_showNormals); m_settings_menu->addAction(m_showNames); m_settings_menu->addSeparator(); m_settings_menu->addMenu(m_cost_algorithm_menu); algorithmButton->setPopupMode(QToolButton::InstantPopup); algorithmButton->setMenu(m_settings_menu); //add settings menu algorithmButton->setEnabled(true); //setup pair picking menu m_pairpicking_menu = new QMenu(this); m_research_menu = new QMenu(this); m_research_menu->setTitle("Research"); m_loadFoliations = new QAction("Import foliations...", this); m_loadLineations = new QAction("Import lineations...", this); m_toSVG = new QAction("Export SVG...", this); m_noteTool = new QAction("Add note", this); m_pinchTool = new QAction("Add pinch nodes", this); m_measure_thickness = new QAction("Measure one-point thickness", this); m_measure_thickness_twoPoint = new QAction("Measure two-point thickness", this); m_youngerThan = new QAction("Assign \"Younger-Than\" relationship", this); m_youngerThan->setEnabled(false); //todo m_follows = new QAction("Assign \"Follows\" relationship", this); m_follows->setEnabled(false); m_equivalent = new QAction("Assign \"Equivalent\" relationship", this); m_equivalent->setEnabled(false); m_fitPlaneToGeoObject = new QAction("Fit plane to GeoObject", this); m_mergeSelected = new QAction("Merge selected GeoObjects", this); m_estimateNormals = new QAction("Estimate structure normals", this); m_pinchTool->setToolTip("Add Pinch Node objects to record features such as dyke tips or sedimentary units that pinch-out."); m_loadFoliations->setToolTip("Converts a point cloud containing points (measurement location) and dip/dip-direction scalar fields to planes."); m_loadLineations->setToolTip("Convert a point cloud containing measurement points and trend->plunge scalar fields into foliation objects."); m_toSVG->setToolTip("Export the currently visible trace to a SVG vector graphic using an orthographic projection of the current view."); m_noteTool->setToolTip("Add short notes to a point in a point cloud for future reference."); m_measure_thickness->setToolTip("Select a plane and then a point to measure plane-perpendicular thickness."); m_measure_thickness_twoPoint->setToolTip("Measure the plane-perpendicular distance between two points."); m_youngerThan->setToolTip("Pick two GeoObjects to assign a \"younger-than\" (i.e. crosscutting, superposition) relationshi.p"); m_follows->setToolTip("Select two GeoObjects to assign a \"follows\" (i.e. conformable) relationship."); m_equivalent->setToolTip("Select two GeoObjects to assign an \"equivalent\" (i.e. coeval) relationship."); m_fitPlaneToGeoObject->setToolTip("Calculates best fit planes for the entire upper/lower surfaces of the GeoObject."); m_mergeSelected->setToolTip("Merge all selected GeoObjects into a single GeoObject."); m_estimateNormals->setToolTip("Estimate trace structure normals with maximum a-postiori plane fitting algorithm."); m_pairpicking_menu->addAction(m_pinchTool); m_pairpicking_menu->addAction(m_measure_thickness); m_pairpicking_menu->addAction(m_measure_thickness_twoPoint); m_pairpicking_menu->addAction(m_noteTool); m_pairpicking_menu->addSeparator(); //m_pairpicking_menu->addAction(m_youngerThan); //TODO - reenable these once topology code has been fixed //m_pairpicking_menu->addAction(m_follows); //m_pairpicking_menu->addAction(m_equivalent); //m_pairpicking_menu->addSeparator(); m_pairpicking_menu->addAction(m_fitPlaneToGeoObject); m_pairpicking_menu->addAction(m_mergeSelected); m_pairpicking_menu->addAction(m_estimateNormals); m_pairpicking_menu->addSeparator(); m_pairpicking_menu->addAction(m_loadFoliations); m_pairpicking_menu->addAction(m_loadLineations); m_pairpicking_menu->addAction(m_toSVG); m_pairpicking_menu->addSeparator(); m_pairpicking_menu->addMenu(m_research_menu); //Add tools to research menu m_recalculateFitPlanes = new QAction("Recalculate fit-planes", this); m_toPointCloud = new QAction("Convert to point cloud", this); m_distributeSelection = new QAction("Distribute to GeoObjects", this); m_estimateP21 = new QAction("Estimate P21 intensity", this); m_estimateStrain = new QAction("Estimate strain", this); m_recalculateFitPlanes->setToolTip("Recalculates all fit-planes deriving from traces and GeoObjects (but not those calculated with the Plane Tool)."); m_toPointCloud->setToolTip("Converts the selected GeoObject(s) or individual traces to a point cloud (typically for proximity analysis)."); m_distributeSelection->setToolTip("Distributes the selected objects into GeoObjects that have matching names."); m_estimateP21->setToolTip("Uses structure traces and the mesh octree to measure fracture intensity."); m_estimateStrain->setToolTip("Estimate bulk strain tensor from Mode-I dykes and veins with structure normal estimates."); m_research_menu->addAction(m_recalculateFitPlanes); m_research_menu->addAction(m_estimateP21); m_research_menu->addAction(m_estimateStrain); m_research_menu->addAction(m_distributeSelection); m_research_menu->addAction(m_toPointCloud); extraModeButton->setPopupMode(QToolButton::InstantPopup); extraModeButton->setMenu(m_pairpicking_menu); //set background color QPalette p; p.setColor(backgroundRole(), QColor(240, 240, 240, 200)); setPalette(p); setAutoFillBackground(true); //add shortcuts addOverridenShortcut(Qt::Key_Escape); //escape key for the "cancel" button addOverridenShortcut(Qt::Key_Return); //return key for the "apply" button addOverridenShortcut(Qt::Key_Space); //space key also hits the "apply" button (easier for some) connect(this, SIGNAL(shortcutTriggered(int)), this, SLOT(onShortcutTriggered(int))); }
sf2InstrumentView::sf2InstrumentView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { // QVBoxLayout * vl = new QVBoxLayout( this ); // QHBoxLayout * hl = new QHBoxLayout(); sf2Instrument* k = castModel<sf2Instrument>(); connect( &k->m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatchName() ) ); connect( &k->m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatchName() ) ); // File Button m_fileDialogButton = new pixmapButton( this ); m_fileDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_fileDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_on" ) ); m_fileDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_off" ) ); m_fileDialogButton->move( 217, 107 ); connect( m_fileDialogButton, SIGNAL( clicked() ), this, SLOT( showFileDialog() ) ); toolTip::add( m_fileDialogButton, tr( "Open other SoundFont file" ) ); m_fileDialogButton->setWhatsThis( tr( "Click here to open another SF2 file" ) ); // Patch Button m_patchDialogButton = new pixmapButton( this ); m_patchDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_patchDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_on" ) ); m_patchDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_off" ) ); m_patchDialogButton->setEnabled( false ); m_patchDialogButton->move( 217, 125 ); connect( m_patchDialogButton, SIGNAL( clicked() ), this, SLOT( showPatchDialog() ) ); toolTip::add( m_patchDialogButton, tr( "Choose the patch" ) ); // LCDs m_bankNumLcd = new LcdSpinBox( 3, "21pink", this ); m_bankNumLcd->move(131, 62); // m_bankNumLcd->addTextForValue( -1, "---" ); // m_bankNumLcd->setEnabled( false ); m_patchNumLcd = new LcdSpinBox( 3, "21pink", this ); m_patchNumLcd->move(190, 62); // m_patchNumLcd->addTextForValue( -1, "---" ); // m_patchNumLcd->setEnabled( false ); /*hl->addWidget( m_fileDialogButton ); hl->addWidget( m_bankNumLcd ); hl->addWidget( m_patchNumLcd ); hl->addWidget( m_patchDialogButton ); vl->addLayout( hl );*/ // Next row //hl = new QHBoxLayout(); m_filenameLabel = new QLabel( this ); m_filenameLabel->setGeometry( 58, 109, 156, 11 ); m_patchLabel = new QLabel( this ); m_patchLabel->setGeometry( 58, 127, 156, 11 ); //hl->addWidget( m_filenameLabel ); // vl->addLayout( hl ); // Gain m_gainKnob = new sf2Knob( this ); m_gainKnob->setHintText( tr("Gain") + " ", "" ); m_gainKnob->move( 86, 55 ); // vl->addWidget( m_gainKnob ); // Reverb // hl = new QHBoxLayout(); m_reverbButton = new pixmapButton( this ); m_reverbButton->setCheckable( true ); m_reverbButton->move( 14, 180 ); m_reverbButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reverb_on" ) ); m_reverbButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "reverb_off" ) ); toolTip::add( m_reverbButton, tr( "Apply reverb (if supported)" ) ); m_reverbButton->setWhatsThis( tr( "This button enables the reverb effect. " "This is useful for cool effects, but only works on " "files that support it." ) ); m_reverbRoomSizeKnob = new sf2Knob( this ); m_reverbRoomSizeKnob->setHintText( tr("Reverb Roomsize:") + " ", "" ); m_reverbRoomSizeKnob->move( 93, 160 ); m_reverbDampingKnob = new sf2Knob( this ); m_reverbDampingKnob->setHintText( tr("Reverb Damping:") + " ", "" ); m_reverbDampingKnob->move( 130, 160 ); m_reverbWidthKnob = new sf2Knob( this ); m_reverbWidthKnob->setHintText( tr("Reverb Width:") + " ", "" ); m_reverbWidthKnob->move( 167, 160 ); m_reverbLevelKnob = new sf2Knob( this ); m_reverbLevelKnob->setHintText( tr("Reverb Level:") + " ", "" ); m_reverbLevelKnob->move( 204, 160 ); /* hl->addWidget( m_reverbOnLed ); hl->addWidget( m_reverbRoomSizeKnob ); hl->addWidget( m_reverbDampingKnob ); hl->addWidget( m_reverbWidthKnob ); hl->addWidget( m_reverbLevelKnob ); vl->addLayout( hl ); */ // Chorus // hl = new QHBoxLayout(); m_chorusButton = new pixmapButton( this ); m_chorusButton->setCheckable( true ); m_chorusButton->move( 14, 226 ); m_chorusButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "chorus_on" ) ); m_chorusButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "chorus_off" ) ); toolTip::add( m_reverbButton, tr( "Apply chorus (if supported)" ) ); m_chorusButton->setWhatsThis( tr( "This button enables the chorus effect. " "This is useful for cool echo effects, but only works on " "files that support it." ) ); m_chorusNumKnob = new sf2Knob( this ); m_chorusNumKnob->setHintText( tr("Chorus Lines:") + " ", "" ); m_chorusNumKnob->move( 93, 206 ); m_chorusLevelKnob = new sf2Knob( this ); m_chorusLevelKnob->setHintText( tr("Chorus Level:") + " ", "" ); m_chorusLevelKnob->move( 130 , 206 ); m_chorusSpeedKnob = new sf2Knob( this ); m_chorusSpeedKnob->setHintText( tr("Chorus Speed:") + " ", "" ); m_chorusSpeedKnob->move( 167 , 206 ); m_chorusDepthKnob = new sf2Knob( this ); m_chorusDepthKnob->setHintText( tr("Chorus Depth:") + " ", "" ); m_chorusDepthKnob->move( 204 , 206 ); /* hl->addWidget( m_chorusOnLed ); hl->addWidget( m_chorusNumKnob); hl->addWidget( m_chorusLevelKnob); hl->addWidget( m_chorusSpeedKnob); hl->addWidget( m_chorusDepthKnob); vl->addLayout( hl ); */ setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); updateFilename(); }
LevelOneMuChart::LevelOneMuChart(QWidget *parent) : QwtPlot(parent) { setAutoReplot(false); /* Panning with the left mouse button */ (void)new QwtPlotPanner(canvas()); /* Zoom in/out with the wheel */ (void)new QwtPlotMagnifier(canvas()); /* Picker */ plotPicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas()); plotPicker->setStateMachine(new QwtPickerDragPointMachine()); plotPicker->setRubberBandPen(QColor(Qt::blue)); plotPicker->setRubberBand(QwtPicker::CrossRubberBand); plotPicker->setTrackerPen(QColor(Qt::black)); setAutoFillBackground(true); setPalette(QPalette(QColor(199, 237, 255))); // Light Blue updateWidgetGradient(); setTitle(tr("Chart of available deviations")); /* Legend */ legend = new QwtLegend(); legend->setItemMode(QwtLegend::CheckableItem); insertLegend(legend, QwtPlot::RightLegend); /* Canvas Settings */ canvas()->setLineWidth(1); canvas()->setFrameStyle(QFrame::Box | QFrame::Plain); QPalette canvasPalette(Qt::white); canvasPalette.setColor(QPalette::Foreground, QColor(133, 190, 232)); canvas()->setPalette(canvasPalette); plotAssay(); /* Legend */ connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), SLOT(showItem(QwtPlotItem *, bool))); QwtPlotItemList items = itemList(QwtPlotItem::Rtti_PlotCurve); for (int i = 0; i < items.size(); i++) { if (i < 3) { QwtLegendItem *legendItem = qobject_cast<QwtLegendItem *>(legend->find(items[i])); if (legendItem) { legendItem->setChecked(true); } items[i]->setVisible(true); } else { items[i]->setVisible(false); } } setAutoReplot(true); }
MUPlot::MUPlot(MUWidget *muw, CriticalPowerWindow *parent, Context *context) : QwtPlot(parent), QwtSyntheticPointData(MUN), context(context), muw(muw), parent(parent), modelCurve(NULL), slowCurve(NULL), fastCurve(NULL), mmpCurve(NULL) { // initalise all the model stufff // probably abstract this out later muSet = NULL; slowHandle = NULL; slowLine = NULL; slowDrag = false; fastHandle = NULL; fastLine = NULL; fastDrag = false; setAutoDelete(false); setAutoFillBackground(true); static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame); // left yAxis scale prettify QwtScaleDraw *sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); sd->enableComponent(QwtScaleDraw::Ticks, false); sd->enableComponent(QwtScaleDraw::Backbone, false); setAxisScaleDraw(yLeft, sd); setAxisTitle(yLeft, tr("w(x)")); setAxisMaxMinor(yLeft, 0); plotLayout()->setAlignCanvasToScales(true); // 0.5 increments on bottom axis QwtValueList ytick[QwtScaleDiv::NTickTypes]; for (double i=0.0f; i<=10.0f; i+= 1.0) ytick[QwtScaleDiv::MajorTick]<<i; setAxisScaleDiv(yLeft,QwtScaleDiv(0.0f,10.0f,ytick)); // bottom xAxis scale prettify sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); sd->enableComponent(QwtScaleDraw::Ticks, false); sd->enableComponent(QwtScaleDraw::Backbone, false); setAxisScaleDraw(xBottom, sd); setAxisTitle(xBottom, tr("Motor Unit, x")); setAxisMaxMinor(xBottom, 0); // 0.2 increments on bottom axis QwtValueList xtick[QwtScaleDiv::NTickTypes]; for (double i=0.0f; i<=1.0f; i+= 0.2) xtick[QwtScaleDiv::MajorTick]<<i; setAxisScaleDiv(xBottom,QwtScaleDiv(0.0f,1.0f,xtick)); // now color everything we created configChanged(); // set to a 2 Normal Model setModel(2); // set mouse tracker parent->setMouseTracking(true); installEventFilter(parent); new muMouseTracker(this); }
Piano::Piano(QWidget *parent) : QWidget(parent) { init_log(); QPalette Pal(palette()); Pal.setColor(QPalette::Background, QColor::fromRgb(240, 240, 240)); setAutoFillBackground(true); setPalette(Pal); showing = false; //displaying the scorebox b_names_dip = false; b_racc_disp = false; notes = new QVector<Touche*>(); notes_jouees = new QVector<QString>(); setFixedSize(800, 310); QPushButton *raccButt= new QPushButton(QString(""),this); raccButt->setToolTip(QString("Affiche les raccourcis clavier pour le piano")); QPushButton *noteNames = new QPushButton(QString(""),this); noteNames->setToolTip(QString("Affiche le nom des notes sur le piano")); QCheckBox *checkB = new QCheckBox(QString("options affichage"),this); checkB->setToolTip(QString("Affiche/cache les options d'affiche du piano")); QPushButton *retour = new QPushButton(QString(""),this); checkB->setChecked(true); retour->move(740,0); retour->setStyleSheet("border-image: url(:/new/prefix1/undo.png)"); retour->setToolTip(QString("Annule la dernière note jouée")); retour->resize(50,50); QPushButton *solution = new QPushButton(QString("Solution"),this); solution->setToolTip(QString("Aide: Indique la note suivante sur le piano")); solution->move(0,10); checkB->move(0,282); Touche* doM = new Touche(this, QString("tab"),QString("Do")); int sizeT= 38;//doM->width(); //QMessageBox::information(new QWidget(),QString("taille "),QString::number(sizeT)); int hauteur = 100; int nT =3; raccButt->move(0,hauteur+50); raccButt->setFixedSize(140,50); raccButt->setStyleSheet("border-image: url(:/img/clavier.svg.png);" ); noteNames->move(660,hauteur +50); noteNames->setFixedSize(140,50); noteNames->setStyleSheet("border-image: url(:/img/doremi);" "border-width: 2px;"); doM->move(sizeT*nT,hauteur); nT+=1; Touche* reM = new Touche(this, QString("A"),QString("Ré")); reM->move(sizeT*nT,hauteur); nT+=1; Touche* miM = new Touche(this, QString("Z"),QString("Mi")); miM->move(sizeT*nT,hauteur); nT+=1; Touche* faM = new Touche(this, QString("E"),QString("Fa")); faM->move(sizeT*nT,hauteur); nT+=1; Touche* solM = new Touche(this, QString("R"),QString("Sol")); solM->move(sizeT*nT,hauteur); nT+=1; Touche* laM = new Touche(this, QString("T"),QString("La")); laM->move(sizeT*nT,hauteur); nT+=1; Touche* siM = new Touche(this, QString("Y"),QString("si")); siM->move(sizeT*nT,hauteur); nT+=1; Touche* dom = new Touche(this, QString("U"),QString("Do")); dom->move(sizeT*nT,hauteur); nT+=1; Touche* rem = new Touche(this, QString("I"),QString("Ré")); rem->move(sizeT*nT,hauteur); nT+=1; Touche* mim = new Touche(this, QString("O"),QString("Mi")); mim->move(sizeT*nT,hauteur); nT+=1; Touche* fam = new Touche(this, QString("P"),QString("Fa")); fam->move(sizeT*nT,hauteur); nT+=1; Touche* solm = new Touche(this, QString(/*"dead_circumflex"*/"16781906"),QString("Sol")); solm->move(sizeT*nT,hauteur); nT+=1; Touche* lam = new Touche(this, QString("$"),QString("La")); lam->move(sizeT*nT,hauteur); nT+=1; Touche* sim = new Touche(this, QString("Return"),QString("si")); sim->move(sizeT*nT,hauteur); nT=4; Touche* doMD = new Touche(this, QString("&"),QString("Do#")); doMD->black(); doMD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* reMD = new Touche(this, QString("é"),QString("Ré#")); reMD->black(); reMD->move(sizeT*nT-sizeT/4,hauteur); nT+=2; Touche* faMD = new Touche(this, QString("'"),QString("Fa#")); faMD->black(); faMD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* solMD = new Touche(this, QString("("),QString("Sol#")); solMD->black(); solMD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* laMD = new Touche(this, QString("-"),QString("La#")); laMD->black(); laMD->move(sizeT*nT-sizeT/4,hauteur); nT+=2; Touche* domD = new Touche(this, QString("_"),QString("Do#")); domD->black(); domD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* remD = new Touche(this, QString("ç"),QString("Ré#")); remD->black(); remD->move(sizeT*nT-sizeT/4,hauteur); nT+=2; Touche* famD = new Touche(this, QString(")"),QString("Fa#")); famD->black(); famD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* solmD = new Touche(this, QString("="),QString("Sol#")); solmD->black(); solmD->move(sizeT*nT-sizeT/4,hauteur); nT+=1; Touche* lamD = new Touche(this, QString("Backspace"),QString("La#")); lamD->black(); lamD->move(sizeT*nT-sizeT/4,hauteur); QObject::connect(doM, SIGNAL(clicked()), this, SLOT(play_doM()));notes->append(doM); QObject::connect(reM, SIGNAL(clicked()), this, SLOT(play_reM()));notes->append(reM); QObject::connect(miM, SIGNAL(clicked()), this, SLOT(play_miM()));notes->append(miM); QObject::connect(faM, SIGNAL(clicked()), this, SLOT(play_faM()));notes->append(faM); QObject::connect(solM, SIGNAL(clicked()), this, SLOT(play_solM()));notes->append(solM); QObject::connect(laM, SIGNAL(clicked()), this, SLOT(play_laM()));notes->append(laM); QObject::connect(siM, SIGNAL(clicked()), this, SLOT(play_siM()));notes->append(siM); QObject::connect(dom, SIGNAL(clicked()), this, SLOT(play_dom()));notes->append(dom); QObject::connect(rem, SIGNAL(clicked()), this, SLOT(play_rem()));notes->append(rem); QObject::connect(mim, SIGNAL(clicked()), this, SLOT(play_mim()));notes->append(mim); QObject::connect(fam, SIGNAL(clicked()), this, SLOT(play_fam()));notes->append(fam); QObject::connect(solm, SIGNAL(clicked()), this, SLOT(play_solm()));notes->append(solm); QObject::connect(lam, SIGNAL(clicked()), this, SLOT(play_lam()));notes->append(lam); QObject::connect(sim, SIGNAL(clicked()), this, SLOT(play_sim()));notes->append(sim); QObject::connect(doMD, SIGNAL(clicked()), this, SLOT(play_doMD()));notes->append(doMD); QObject::connect(reMD, SIGNAL(clicked()), this, SLOT(play_reMD()));notes->append(reMD); QObject::connect(faMD, SIGNAL(clicked()), this, SLOT(play_faMD()));notes->append(faMD); QObject::connect(solMD, SIGNAL(clicked()), this, SLOT(play_solMD()));notes->append(solMD); QObject::connect(laMD, SIGNAL(clicked()), this, SLOT(play_laMD()));notes->append(laMD); QObject::connect(domD, SIGNAL(clicked()), this, SLOT(play_domD()));notes->append(domD); QObject::connect(remD, SIGNAL(clicked()), this, SLOT(play_remD()));notes->append(remD); QObject::connect(famD, SIGNAL(clicked()), this, SLOT(play_famD()));notes->append(famD); QObject::connect(solmD, SIGNAL(clicked()), this, SLOT(play_solmD()));notes->append(solmD); QObject::connect(lamD, SIGNAL(clicked()), this, SLOT(play_lamD()));notes->append(lamD); QObject::connect(raccButt, SIGNAL(clicked()), this, SLOT(display_racc())); QObject::connect(noteNames, SIGNAL(clicked()), this, SLOT(display_names())); QObject::connect(checkB, SIGNAL(toggled(bool)), this, SLOT(checking(bool))); QObject::connect(retour, SIGNAL(clicked()), this, SLOT(retour_arriere())); }
PlotWidget::PlotWidget(QWidget *p, const QList<float> &xl,const QList<float> &yl) : QWidget(p), xdata(xl), ydata(yl) { setPalette(QPalette(QColor(255,255,255))); setAutoFillBackground(true); setMinimumSize(20,20); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); }
mafenetre::mafenetre() : QMainWindow() { //Mainwindow this->setPosition(); this->setMinimumSize(270,300); setWindowTitle("Choix des paramètres "); setPalette(QPalette(QColor(204,229,255))); setAutoFillBackground(true); vbox1=new QGridLayout;// widgets position adapt automatically to the mainwindow size QWidget *widget = new QWidget(); widget->setLayout(vbox1); setCentralWidget(widget); //Buttons and labels m_buttonDialogueMNT= new QPushButton("Charger un MNT", this); m_buttonDialogueMNT->setCursor(Qt::PointingHandCursor); m_buttonDialogueMNT->setStyleSheet(" background-color: white;padding: 3px;"); m_label = new QLabel(this); m_buttonDialogueGPX= new QPushButton("Charger un GPX", this); m_buttonDialogueGPX->setCursor(Qt::PointingHandCursor); m_buttonDialogueGPX->setStyleSheet("background-color: white;padding: 3px;"); m_label2 = new QLabel(this); queMnt=new QCheckBox("Afficher uniquement un Mnt", this); aide=new QPushButton("Aide",this); aide->setCursor(Qt::PointingHandCursor); fermer=new QPushButton("Fermer", this); fermer->setCursor(Qt::PointingHandCursor); fermer->setStyleSheet("background-color: white; padding: 3px;"); valider= new QPushButton("Valider", this); valider->setCursor(Qt::PointingHandCursor); valider->setStyleSheet(" background-color: white;padding: 3px;"); if (boolmnt && boolgpx) valider->setEnabled(true); else if (!boolmnt || !boolgpx) valider->setEnabled(false); connect(m_buttonDialogueMNT, SIGNAL(clicked()), this, SLOT(adresseMNT())); connect(m_buttonDialogueGPX, SIGNAL(clicked()), this, SLOT(adresseGPX())); connect(queMnt, SIGNAL(clicked()), this, SLOT(desactiverGpx())); connect(aide, SIGNAL(clicked()), this, SLOT(activerAide())); connect(fermer, SIGNAL(clicked()),qApp, SLOT(quit())); connect(valider, SIGNAL(clicked()),this, SLOT(lancerOpenGl())); //Speed choice groupbox = new QGroupBox("Vitesse initiale du parcours", this); groupbox->setStyleSheet("background-color: white"); groupbox->setStyleSheet( "subcontrol-origin: margin"); vitesseReelle = new QRadioButton("Vitesse réelle", this); vitesseConstante = new QRadioButton("Vitesse constante", this); choixVitesse= new QSpinBox(this); choixVitesse->setRange(1,10);//minimum and maximum speeds vitesseReelleDisponible=false;//by default vitesseConstante->setChecked(true);//by default, not real speed is selected choixVitesse->setEnabled(true);//choosing a constant speed is not possible vitesseReelle->setCheckable(false); //connect(vitesseConstante, SIGNAL(clicked()), this, SLOT(activerSpin())); //connect(choixVitesse, SIGNAL(valueChanged(int)), this, SLOT(activerSpin())); connect(choixVitesse, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); if (vitesseReelleDisponible) (connect(vitesseReelle, SIGNAL(clicked()), this, SLOT(desactiverSpin()))); connect(vitesseReelle, SIGNAL(clicked()), this, SLOT(retournerChoix())); connect(vitesseConstante, SIGNAL(clicked()), this, SLOT(retournerChoixConstante())); QGridLayout *vboxVitesse=new QGridLayout; vboxVitesse->addWidget(vitesseReelle,0,0,1,1); vboxVitesse->addWidget(vitesseConstante,1,0, 1, 1); vboxVitesse->addWidget(choixVitesse,2,0,1,1); groupbox->setLayout(vboxVitesse); //Widgets position in the mainwindow vbox1->addWidget(m_buttonDialogueMNT,0,1,1,2); vbox1->addWidget(m_buttonDialogueGPX,1,1,1,2); vbox1->addWidget(m_label,0,3,1,1); vbox1->addWidget(m_label2,1,3,1,1); vbox1->setVerticalSpacing(15); vbox1->addWidget(queMnt, 2,1); vbox1->addWidget(groupbox, 3,0,3,4); vbox1->addWidget(aide,7,1,1,2); vbox1->addWidget(valider,8,1,1,2); vbox1->addWidget(fermer,9,1,1,2); }
void KisQPainterCanvas::paintEvent(QPaintEvent * ev) { KisImageWSP image = canvas()->image(); if (image == 0) return; setAutoFillBackground(false); if (m_buffer.size() != size()) { m_buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied); } QPainter gc(&m_buffer); // we double buffer, so we paint on an image first, then from the image onto the canvas, // so copy the clip region since otherwise we're filling the whole buffer every time with // the background color _and_ the transparent squares. gc.setClipRegion(ev->region()); KisCoordinatesConverter *converter = coordinatesConverter(); QTransform imageTransform = converter->viewportToWidgetTransform(); gc.save(); gc.setCompositionMode(QPainter::CompositionMode_Source); gc.fillRect(QRect(QPoint(0, 0), size()), borderColor()); QTransform checkersTransform; QPointF brushOrigin; QPolygonF polygon; converter->getQPainterCheckersInfo(&checkersTransform, &brushOrigin, &polygon); gc.setPen(Qt::NoPen); gc.setBrush(m_d->checkBrush); gc.setBrushOrigin(brushOrigin); gc.setTransform(checkersTransform); gc.drawPolygon(polygon); gc.setTransform(imageTransform); if (m_d->smooth) { gc.setRenderHint(QPainter::SmoothPixmapTransform, true); } QRectF viewportRect = converter->widgetToViewport(ev->rect()); gc.setCompositionMode(QPainter::CompositionMode_SourceOver); gc.drawImage(viewportRect, m_d->prescaledProjection->prescaledQImage(), viewportRect); gc.restore(); #ifdef DEBUG_REPAINT QColor color = QColor(random() % 255, random() % 255, random() % 255, 150); gc.fillRect(ev->rect(), color); #endif QRect boundingRect = converter->imageRectInWidgetPixels().toAlignedRect(); drawDecorations(gc, boundingRect); gc.end(); QPainter painter(this); painter.drawImage(ev->rect(), m_buffer, ev->rect()); }
//! [0] StarEditor::StarEditor(QWidget *parent) : QWidget(parent) { setMouseTracking(true); setAutoFillBackground(true); }
////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CPlotter::CPlotter(QWidget *parent) : QFrame(parent) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setFocusPolicy(Qt::StrongFocus); setAttribute(Qt::WA_PaintOnScreen,false); setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent, false); setAttribute(Qt::WA_NoSystemBackground, true); setMouseTracking(true); setTooltipsEnabled(false); // default waterfall color scheme for (int i = 0; i < 256; i++) { // level 0: black background if (i < 20) m_ColorTbl[i].setRgb(0, 0, 0); // level 1: black -> blue else if ((i >= 20) && (i < 70)) m_ColorTbl[i].setRgb(0, 0, 140*(i-20)/50); // level 2: blue -> light-blue / greenish else if ((i >= 70) && (i < 100)) m_ColorTbl[i].setRgb(60*(i-70)/30, 125*(i-70)/30, 115*(i-70)/30 + 140); // level 3: light blue -> yellow else if ((i >= 100) && (i < 150)) m_ColorTbl[i].setRgb(195*(i-100)/50 + 60, 130*(i-100)/50 + 125, 255-(255*(i-100)/50)); // level 4: yellow -> red else if ((i >= 150) && (i < 250)) m_ColorTbl[i].setRgb(255, 255-255*(i-150)/100, 0); // level 5: red -> white else if (i >= 250) m_ColorTbl[i].setRgb(255, 255*(i-250)/5, 255*(i-250)/5); } m_PeakHoldActive=false; m_PeakHoldValid=false; m_FftCenter = 0; m_CenterFreq = 144500000; m_DemodCenterFreq = 144500000; m_DemodHiCutFreq = 5000; m_DemodLowCutFreq = -5000; m_FLowCmin = -25000; m_FLowCmax = -1000; m_FHiCmin = 1000; m_FHiCmax = 25000; m_symetric = true; m_ClickResolution = 100; m_FilterClickResolution = 100; m_CursorCaptureDelta = CUR_CUT_DELTA; m_FilterBoxEnabled = true; m_CenterLineEnabled = true; m_Span = 96000; m_SampleFreq = 96000; m_HorDivs = 12; m_VerDivs = 6; m_MaxdB = 0; m_MindB = -135; m_dBStepSize = abs(m_MaxdB-m_MindB)/m_VerDivs; m_FreqUnits = 1000000; m_CursorCaptured = NONE; m_Running = false; m_DrawOverlay = true; m_2DPixmap = QPixmap(0,0); m_OverlayPixmap = QPixmap(0,0); m_WaterfallPixmap = QPixmap(0,0); m_Size = QSize(0,0); m_GrabPosition = 0; m_Percent2DScreen = 50; //percent of screen used for 2D display #ifdef Q_OS_MAC m_FontSize = 11; #else m_FontSize = 9; #endif m_VdivDelta = 40; m_HdivDelta = 60; m_FreqDigits = 3; m_Peaks = QMap<int,int>(); setPeakDetection(false, 2); m_PeakHoldValid = false; setFftPlotColor(QColor(0xFF,0xFF,0xFF,0xFF)); setFftFill(false); }
ComboTabBar::ComboTabBar(QWidget* parent) : QWidget(parent) , m_mainTabBar(0) , m_pinnedTabBar(0) , m_mainBarOverFlowed(false) , m_lastAppliedOverflow(false) , m_usesScrollButtons(false) , m_blockCurrentChangedSignal(false) { m_mainTabBar = new TabBarHelper(this); m_pinnedTabBar = new TabBarHelper(this); m_mainTabBarWidget = new TabBarScrollWidget(m_mainTabBar, this); m_pinnedTabBarWidget = new TabBarScrollWidget(m_pinnedTabBar, this); m_mainTabBar->setScrollArea(m_mainTabBarWidget->scrollArea()); m_pinnedTabBar->setScrollArea(m_pinnedTabBarWidget->scrollArea()); connect(m_mainTabBarWidget->scrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(setMinimumWidths())); connect(m_mainTabBarWidget->scrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrollBarValueChanged(int))); connect(m_pinnedTabBarWidget->scrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(setMinimumWidths())); connect(m_pinnedTabBarWidget->scrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrollBarValueChanged(int))); connect(this, SIGNAL(overFlowChanged(bool)), m_mainTabBarWidget, SLOT(overFlowChanged(bool))); m_mainTabBar->setActiveTabBar(true); m_pinnedTabBar->setTabsClosable(false); m_leftLayout = new QHBoxLayout; m_leftLayout->setSpacing(0); m_leftLayout->setContentsMargins(0, 0, 0, 0); m_leftContainer = new QWidget(this); m_leftContainer->setLayout(m_leftLayout); m_rightLayout = new QHBoxLayout; m_rightLayout->setSpacing(0); m_rightLayout->setContentsMargins(0, 0, 0, 0); m_rightContainer = new QWidget(this); m_rightContainer->setLayout(m_rightLayout); m_mainLayout = new QHBoxLayout; m_mainLayout->setSpacing(0); m_mainLayout->setContentsMargins(0, 0, 0, 0); m_mainLayout->addWidget(m_leftContainer); m_mainLayout->addWidget(m_pinnedTabBarWidget); m_mainLayout->addWidget(m_mainTabBarWidget); m_mainLayout->addWidget(m_rightContainer); setLayout(m_mainLayout); connect(m_mainTabBar, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); connect(m_mainTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(slotTabCloseRequested(int))); connect(m_mainTabBar, SIGNAL(tabMoved(int,int)), this, SLOT(slotTabMoved(int,int))); connect(m_pinnedTabBar, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); connect(m_pinnedTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(slotTabCloseRequested(int))); connect(m_pinnedTabBar, SIGNAL(tabMoved(int,int)), this, SLOT(slotTabMoved(int,int))); setAutoFillBackground(false); m_mainTabBar->setAutoFillBackground(false); m_pinnedTabBar->setAutoFillBackground(false); m_mainTabBar->installEventFilter(this); m_pinnedTabBar->installEventFilter(this); }
FxMixerView::FxMixerView() : QWidget(), ModelView( NULL, this ), SerializingObjectHook() { FxMixer * m = engine::fxMixer(); m->setHook( this ); //QPalette pal = palette(); //pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) ); //setPalette( pal ); setAutoFillBackground( true ); setWindowTitle( tr( "FX-Mixer" ) ); setWindowIcon( embed::getIconPixmap( "fx_mixer" ) ); // main-layout QHBoxLayout * ml = new QHBoxLayout; // Channel area m_channelAreaWidget = new QWidget; chLayout = new QHBoxLayout( m_channelAreaWidget ); chLayout->setSizeConstraint( QLayout::SetMinimumSize ); chLayout->setSpacing( 0 ); chLayout->setMargin( 0 ); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel m_racksWidget = new QWidget; m_racksLayout = new QStackedLayout( m_racksWidget ); m_racksLayout->setContentsMargins( 0, 0, 0, 0 ); m_racksWidget->setLayout( m_racksLayout ); // add master channel m_fxChannelViews.resize( m->numChannels() ); m_fxChannelViews[0] = new FxChannelView( this, this, 0 ); m_racksLayout->addWidget( m_fxChannelViews[0]->m_rackView ); FxChannelView * masterView = m_fxChannelViews[0]; ml->addWidget( masterView->m_fxLine, 0, Qt::AlignTop ); QSize fxLineSize = masterView->m_fxLine->size(); // add mixer channels for( int i = 1; i < m_fxChannelViews.size(); ++i ) { m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i); chLayout->addWidget( m_fxChannelViews[i]->m_fxLine ); } // add the scrolling section to the main layout // class solely for scroll area to pass key presses down class ChannelArea : public QScrollArea { public: ChannelArea( QWidget * parent, FxMixerView * mv ) : QScrollArea( parent ), m_mv( mv ) {} ~ChannelArea() {} virtual void keyPressEvent( QKeyEvent * e ) { m_mv->keyPressEvent( e ); } private: FxMixerView * m_mv; }; channelArea = new ChannelArea( this, this ); channelArea->setWidget( m_channelAreaWidget ); channelArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); channelArea->setFrameStyle( QFrame::NoFrame ); channelArea->setMinimumWidth( fxLineSize.width() * 6 ); channelArea->setFixedHeight( fxLineSize.height() + style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); ml->addWidget( channelArea, 1, Qt::AlignTop ); // show the add new effect channel button QPushButton * newChannelBtn = new QPushButton( embed::getIconPixmap( "new_channel" ), QString::null, this ); newChannelBtn->setObjectName( "newChannelBtn" ); newChannelBtn->setFixedSize( fxLineSize ); connect( newChannelBtn, SIGNAL( clicked() ), this, SLOT( addNewChannel() ) ); ml->addWidget( newChannelBtn, 0, Qt::AlignTop ); // add the stacked layout for the effect racks of fx channels ml->addWidget( m_racksWidget, 0, Qt::AlignTop | Qt::AlignRight ); setCurrentFxLine( m_fxChannelViews[0]->m_fxLine ); setLayout( ml ); updateGeometry(); // timer for updating faders connect( engine::mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateFaders() ) ); // add ourself to workspace QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); layout()->setSizeConstraint( QLayout::SetMinAndMaxSize ); subWin->layout()->setSizeConstraint( QLayout::SetMinAndMaxSize ); parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false ); parentWidget()->move( 5, 310 ); // we want to receive dataChanged-signals in order to update setModel( m ); }
caStripPlot::caStripPlot(QWidget *parent): QwtPlot(parent) { timerID = false; thisXaxisType = TimeScale; HISTORY = 60; thisUnits = Second; thisPeriod = 60; NumberOfCurves = MAXCURVES; onInit = true; timeInterval = 1.0; setAutoReplot(false); setAutoFillBackground(true); Start = true; // define a grid plotGrid = new QwtPlotGrid(); plotGrid->attach(this); plotLayout()->setAlignCanvasToScales(true); // define our axis if(thisXaxisType == TimeScale) { setAxisScale(QwtPlot::xBottom, 0, HISTORY); } else { setAxisScale(QwtPlot::xBottom, -HISTORY, 0); } setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom); setAxisScale(QwtPlot::yLeft, 0, 1000); if(thisXaxisType == TimeScale) { // due to time scale we need some distance scaleWidget = axisWidget(QwtPlot::xBottom); const int fmh = QFontMetrics(scaleWidget->font()).height(); scaleWidget->setMinBorderDist(fmh * 2, fmh * 2); // define time axis QTime timeNow= QTime::currentTime(); setAxisScaleDraw ( QwtPlot::xBottom, new TimeScaleDraw ( timeNow ) ); } // define our curves for(int i=0; i< MAXCURVES; i++) { curve[i] = new QwtPlotCurve(); errorcurve[i] = new QwtPlotIntervalCurve(); fillcurve[i] = new QwtPlotIntervalCurve(); if(i>0) { curve[i]->setZ(curve[i]->z() - i); fillcurve[i]->setZ(fillcurve[i]->z() - i); errorcurve[i]->setZ(errorcurve[i]->z() - i); } curve[i]->attach(this); errorcurve[i]->attach(this); fillcurve[i]->attach(this); showCurve(i, false); thisYaxisLimitsMax[i] = 100; thisYaxisLimitsMin[i] = 0; } // default colors and styles setTitlePlot(""); setTitleX(""); setTitleY(""); setBackground(Qt::black); setForeground(QColor(133, 190, 232)); setScaleColor(Qt::black); setGrid(true); setGridColor(Qt::gray); for(int i=0; i< MAXCURVES; i++) setStyle(Lines, i); setColor(Qt::white, 0); setColor(Qt::red, 1); setColor(Qt::yellow, 2); setColor(Qt::cyan, 3); setColor(Qt::magenta, 4); setColor(Qt::green, 5); setColor(Qt::blue, 6); setXaxisEnabled(true); setYaxisEnabled(true); setLegendEnabled(true); setAxisFont(QwtPlot::xBottom, QFont("Arial", 10)); setAxisFont(QwtPlot::yLeft, QFont("Arial", 10)); installEventFilter(this); // display timer Timer = new QTimer(this); Timer->setInterval(1000); connect(Timer, SIGNAL(timeout()), this, SLOT(TimeOut())); // data collection thread timerThread = new stripplotthread(); timerThread->start(); timerThread->threadSetTimer(100); timerThread->setPriority(QThread::HighPriority); connect(this, SIGNAL(timerThreadStop()), timerThread, SLOT(runStop())); connect(timerThread, SIGNAL(update()), this, SLOT(TimeOutThread()), Qt::DirectConnection); }
void RenderWidget::SetFillBackground(bool fill) { setAttribute(Qt::WA_OpaquePaintEvent, !fill); setAttribute(Qt::WA_NoSystemBackground, !fill); setAutoFillBackground(fill); }
OGLRender::OGLRender() : QGLWidget() { setFocusPolicy(Qt::ClickFocus); elementList = new QComboBox(); elementList->addItem("Резистор"); elementList->addItem("Диод"); elementList->addItem("ЭДС"); elementList->addItem("Провод"); elementList->addItem("Заземление"); elementList->addItem("Амперметр"); elementList->addItem("Вольтметр"); QVBoxLayout *g = new QVBoxLayout(this); elemPanel = new QVBoxLayout(); elemPanel->setAlignment(Qt::AlignRight|Qt::AlignTop); QHBoxLayout *resistancePanel = new QHBoxLayout(); QHBoxLayout *powerPanel = new QHBoxLayout(); resistanceLabel = new QLabel("Сопротивление(Ом)"); resistanceSpinBox = new QDoubleSpinBox(); powerLabel = new QLabel("Мощность(Вт)"); power = new QComboBox(); power->setView(new QListView()); power->setStyleSheet("QComboBox QAbstractItemView::item {width:60px; color: white;font-weight: 700;text-decoration: none;user-select: none;outline: none; background: rgb(45,45,45); QListView::item:selected {coloe:white;background: rgb(85,85,85);}"); power->addItem("0.125"); power->addItem("0.25"); power->addItem("0.5"); power->addItem("1.0"); voltagePanel = new QHBoxLayout(); voltageLabel = new QLabel("Напряжение(Вт)"); voltageSpinBox = new QDoubleSpinBox(); voltageSpinBox->setDecimals(4); voltagePanel->addWidget(voltageLabel); voltagePanel->addWidget(voltageSpinBox); elemPanel->addLayout(voltagePanel); resistanceSpinBox->setStyleSheet("QSpinBox {width:60px;color: white;font-weight: 700;text-decoration: none;user-select: none;outline: none;border: 2px solid;border-radius: 1px; background: rgb(45,45,45);} QSpinBox::up-arrow {image: url(C:/Users/amylniko/Documents/env/er/VizPROC-master/resource/spinbox_upbutton.png);} QSpinBox::up-button {image: url(C:/Users/amylniko/Documents/env/er/VizPROC-master/resource/spinbox_upbutton.png);}"); this->selectedEmf = NULL; this->selectedRes = NULL; resistancePanel->addWidget(resistanceLabel); resistancePanel->addWidget(resistanceSpinBox); powerPanel->addWidget(powerLabel); powerPanel->addWidget(power); QObject::connect(resistanceSpinBox,SIGNAL(editingFinished()),this,SLOT(editingElementFinished())); QObject::connect(voltageSpinBox,SIGNAL(editingFinished()),this,SLOT(editingElementFinished())); //QObject::connect(resistanceSpinBox,SIGNAL(valueChanged(double)),this,SLOT(valueChanged(double))); //QObject::connect(voltageSpinBox,SIGNAL(editingFinished()),this,SLOT(editingElementFinished())); elemPanel->addLayout(resistancePanel); elemPanel->addLayout(powerPanel); g->addLayout(elemPanel); g->setAlignment(elementList,Qt::AlignBottom); voltageLabel->setVisible(false); voltageSpinBox->setVisible(false); resistanceLabel->setVisible(false); resistanceSpinBox->setVisible(false); powerLabel->setVisible(false); power->setVisible(false); enableVisualisation = false; this->setLayout(g); setMouseTracking(true); setAutoFillBackground(false); this->error = false; this->errorText=""; this->renderLock = false; }
SkyView::SkyView(QWidget *parent) : QWidget(parent) { setBackgroundRole(QPalette::Base); setAutoFillBackground(true); }
void KardView::game() { co = 0; count = 0; tries = 0; emit signalChangeStatusbar(i18n("Tries: %1", tries), IDS_TRY); if (theme == "syllables") loadSyllables(); else if (theme != "colors") { loadPixmaps(); } m_listButtons.clear(); switch ( noc ) { case 4: n=2; m=2; break; case 8: n=2; m=4; break; case 12: n=3; m=4; break; default: case 16: n=4; m=4; break; case 20: n=5; m=4; break; case 24: n=4; m=6; break; } setAutoFillBackground(true); //create the GUI grid = new QGridLayout; grid->setSpacing(3); grid->setMargin(2); //create the cards for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { k[i][j]=new KardWidget(this, "wid"); grid->addWidget( k[i][j], i, j ); m_listButtons.append(k[i][j]); k[i][j]->m_kardW->setAutoFillBackground(true); k[i][j]->m_gray->setAutoFillBackground(true); k[i][j]->show(); } } setLayout(grid); /*QPalette pal; pal.setBrush( QPalette::Window, Qt::darkGray); setPalette(pal);*/ //choose the cards colors in random srand((unsigned int)time((time_t *)NULL)); int p= rand()%24; //p will be the first colour if (p%2==1) { p=(p+1)%24; //p must be even } //shuffle the cards for (int i=0; i<noc; i++) { t[i]=rand()%(noc); for (int j=0; j<i; j++) { if (t[i]==t[j]) i=i-1; } } int ni=0; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { shuffle[i][j]=(t[ni]+p)%24; QPalette pal; switch (KardSettings::kardTheme()) { case KardSettings::EnumKardTheme::colors: pal.setColor(QPalette::Active, QPalette::Window, QColor(a[shuffle[i][j]])); k[i][j]->m_kardW->setPalette(pal); break; case KardSettings::EnumKardTheme::house: k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]); k[i][j]->m_kardW->setScaledContents(true); break; case KardSettings::EnumKardTheme::opposites: k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]); k[i][j]->m_kardW->setScaledContents(true); break; case KardSettings::EnumKardTheme::syllables: k[i][j]->m_kardW->setText(text[shuffle[i][j]]); k[i][j]->m_kardW->setFont(QFont(KGlobalSettings::generalFont().family(), 44, QFont::Bold)); k[i][j]->m_kardW->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); k[i][j]->m_kardW->setScaledContents(true); break; case KardSettings::EnumKardTheme::animals: k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]); k[i][j]->m_kardW->setScaledContents(true); break; case KardSettings::EnumKardTheme::food: k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]); k[i][j]->m_kardW->setScaledContents(true); break; } ni++; } } //enable the connections slotConnect(); updateGeometry();//this is very important }
ValueEdit::ValueEdit( QWidget * parent ) : QWidget( parent ), typ( NifValue::tNone ), edit( 0 ) { setAutoFillBackground( true ); }
SymbolListWidget :: SymbolListWidget(QWidget *parent, int page) : QTableWidget(parent) { hide(); setAutoFillBackground( true ); QPalette pal( palette() ); pal.setColor( QPalette::Active, QPalette::HighlightedText, QColor("#FAFAFA") ); pal.setColor( QPalette::Inactive, QPalette::HighlightedText, QColor("#FAFAFA") ); pal.setColor( QPalette::Disabled, QPalette::HighlightedText, QColor("#FAFAFA") ); pal.setColor( QPalette::Active, QPalette::Base, QColor("#FAFAFA") ); pal.setColor( QPalette::Inactive, QPalette::Base, QColor("#FAFAFA") ); pal.setColor( QPalette::Disabled, QPalette::Base, QColor("#FAFAFA") ); setPalette( pal ); setItemDelegate(new IconDelegate(this)); QString icon_name; setShowGrid(true); verticalHeader()->hide(); horizontalHeader()->hide(); setIconSize ( QSize(32,32 )); setSelectionMode (QAbstractItemView::SingleSelection); setContextMenuPolicy(Qt::CustomContextMenu); menu = new QMenu( this ); addAct=new QAction(tr("Add to favorites"), this); remAct=new QAction(tr("Remove from favorites"), this); connect( this, SIGNAL( customContextMenuRequested( const QPoint & )), this, SLOT( customContentsMenu( const QPoint & ))); switch (page) { case 0: { setUpdatesEnabled(false); setColumnCount(4); setRowCount(57); for ( uint j = 0; j < 57; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); for ( uint i = 0; i <= 225; ++i ) { icon_name=":/symbols/img"+QString::number(i+1)+".png"; QTableWidgetItem* item= new QTableWidgetItem(); item->setIcon(QIcon(icon_name)); item->setText(code[i]+";"+QString::number(i)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); item->setToolTip(code[i]); setItem(i/4,i%4,item); } setUpdatesEnabled(true); menu->addAction(addAct); } break; case 1: { setColumnCount(4); setRowCount(17); for ( uint j = 0; j < 17; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); for ( uint i = 247; i <= 313; ++i ) { icon_name=":/symbols/img"+QString::number(i+1)+".png"; QTableWidgetItem* item= new QTableWidgetItem(); item->setIcon(QIcon(icon_name)); item->setText(code[i]+";"+QString::number(i)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); item->setToolTip(code[i]); setItem((i-247)/4,(i-247)%4,item); } menu->addAction(addAct); } break; case 2: { setColumnCount(4); setRowCount(15); for ( uint j = 0; j < 15; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); for ( uint i = 314; i <= 371; ++i ) { icon_name=":/symbols/img"+QString::number(i+1)+".png"; QTableWidgetItem* item= new QTableWidgetItem(); item->setIcon(QIcon(icon_name)); item->setText(code[i]+";"+QString::number(i)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); item->setToolTip(code[i]); setItem((i-314)/4,(i-314)%4,item); } menu->addAction(addAct); } break; case 3: { setColumnCount(4); setRowCount(6); for ( uint j = 0; j < 6; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); for ( uint i = 226; i <= 246; ++i ) { icon_name=":/symbols/img"+QString::number(i+1)+".png"; QTableWidgetItem* item= new QTableWidgetItem(); item->setIcon(QIcon(icon_name)); item->setText(code[i]+";"+QString::number(i)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); item->setToolTip(code[i]); setItem((i-226)/4,(i-226)%4,item); } menu->addAction(addAct); } break; case 4: { setColumnCount(4); setRowCount(10); for ( uint j = 0; j < 10; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); for ( uint i = 0; i <= 39; ++i ) { icon_name=":/symbols/img"+QString::number(i+1)+"greek.png"; QTableWidgetItem* item= new QTableWidgetItem(); item->setIcon(QIcon(icon_name)); item->setText(code[i+372]+";"+QString::number(i+372)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); item->setToolTip(code[i+372]); setItem(i/4,i%4,item); } menu->addAction(addAct); } break; case 5: { setColumnCount(4); setRowCount(3); for ( uint j = 0; j < 3; ++j ) setRowHeight(j,36); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); } break; case 6: { setColumnCount(4); setColumnWidth(0,36); setColumnWidth(1,36); setColumnWidth(2,36); setColumnWidth(3,36); menu->addAction(remAct); } break; show(); } }