예제 #1
0
void ImageView::slideShow()
{
  if (!slideshowTimer->isActive()) {
      slideshowTimer->start((int)(slideShowDelay * 1000));
      setButtonIcon(ui->slideShowButton, ":/images/buttons/pause.png", 48, 48);
    } else {
      slideshowTimer->stop();
      setButtonIcon(ui->slideShowButton, ":/images/buttons/play.png", 48, 48);
    }
}
예제 #2
0
void KNWindowsExtras::onActionPlayStateChanged(const bool &isPlay)
{
    //Save the state.
    m_isStatePlay=isPlay;
    //Set the icon according to the state.
    setButtonIcon(PlayAndPause, m_isStatePlay?m_pauseIcon:m_playIcon);
}
void ScripterPrefsGui::setColor()
{
	QPushButton* button = (QPushButton*) sender();

	QColor oldColor;
	if (button == textButton)    oldColor = syntaxColors->textColor;
	if (button == commentButton) oldColor = syntaxColors->commentColor;
 	if (button == keywordButton) oldColor = syntaxColors->keywordColor;
 	if (button == errorButton)   oldColor = syntaxColors->errorColor;
 	if (button == signButton)    oldColor = syntaxColors->signColor;
 	if (button == stringButton)  oldColor = syntaxColors->stringColor;
 	if (button == numberButton)  oldColor = syntaxColors->numberColor;

	QColor color = QColorDialog::getColor(oldColor, this);
	if (color.isValid())
	{
		setButtonIcon(button, color);

		if (button == textButton)    syntaxColors->textColor = color;
		if (button == commentButton) syntaxColors->commentColor = color;
 		if (button == keywordButton) syntaxColors->keywordColor = color;
 		if (button == errorButton)   syntaxColors->errorColor = color;
 		if (button == signButton)    syntaxColors->signColor = color;
 		if (button == stringButton)  syntaxColors->stringColor = color;
 		if (button == numberButton)  syntaxColors->numberColor = color;
	}
}
예제 #4
0
//--------------------------------------------------------------
void ofxMuiButton::init() {
    // super class init should have already been called in the constructor def list
    setObjectType("BUTTON");
    roundFrame = defaults->buttonRoundFrame;
    
    // override the superclass
    setBoxProperties(defaults->buttonBoxProperties);    
    buttonType = BUTTON_TYPE_TOGGLE;
    
    setButtonIcon(ICON_DEFAULT);
    
    setValue(false);

    // set default key binding
    keyBind_toggleValue(defaults->keyboardToggle);

    // custom, just for the button itself (i.e. no clicking on the label)
	setHitBox(0, 0, defaults->buttonWidth, defaults->buttonHeight);

//    label->setText(name);
//    label->enable();
    
  //  requestBoxLayout();
    
}
예제 #5
0
URIEditor::URIEditor(QWidget *parent, const char* name) : TLPEditor(parent,name){
  QString whatsthis =i18n("With this line edit you can insert the URI of the resource you want to reach");  
  setWhatsThis(whatsthis);
  setLabelText(" Uri  :");
  setButtonIcon("fileopen");
  setToolTip(i18n("Open the URI selector"));
    
  connect(m_pb, SIGNAL(clicked()), this, SLOT(openFileDialog()));
}
예제 #6
0
KGetLinkView::KGetLinkView(QWidget *parent)
    : KDialog(parent), m_linkImporter(0)
{
    setCaption(i18n("Import Links"));

    // proxy model to filter links
    m_proxyModel = new KGetSortFilterProxyModel();
    m_proxyModel->setDynamicSortFilter(true);
    m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);

    QWidget *widget = new QWidget(this);
    ui.setupUi(widget);

    // set the Icons
    ui.importLinks->setIcon(KIcon("document-import"));
    ui.showAll->setIcon(KIcon("view-list-icons"));
    ui.showArchives->setIcon(KIcon("package-x-generic"));
    ui.showAudio->setIcon(KIcon("audio-x-generic"));
    ui.showImages->setIcon(KIcon("image-x-generic"));
    ui.showVideos->setIcon(KIcon("video-x-generic"));

    // set the ids for the filterButtonGroup
    ui.filterButtonGroup->setId(ui.showAll, KGetSortFilterProxyModel::NoFilter);
    ui.filterButtonGroup->setId(ui.showArchives, KGetSortFilterProxyModel::CompressedFiles);
    ui.filterButtonGroup->setId(ui.showAudio, KGetSortFilterProxyModel::AudioFiles);
    ui.filterButtonGroup->setId(ui.showImages, KGetSortFilterProxyModel::ImageFiles);
    ui.filterButtonGroup->setId(ui.showVideos, KGetSortFilterProxyModel::VideoFiles);

    ui.treeView->setModel(m_proxyModel);
    ui.progressBar->hide();

    connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(uncheckItem(const QModelIndex &)));
    connect(ui.textFilter, SIGNAL(textChanged(QString)), SLOT(setTextFilter(QString)));
    connect(ui.filterMode, SIGNAL(currentIndexChanged(int)), m_proxyModel, SLOT(setFilterMode(int)));
    connect(ui.filterButtonGroup, SIGNAL(buttonClicked(int)), m_proxyModel, SLOT(setFilterType(int)));
    connect(ui.filterButtonGroup, SIGNAL(buttonClicked(int)), SLOT(updateSelectionButtons()));
    connect(ui.urlRequester, SIGNAL(textChanged(const QString &)), SLOT(updateImportButtonStatus(const QString &)));
    connect(ui.selectAll, SIGNAL(clicked()), this, SLOT(checkAll()));
    connect(ui.deselectAll, SIGNAL(clicked()), this, SLOT(uncheckAll()));
    connect(ui.checkSelected, SIGNAL(clicked()), this, SLOT(slotCheckSelected()));
    connect(ui.invertSelection, SIGNAL(clicked()), this, SLOT(slotInvertSelection()));
    connect(this, SIGNAL(okClicked()), this, SLOT(slotStartLeech()));
    connect(ui.showWebContent, SIGNAL(stateChanged(int)), m_proxyModel, SLOT(setShowWebContent(int)));
    connect(ui.importLinks, SIGNAL(clicked()), this, SLOT(slotStartImport()));
    connect(ui.treeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
            SLOT(selectionChanged()));

    setMainWidget(widget);
    setButtonText(KDialog::Ok, i18nc("Download the items which have been selected","&Download Checked"));
    setButtonIcon(KDialog::Ok, KIcon("kget"));

    checkClipboard();
}
예제 #7
0
RemoveDuplicates::RemoveDuplicates():KDialog()
{
    setWindowTitle(i18n("Remove Duplicates"));
    setWindowIcon(KIcon("nepomuk"));
    setButtons(User1 | Cancel);
    setButtonIcon(User1,KIcon("edit-delete"));
    setButtonText(User1,i18n("&Delete"));
    setMinimumSize(500,500);
    connect(this,SIGNAL(user1Clicked()),this,SLOT(slotDeleteDuplicates()));
    setUpGui();
    loadDuplicates();
}
void ScripterPrefsGui::setupSyntaxColors()
{
	SyntaxColors syntax;
	setButtonIcon(textButton   , syntax.textColor);
	setButtonIcon(commentButton, syntax.commentColor);
 	setButtonIcon(keywordButton, syntax.keywordColor);
 	setButtonIcon(errorButton  , syntax.errorColor);
 	setButtonIcon(signButton   , syntax.signColor);
 	setButtonIcon(stringButton ,syntax.stringColor);
 	setButtonIcon(numberButton , syntax.numberColor);
}
예제 #9
0
void ExportDialog::busy(bool busy)
{
    d->busy = busy;

    if (d->busy)
    {
        setButtonIcon(Apply,    QIcon::fromTheme("process-stop"));
        setButtonText(Apply,    i18n("&Abort"));
        setButtonToolTip(Apply, i18n("Abort the current conversion"));
    }
    else
    {
        setButtonIcon(Apply,    QIcon::fromTheme("system-run"));
        setButtonText(Apply,    i18n("Con&vert"));
        setButtonToolTip(Apply, i18n("Start converting the images using current settings."));
    }

    d->settingsBox->setEnabled(!d->busy);
    d->listView->listView()->viewport()->setEnabled(!d->busy);

    d->busy ? d->page->setCursor(Qt::WaitCursor)
            : d->page->unsetCursor();
}
void MusicLrcContainerForDesktop::creatToolBarWidget()
{
    m_toolBarWidget = new QWidget(this);
    m_toolBarWidget->setStyleSheet(MusicUIObject::MCustomStyle09);
    m_toolBarWidget->setGeometry((m_geometry.x() - TOOLBAR_WIDTH)/2, 0, TOOLBAR_WIDTH, TOOLBAR_HEIGHT);

    m_showMainWindow = new QPushButton(m_toolBarWidget);

    m_toolCloseButton = new QToolButton(m_toolBarWidget);
    m_toolCloseButton->setGeometry(290, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolCloseButton, SIGNAL(clicked()), SLOT(close()));

    m_toolWindowLockedButton = new QToolButton(m_toolBarWidget);
    m_toolWindowLockedButton->setGeometry(260, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolWindowLockedButton, SIGNAL(clicked()), SLOT(setWindowLockedChanged()));

    m_toolLrcBigerButton = new QToolButton(m_toolBarWidget);
    m_toolLrcBigerButton->setGeometry(200, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolLrcBigerButton, SIGNAL(clicked()), SLOT(setLrcBigerChanged()));

    m_toolLrcSmallerButton = new QToolButton(m_toolBarWidget);
    m_toolLrcSmallerButton->setGeometry(230, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolLrcSmallerButton, SIGNAL(clicked()), SLOT(setLrcSmallerChanged()));

    m_toolUpdateLrcButton = new QToolButton(m_toolBarWidget);
    m_toolUpdateLrcButton->setGeometry(170, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolUpdateLrcButton, SIGNAL(clicked()),  SIGNAL(theCurrentLrcUpdated()));

    m_toolSettingButton = new QToolButton(m_toolBarWidget);
    m_toolSettingButton->setGeometry(140, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolSettingButton, SIGNAL(clicked()), SLOT(currentLrcCustom()));

    m_toolPreSongButton = new QToolButton(m_toolBarWidget);
    m_toolPreSongButton->setGeometry(50, 0, 30, TOOLBAR_HEIGHT);
    m_toolNextSongButton = new QToolButton(m_toolBarWidget);
    m_toolNextSongButton->setGeometry(110, 0, 30, TOOLBAR_HEIGHT);
    m_toolPlayButton = new QToolButton(m_toolBarWidget);
    m_toolPlayButton->setGeometry(80, 0, 30, TOOLBAR_HEIGHT);
    connect(m_toolPreSongButton, SIGNAL(clicked()), m_supperClass, SLOT(musicPlayPrivious()));
    connect(m_toolNextSongButton, SIGNAL(clicked()), m_supperClass, SLOT(musicPlayNext()));
    connect(m_toolPlayButton, SIGNAL(clicked()), m_supperClass, SLOT(musicKey()));
    connect(m_showMainWindow, SIGNAL(clicked()), m_supperClass, SLOT(showNormal()));

    setButtonIcon();
    setButtonCursor();
    setButtonTips();
    m_toolBarWidget->hide();
}
예제 #11
0
/*
  Implement a slot to set the current text of the push button
  This is the slot used to recieve data updates from a QCaObject based class.
*/
void QEGenericButton::setGenericButtonText( const QString& text, QCaAlarmInfo& alarmInfo, QCaDateTime&, const unsigned int& variableIndex )
{
    // If not subscribing, or subscribing but update is not for the readback variable, then do nothing.
    //
    // Note, This will still be called even if not subscribing as there may be an initial sing shot read
    // to ensure we have valid information about the variable when it is time to do a write.
    //
    // Note, variableIndex = 0 = Primary readback variable, variableIndex = 1 = Alternate readback variable,
    // so an update for variable 1 is always OK, an update from variable 0 is OK as long as there is no variable 1
    if( !subscribe || ( variableIndex == 0 && !getSubstitutedVariableName( 1 ).isEmpty() ))
    {
        return;
    }

    // Signal a database value change to any Link widgets
    emitDbValueChanged( text );

    // Update the button state if required
    // Display checked if text matches what is written when checked
    if( updateOption == UPDATE_STATE )
    {
        setButtonState( !text.compare( clickCheckedText ) );
    }

    // Update the text if required
    if( updateOption == UPDATE_TEXT || updateOption == UPDATE_TEXT_AND_ICON )
    {
        setButtonText( text );
    }

    // Update the icon if required
    if( updateOption == UPDATE_ICON || updateOption == UPDATE_TEXT_AND_ICON )
    {
        QIcon icon;
        icon.addPixmap( getDataPixmap( text ) );
        setButtonIcon( icon );
    }

    // Invoke common alarm handling processing.
    processAlarmInfo( alarmInfo, variableIndex );
}
예제 #12
0
	RKBugzillaReportDialog (QWidget* parent, const QString& report_template) : KDialog (parent) {
		RK_TRACE (DIALOGS);

		RKBugzillaReportDialog::report_template = report_template;
		setCaption (i18n ("Reporting bugs in RKWard"));
		setButtons (KDialog::Ok | KDialog::Cancel);
		setButtonText (KDialog::Ok, i18n ("Report issue"));
		setButtonIcon (KDialog::Ok, KIcon ("tools-report-bug"));
		KVBox *vbox = new KVBox (this);
		setMainWidget (vbox);
		QLabel *label = new QLabel (i18n ("<p><b>Where should I report bugs or wishes?</b></p><p>Thank you for taking the time to help improve RKWard. To help us "
		                                  "handle your request, efficiently, please submit your bug reports or wishes in the "
		                                  "<a href=\"%1\">KDE bugtracking system</a>. Note that you need a user account for this, so that we will be able to contact you, "
		                                  "for follow-up questions. <b>If you do not have an account, please <a href=\"%2\">create one</a>, first.</b></p>"
		                                  "<p>In case this is not possible for some reason, refer to <a href=\"%3\">%3</a> for alternative ways of reporting issues.</p>",
		                         QString ("http://bugs.kde.org"), QString ("https://bugs.kde.org/createaccount.cgi"), QString ("http://rkward.kde.org/bugs/"))
		                          + i18n ("<p><b>What information should I provide, and how?</b></p>Clicking \"Report issue\" will take you to the "
		                                  "KDE bugtracking system. After logging in, some information will already be pre-filled into the report form. Please make sure "
		                                  "to fill in the missing bits - in English - where indicated, especially in the \"Comment\" field.</p>"), vbox);
		label->setWordWrap (true);
		label->setOpenExternalLinks (true);

		connect (this, SIGNAL (finished()), this, SLOT (deleteLater()));
	}
예제 #13
0
void KNWindowsExtras::onActionMuteStateChanged(const bool &isMute)
{
    setButtonIcon(Mute, isMute?m_muteOn:m_muteOff);
}
예제 #14
0
ImageView::ImageView(QWidget *parent) : QMainWindow(parent), ui(new Ui::ImageView)
{
  ui->setupUi(this);

  setWindowTitle("MicroLab ImgP");

  //! \brief connectActionToSlots
  //!
  connectActionToSlots();
  newSonWidgets();

  connect(ui->openDirAction, SIGNAL(triggered()), this, SLOT(openDir()));
  connect(ui->openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
  connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
  connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs()));
  connect(ui->actionExit_4, SIGNAL(triggered()), this, SLOT(close()));

  connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextImage()));
  connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(previousImage()));
  connect(ui->beginButton, SIGNAL(clicked()), this, SLOT(setBegin()));
  connect(ui->endButton, SIGNAL(clicked()), this, SLOT(setEnd()));
  connect(ui->slideShowButton, SIGNAL(clicked()), this, SLOT(slideShow()));
  connect(ui->slideShowDelaySlider, SIGNAL(valueChanged(int)), this, SLOT(setSlideShowDelay(int)));
  slideshowTimer = new QTimer(this);
  connect(slideshowTimer, SIGNAL(timeout()), this, SLOT(nextImage()));

  ui->imageNameLabel->setText(tr("Select a folder from the <b>file -> openDir</b> or <b>file->openFile</b> menu to view images or image.."));
  ui->openFileAction->setShortcut(tr("Ctrl+O"));
  setImage(":/images/Cover.jpg");

  ui->previousButton->setEnabled(false);
  ui->nextButton->setEnabled(false);
  ui->beginButton->setEnabled(false);
  ui->endButton->setEnabled(false);
  ui->slideShowButton->setEnabled(false);
  ui->slideShowDelaySlider->setEnabled(false);
  ui->slideShowDelayLabel->setEnabled(false);
  ui->slideShowDelaySlider->setValue(15);

  //! NOTICE HERE
  ui->actionOpen_Recent_Files->setEnabled(false);
  ui->actionSave->setEnabled(false);
  ui->actionSave_As->setEnabled(true);
  ui->actionLecel_Set->setEnabled(false); //! @warning  Bug

  setButtonIcon(ui->slideShowButton, ":/images/buttons/play.png", 48, 48);
  setButtonIcon(ui->nextButton, ":/images/buttons/next.png", 48, 48);
  setButtonIcon(ui->previousButton, ":/images/buttons/back.png", 48, 48);
  setButtonIcon(ui->beginButton, ":/images/buttons/rewind.png", 48, 48);
  setButtonIcon(ui->endButton, ":/images/buttons/fastfwd.png", 48, 48);

  setWindowTitle(tr("ImageView"));

  folderName = "";
  imageNumber = 0;
  totalImages = 0;
  slideShowDelay = 2.0;

  QLabel *label = new QLabel("<a href = http://yajunyang.cn>connect me...</a>", this);
  connect(label, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
  ui->statusBar->insertWidget(0, label);
}
예제 #15
0
DirOpener::DirOpener( Config *_config, Mode _mode, QWidget *parent, Qt::WFlags f )
    : KDialog( parent, f ),
    dialogAborted( false ),
    config( _config ),
    mode( _mode )
{
    setCaption( i18n("Add folder") );
    setWindowIcon( KIcon("folder") );

    if( mode == Convert )
    {
        setButtons( KDialog::User1 | KDialog::Cancel );
    }
    else if( mode == ReplayGain )
    {
        setButtons( KDialog::Ok | KDialog::Cancel );
    }

    setButtonText( KDialog::User1, i18n("Proceed") );
    setButtonIcon( KDialog::User1, KIcon("go-next") );

    const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height();

    connect( this, SIGNAL(user1Clicked()), this, SLOT(proceedClicked()) );
    connect( this, SIGNAL(okClicked()), this, SLOT(addClicked()) );

    page = DirOpenPage;

    QWidget *widget = new QWidget();
    QGridLayout *mainGrid = new QGridLayout( widget );
    QGridLayout *topGrid = new QGridLayout();
    mainGrid->addLayout( topGrid, 0, 0 );
    setMainWidget( widget );

    lSelector = new QLabel( i18n("1. Select directory"), widget );
    QFont font;
    font.setBold( true );
    lSelector->setFont( font );
    topGrid->addWidget( lSelector, 0, 0 );
    lOptions = new QLabel( i18n("2. Set conversion options"), widget );
    topGrid->addWidget( lOptions, 0, 1 );

    // draw a horizontal line
    QFrame *lineFrame = new QFrame( widget );
    lineFrame->setFrameShape( QFrame::HLine );
    lineFrame->setFrameShadow( QFrame::Sunken );
    mainGrid->addWidget( lineFrame, 1, 0 );

    if( mode == ReplayGain )
    {
        lSelector->hide();
        lOptions->hide();
        lineFrame->hide();
    }

    // Dir Opener Widget

    dirOpenerWidget = new QWidget( widget );
    mainGrid->addWidget( dirOpenerWidget, 2, 0 );

    QVBoxLayout *box = new QVBoxLayout( dirOpenerWidget );

    QHBoxLayout *directoryBox = new QHBoxLayout();
    box->addLayout( directoryBox );

    QLabel *labelFilter = new QLabel( i18n("Directory:"), dirOpenerWidget );
    directoryBox->addWidget( labelFilter );

    uDirectory = new KUrlRequester( KUrl("kfiledialog:///soundkonverter-add-media"), dirOpenerWidget );
    uDirectory->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
    directoryBox->addWidget( uDirectory );

    QLabel *labelDirectory = new QLabel( i18n("Only add selected file formats:"), dirOpenerWidget );
    box->addWidget( labelDirectory );

    QHBoxLayout *fileTypesBox = new QHBoxLayout();
    box->addLayout( fileTypesBox );

    QStringList codecList;
    fileTypes = new KListWidget( dirOpenerWidget );
    if( mode == Convert )
    {
        codecList = config->pluginLoader()->formatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) );
    }
    else if( mode == ReplayGain )
    {
        codecList = config->pluginLoader()->formatList( PluginLoader::ReplayGain, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) );
    }
    for( int i = 0; i < codecList.size(); i++ )
    {
        if( codecList.at(i) == "audio cd" ) continue;
        QListWidgetItem *newItem = new QListWidgetItem( codecList.at(i), fileTypes );
        newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable );
        newItem->setCheckState( Qt::Checked );
    }

    QVBoxLayout *fileTypesFormatsBox = new QVBoxLayout();
    fileTypesBox->addLayout( fileTypesFormatsBox );

    fileTypesFormatsBox->addWidget( fileTypes );
    QLabel *formatHelp = new QLabel( "<a href=\"format-help\">" + i18n("Are you missing some file formats?") + "</a>", this );
    connect( formatHelp, SIGNAL(linkActivated(const QString&)), this, SLOT(showHelp()) );
    fileTypesFormatsBox->addWidget( formatHelp );

    QVBoxLayout *fileTypesButtonsBox = new QVBoxLayout();
    fileTypesBox->addLayout( fileTypesButtonsBox );
    fileTypesButtonsBox->addStretch();

    pSelectAll = new KPushButton( KIcon("edit-select-all"), i18n("Select all"), dirOpenerWidget );
    fileTypesButtonsBox->addWidget( pSelectAll );
    connect( pSelectAll, SIGNAL(clicked()), this, SLOT(selectAllClicked()) );

    pSelectNone = new KPushButton( KIcon("application-x-zerosize"), i18n("Select none"), dirOpenerWidget );
    fileTypesButtonsBox->addWidget( pSelectNone );
    connect( pSelectNone, SIGNAL(clicked()), this, SLOT(selectNoneClicked()) );

    cRecursive = new QCheckBox( i18n("Recursive"), dirOpenerWidget );
    cRecursive->setChecked( true );
    cRecursive->setToolTip( i18n("If checked, files from subdirectories will be added, too.") );
    fileTypesButtonsBox->addWidget( cRecursive );

    fileTypesButtonsBox->addStretch();


    // Conversion Options Widget

    options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget );
    mainGrid->addWidget( options, 2, 0 );
    adjustSize();
    options->hide();


    const KUrl url = KFileDialog::getExistingDirectoryUrl( uDirectory->url(), this );
    if( !url.isEmpty() )
        uDirectory->setUrl( url );
    else
        dialogAborted = true;

        // Prevent the dialog from beeing too wide because of the directory history
    if( parent && width() > parent->width() )
        setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) );
    KSharedConfig::Ptr conf = KGlobal::config();
    KConfigGroup group = conf->group( "DirOpener" );
    restoreDialogSize( group );
}
예제 #16
0
void KNWindowsExtras::onActionLoopStateChanged(const int &loopState)
{
    setButtonIcon(LoopMode, m_loopStates[loopState]);
}
예제 #17
0
KBugReport::KBugReport( QWidget * _parent, bool modal, const KAboutData *aboutData )
  : KDialog( _parent ), d( new KBugReportPrivate(this) )
{
  setCaption( i18n("Submit Bug Report") );
  setButtons( Ok | Cancel );
  setModal(modal);

  // Use supplied aboutdata, otherwise the one from the active componentData
  // otherwise the KGlobal one. _activeInstance should neved be 0L in theory.
  d->m_aboutData = aboutData ? aboutData
      : (KGlobal::activeComponent().isValid() ? KGlobal::activeComponent().aboutData()
                                  : KGlobal::mainComponent().aboutData());
#ifndef EMSCRIPTEN
  d->m_process = 0;
#endif
  QWidget * parent = new QWidget(this);
  d->submitBugWeb = false;

  if ( d->m_aboutData->bugAddress() == QLatin1String("*****@*****.**") )
  {
    // This is a core KDE application -> redirect to the web form
    d->submitBugWeb = true;
    setButtonGuiItem( Cancel, KStandardGuiItem::close() );
  }

  QLabel * tmpLabel;
  QVBoxLayout * lay = new QVBoxLayout( parent);

  KTitleWidget *title = new KTitleWidget( this );
  title->setText(i18n( "Submit Bug Report" ) );
  title->setPixmap( KIcon( "tools-report-bug" ).pixmap( 32 ) );
  lay->addWidget( title );

  QGridLayout *glay = new QGridLayout();
  lay->addLayout(glay);

  int row = 0;

  if ( !d->submitBugWeb )
  {
    // From
    QString qwtstr = i18n( "Your email address. If incorrect, use the Configure Email button to change it" );
    tmpLabel = new QLabel( i18nc("Email sender address", "From:"), parent );
    glay->addWidget( tmpLabel, row,0 );
    tmpLabel->setWhatsThis(qwtstr );
    d->m_from = new QLabel( parent );
    glay->addWidget( d->m_from, row, 1 );
    d->m_from->setWhatsThis(qwtstr );


    // Configure email button
    d->m_configureEmail = new QPushButton( i18n("Configure Email..."),
                                        parent );
    connect( d->m_configureEmail, SIGNAL(clicked()), this,
             SLOT(_k_slotConfigureEmail()) );
    glay->addWidget( d->m_configureEmail, 0, 2, 3, 1, Qt::AlignTop|Qt::AlignRight );

    // To
    qwtstr = i18n( "The email address this bug report is sent to." );
    tmpLabel = new QLabel( i18nc("Email receiver address", "To:"), parent );
    glay->addWidget( tmpLabel, ++row,0 );
    tmpLabel->setWhatsThis(qwtstr );
    tmpLabel = new QLabel( d->m_aboutData->bugAddress(), parent );
    tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    glay->addWidget( tmpLabel, row, 1 );
    tmpLabel->setWhatsThis(qwtstr );

    setButtonGuiItem( Ok,  KGuiItem( i18n("&Send"), "mail-send", i18n( "Send bug report." ),
                    i18n( "Send this bug report to %1." ,  d->m_aboutData->bugAddress() ) ) );
    row++;
  }
  else
  {
    d->m_configureEmail = 0;
    d->m_from = 0;
  }

  // Program name
  QString qwtstr = i18n( "The application for which you wish to submit a bug report - if incorrect, please use the Report Bug menu item of the correct application" );
  tmpLabel = new QLabel( i18n("Application: "), parent );
  glay->addWidget( tmpLabel, row, 0 );
  tmpLabel->setWhatsThis(qwtstr );
  d->appcombo = new KComboBox( false, parent );
  d->appcombo->setWhatsThis(qwtstr );
  QStringList packageList;
  for (int c = 0; packages[c]; ++c)
    packageList << QString::fromLatin1(packages[c]);
  d->appcombo->addItems(packageList);
  connect(d->appcombo, SIGNAL(activated(int)), SLOT(_k_appChanged(int)));
  d->appname = d->m_aboutData
                                    ? d->m_aboutData->productName()
                                    : qApp->applicationName() ;
  glay->addWidget( d->appcombo, row, 1 );
  int index = 0;
  for (; index < d->appcombo->count(); index++) {
      if (d->appcombo->itemText(index) == d->appname) {
          break;
      }
  }
  if (index == d->appcombo->count()) { // not present
      d->appcombo->addItem(d->appname);
  }
  d->appcombo->setCurrentIndex(index);

  tmpLabel->setWhatsThis(qwtstr );

  // Version
  qwtstr = i18n( "The version of this application - please make sure that no newer version is available before sending a bug report" );
  tmpLabel = new QLabel( i18n("Version:"), parent );
  glay->addWidget( tmpLabel, ++row, 0 );
  tmpLabel->setWhatsThis(qwtstr );
  if (d->m_aboutData)
      d->m_strVersion = d->m_aboutData->version();
  else
      d->m_strVersion = i18n("no version set (programmer error)");
  d->kde_version = QString::fromLatin1( KDE_VERSION_STRING );
  d->kde_version += ", " + QString::fromLatin1( KDE_DISTRIBUTION_TEXT );
  if ( !d->submitBugWeb )
      d->m_strVersion += ' ' + d->kde_version;
  d->m_version = new QLabel( d->m_strVersion, parent );
  d->m_version->setTextInteractionFlags(Qt::TextBrowserInteraction);
  //glay->addWidget( d->m_version, row, 1 );
  glay->addWidget( d->m_version, row, 1, 1, 2 );
  d->m_version->setWhatsThis(qwtstr );

  tmpLabel = new QLabel(i18n("OS:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );

  struct utsname unameBuf;
  uname( &unameBuf );
  d->os = QString::fromLatin1( unameBuf.sysname ) +
          " (" + QString::fromLatin1( unameBuf.machine ) + ") "
          "release " + QString::fromLatin1( unameBuf.release );

  tmpLabel = new QLabel(d->os, parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  tmpLabel = new QLabel(i18n("Compiler:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );
  tmpLabel = new QLabel(QString::fromLatin1(KDE_COMPILER_VERSION), parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  if ( !d->submitBugWeb )
  {
    // Severity
    d->m_bgSeverity = new QGroupBox( i18n("Se&verity"), parent );
    static const char * const sevNames[5] = { "critical", "grave", "normal", "wishlist", "i18n" };
    const QString sevTexts[5] = { i18n("Critical"), i18n("Grave"), i18nc("normal severity","Normal"), i18n("Wishlist"), i18n("Translation") };
    QHBoxLayout *severityLayout=new QHBoxLayout(d->m_bgSeverity);
    for (int i = 0 ; i < 5 ; i++ )
    {
      // Store the severity string as the name
      QRadioButton *rb = new QRadioButton( sevTexts[i], d->m_bgSeverity);
      rb->setObjectName(sevNames[i] );
      d->severityButtons.append(rb);
      severityLayout->addWidget(rb);
      if (i==2) rb->setChecked(true); // default : "normal"
    }

    lay->addWidget( d->m_bgSeverity );

    // Subject
    QHBoxLayout * hlay = new QHBoxLayout();
    lay->addItem(hlay);
    tmpLabel = new QLabel( i18n("S&ubject: "), parent );
    hlay->addWidget( tmpLabel );
    d->m_subject = new KLineEdit( parent );
    d->m_subject->setClearButtonShown(true);
    d->m_subject->setFocus();
    tmpLabel->setBuddy( d->m_subject );
    hlay->addWidget( d->m_subject );

    QString text = i18n("Enter the text (in English if possible) that you wish to submit for the "
                        "bug report.\n"
                        "If you press \"Send\", a mail message will be sent to the maintainer of "
                        "this program.\n");
    QLabel * label = new QLabel( parent);

    label->setText( text );
    lay->addWidget( label );

    // The multiline-edit
    d->m_lineedit = new KTextEdit( parent);
    d->m_lineedit->setMinimumHeight( 180 ); // make it big
    d->m_lineedit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    d->m_lineedit->setLineWrapMode(QTextEdit::WidgetWidth);
    d->m_lineedit->setCheckSpellingEnabled(true);
    d->m_lineedit->setSpellCheckingLanguage("en");
    lay->addWidget( d->m_lineedit, 10 /*stretch*/ );

    d->_k_slotSetFrom();
  } else {
    // Point to the web form

    lay->addSpacing(10);
    QString text = i18n("<qt>To submit a bug report, click on the button below. This will open a web browser "
                        "window on <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> where you will find "
                        "a form to fill in. The information displayed above will be transferred to that server.</qt>");
    QLabel * label = new QLabel( text, parent);
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard );
    label->setWordWrap( true );
    lay->addWidget( label );
    lay->addSpacing(10);

    d->appcombo->setFocus();

    d->_k_updateUrl();

    setButtonText(Ok, i18n("&Launch Bug Report Wizard"));
    setButtonIcon(Ok, KIcon("tools-report-bug"));
  }
  parent->setMinimumHeight( parent->sizeHint().height() + 20 ); // WORKAROUND: prevent "cropped" kcombobox
  setMainWidget(parent);
}
예제 #18
0
KNWindowsExtras::KNWindowsExtras(QObject *parent) :
    KNPlatformExtras(parent),
    m_playIcon(QPixmap(":/platform/platforms/windows/play.png")),
    m_pauseIcon(QPixmap(":/platform/platforms/windows/pause.png")),
    m_muteOn(QPixmap(":/platform/platforms/windows/mute_on.png")),
    m_muteOff(QPixmap(":/platform/platforms/windows/mute.png")),
    m_thumbnailToolbar(new QWinThumbnailToolBar(this)),
    m_trayIcon(new QSystemTrayIcon(this)),
    m_trayIconMenu(new QMenu),
    m_mainWindow(nullptr),
    m_isStatePlay(true)
{
    //Initial the loop states.
    m_loopStates[ButtonNoRepeat]=
            QPixmap(":/platform/platforms/windows/loopmode_norepeat.png");
    m_loopStates[ButtonRepeat]=
            QPixmap(":/platform/platforms/windows/loopmode_repeatsingle.png");
    m_loopStates[ButtonRepeatAll]=
            QPixmap(":/platform/platforms/windows/loopmode_repeat.png");
    m_loopStates[ButtonShuffle]=
            QPixmap(":/platform/platforms/windows/loopmode_random.png");
    //Initial the buttons.
    for(int i=0; i<ThumbnailActionsCount; i++)
    {
        //Generate the button.
        m_thumbnailButtons[i]=new QWinThumbnailToolButton(m_thumbnailToolbar);
        //Add the button to toolbar.
        m_thumbnailToolbar->addButton(m_thumbnailButtons[i]);
    }
    //Connect signals.
    connect(m_thumbnailButtons[PlayPrev], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requirePlayPrev);
    connect(m_thumbnailButtons[PlayAndPause], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::onActionPlayAndPause);
    connect(m_thumbnailButtons[PlayNext], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requirePlayNext);
    connect(m_thumbnailButtons[VolumeUp], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requireVolumeUp);
    connect(m_thumbnailButtons[VolumeDown], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requireVolumeDown);
    connect(m_thumbnailButtons[Mute], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requireChangeMuteState);
    connect(m_thumbnailButtons[LoopMode], &QWinThumbnailToolButton::clicked,
            this, &KNWindowsExtras::requireChangeLoopState);
    //Set icon.
    setButtonIcon(PlayPrev,
                  QPixmap(":/platform/platforms/windows/previous.png"));
    setButtonIcon(PlayNext,
                  QPixmap(":/platform/platforms/windows/next.png"));
    setButtonIcon(VolumeUp,
                  QPixmap(":/platform/platforms/windows/volup.png"));
    setButtonIcon(VolumeDown,
                  QPixmap(":/platform/platforms/windows/voldown.png"));
    //Set default state button.
    onActionMuteStateChanged(false);
    onActionLoopStateChanged(ButtonNoRepeat);
    onActionPlayStateChanged(false);
    //Configure the tray icon.
    m_trayIcon->setToolTip(QApplication::applicationName());
    m_trayIcon->setIcon(QIcon("://icon/mu.png"));
    connect(m_trayIcon, &QSystemTrayIcon::activated,
                this, &KNWindowsExtras::onActionTrayIconActivate);
    //Configure the tray icon menu.
    m_trayIcon->setContextMenu(m_trayIconMenu);
    m_trayIcon->show();
    //Initial the tray icon menu actions.
    QSignalMapper *actionTriggerMapper=new QSignalMapper(this);
    connect(actionTriggerMapper,
            static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),
            this, &KNWindowsExtras::onActionTrayMenuActionTriggered);
    //Initial the tray icon actions.
    for(int i=0; i<TrayIconMenuActionCount; i++)
    {
        //Initial the action and add to the menu.
        m_trayIconActions[i]=new QAction(m_trayIconMenu);
        //Add action to menu.
        m_trayIconMenu->addAction(m_trayIconActions[i]);
        //Link the action to the mapper.
        connect(m_trayIconActions[i], SIGNAL(triggered(bool)),
                actionTriggerMapper, SLOT(map()));
        actionTriggerMapper->setMapping(m_trayIconActions[i], i);
    }
    //Link locale manager.
    knI18n->link(this, &KNWindowsExtras::retranslate);
    retranslate();
}