コード例 #1
0
ファイル: main.cpp プロジェクト: japorito/crank--
int main(int argc, char* argv[])
{
  bool options [3] = {false, false, false}; //option flags. {human-readable, search, search by criteria}
  string filename = "", criteria = ""; //search criteria
  RankSystem ranksystem;

  if (!ranksystem.sysCheck()) {
    cout << "Failed to read the rank system from rank.conf.\n";
    return 0;
  }

  //Command line argument processing.
  for (int argument = 1; argument < argc; argument++) {
    if ((string) argv[argument] == "-i" 
	|| (string) argv[argument] == "--input") {
      if ((argument+1)<argc) {
	filename = argv[++argument];
      }
      else {helpText(); return 0;}
    }
    else if ((string) argv[argument] == "-h" 
	     || (string) argv[argument] == "--human-readable") {
      options[0] = true;
    }
    else if ((string) argv[argument] == "-s"
	     || (string) argv[argument] == "search") {
      options[1] = true;
    }
    else if ((string) argv[argument] == "-sc" 
	     || (string) argv[argument] == "--search-by-criteria") {
      if ((argument+1)<argc) {
	criteria = argv[++argument];
	options[2] = true;
      }
      else {helpText(); return 0;}
    }
    else {
      helpText();
      return 0;
    }
  }
  Rank rank(options, filename);

  rank.doRanks(ranksystem.getRankInfo());

  if (options[0] && !options[1] && !options[2]) humanOutput(rank.getRankees());
  if (!options[0] && !options[1] && !options[2]) defaultOutput(rank.getRankees());

  return 0;
}
コード例 #2
0
ファイル: game.cpp プロジェクト: clone2727/xoreos
bool Game::showMainMenu() {
	Graphics::Aurora::GUIQuad top("introscr_top" , 0.0f, 0.0f, kScreenWidth, kScreenHeight, 0.0f, 1.0f, 1.0f, 0.0f);
	Graphics::Aurora::GUIQuad bot("startupscrbot", 0.0f, 0.0f, kScreenWidth, kScreenHeight, 0.0f, 1.0f, 1.0f, 0.0f);

	top.setPosition(kTopScreenX   , kTopScreenY   , 0.0f);
	bot.setPosition(kBottomScreenX, kBottomScreenY, 0.0f);

	top.show();
	bot.show();


	Graphics::Aurora::TextureHandle buttonTexture = loadNCGR("main_pnl_off", "gui_main_pnl", 8, 2,
			"00", "01", "02", "03", "04", (const char *) 0, (const char *) 0, (const char *) 0,
			"10", "11", "12", "13", "14", "15", "16", "17");

	Graphics::Aurora::GUIQuad button(buttonTexture, 0.0f, 0.0f, 240.0f, 48.0f, 0.0f, 1.0f, 1.0f, 0.0f);

	button.setPosition(-120.0f, -120.0f, -1.0f);
	button.show();


	Graphics::Aurora::Text buttonText(_guiFont, TalkMan.getString(15860));

	float buttonX, buttonY, buttonZ;
	button.getPosition(buttonX, buttonY, buttonZ);

	const float buttonTextX = buttonX + ((button.getWidth()  - buttonText.getWidth())  / 2.0f);
	const float buttonTextY = buttonY + ((button.getHeight() - buttonText.getHeight()) / 2.0f);

	buttonText.setPosition(buttonTextX, buttonTextY, -2.0f);
	buttonText.show();


	Graphics::Aurora::Text helpText(_guiFont, TalkMan.getString(18707));

	const float helpTextX = kBottomScreenX + ((kScreenWidth - helpText.getWidth()) / 2.0f);
	const float helpTextY = kBottomScreenY;

	helpText.setPosition(helpTextX, helpTextY, -2.0f);
	helpText.show();


	GfxMan.unlockFrame();

	if (!waitClick())
		return false;

	GfxMan.lockFrame();
	helpText.hide();
	buttonText.hide();
	button.hide();
	top.hide();
	bot.hide();

	return true;
}
コード例 #3
0
void AccessibilitySVGElement::accessibilityText(Vector<AccessibilityText>& textOrder) const
{
    String description = accessibilityDescription();
    if (!description.isEmpty())
        textOrder.append(AccessibilityText(description, AccessibilityTextSource::Alternative));

    String helptext = helpText();
    if (!helptext.isEmpty())
        textOrder.append(AccessibilityText(helptext, AccessibilityTextSource::Help));
}
コード例 #4
0
void AccessibilityMediaControl::accessibilityText(Vector<AccessibilityText>& textOrder)
{
    String description = accessibilityDescription();
    if (!description.isEmpty())
        textOrder.append(AccessibilityText(description, AlternativeText));

    String title = this->title();
    if (!title.isEmpty())
        textOrder.append(AccessibilityText(title, AlternativeText));

    String helptext = helpText();
    if (!helptext.isEmpty())
        textOrder.append(AccessibilityText(helptext, HelpText));
}
コード例 #5
0
ファイル: game.cpp プロジェクト: Supermanu/xoreos
bool Game::showMainMenu() {
	Graphics::Aurora::GUIQuad top("introscr_top" , 0.0f, 0.0f, kScreenWidth, kScreenHeight, 0.0f, 1.0f, 1.0f, 0.0f);
	Graphics::Aurora::GUIQuad bot("startupscrbot", 0.0f, 0.0f, kScreenWidth, kScreenHeight, 0.0f, 1.0f, 1.0f, 0.0f);

	top.setPosition(kTopScreenX   , kTopScreenY   , 0.0f);
	bot.setPosition(kBottomScreenX, kBottomScreenY, 0.0f);

	top.show();
	bot.show();


	Graphics::Aurora::TextureHandle buttonTexture = loadNCGR("main_pnl_off", "gui_main_pnl", 8, 2,
			"00", "01", "02", "03", "04", (const char *) 0, (const char *) 0, (const char *) 0,
			"10", "11", "12", "13", "14", "15", "16", "17");

	Graphics::Aurora::GUIQuad button(buttonTexture, 0.0f, 0.0f, 240.0f, 48.0f, 0.0f, 1.0f, 1.0f, 0.0f);

	button.setPosition(-120.0f, -120.0f, -1.0f);
	button.show();


	Graphics::Aurora::Text buttonText(_guiFont, 240.0f, 48.0f, TalkMan.getString(15860), 1.0f, 1.0f, 1.0f, 1.0f,
	                                  Graphics::Aurora::kHAlignCenter, Graphics::Aurora::kVAlignMiddle);
	buttonText.setPosition(-120.0f, -120.0f, -2.0f);
	buttonText.show();


	Graphics::Aurora::Text helpText(_guiFont, kScreenWidth, kScreenHeight, TalkMan.getString(18707), 1.0f, 1.0f, 1.0f, 1.0f,
	                                Graphics::Aurora::kHAlignCenter, Graphics::Aurora::kVAlignBottom);
	helpText.setPosition(kBottomScreenX, kBottomScreenY, -2.0f);
	helpText.show();


	GfxMan.unlockFrame();

	if (!waitClick())
		return false;

	GfxMan.lockFrame();
	helpText.hide();
	buttonText.hide();
	button.hide();
	top.hide();
	bot.hide();

	return true;
}
コード例 #6
0
void KisShadeSelectorLine::paintEvent(QPaintEvent *)
{

    if (m_cachedColorSpace != m_parentProxy->colorSpace()) {
        m_realPixelCache = new KisPaintDevice(m_parentProxy->colorSpace());
        m_cachedColorSpace = m_parentProxy->colorSpace();
    }
    else {
        m_realPixelCache->clear();
    }

    int patchCount;
    int patchSpacing;

    if(m_gradient) {
        patchCount = width();
        patchSpacing = 0;
    }
    else {
        patchCount = m_patchCount;
        patchSpacing = 3;
    }
    qreal patchWidth = (width()-patchSpacing*patchCount)/qreal(patchCount);

    qreal hueStep=m_hueDelta/qreal(patchCount);
    qreal saturationStep=m_saturationDelta/qreal(patchCount);
    qreal valueStep=m_valueDelta/qreal(patchCount);

    qreal baseHue;
    qreal baseSaturation;
    qreal baseValue;
    m_parentProxy->converter()->
        getHsvF(m_realColor, &baseHue, &baseSaturation, &baseValue);

    int z=0;
    for(int i=-patchCount/2; i<=patchCount/2; i++) {
        if(i==0 && patchCount%2==0) continue;

        qreal hue = baseHue + (i * hueStep) + m_hueShift;
        while (hue < 0.0) hue += 1.0;
        while (hue > 1.0) hue -= 1.0;

        qreal saturation = qBound<qreal>(0., baseSaturation + (i * saturationStep) + m_saturationShift, 1.);
        qreal value = qBound<qreal>(0., baseValue + (i * valueStep) + m_valueShift, 1.);

        QRect patchRect(z * (patchWidth + patchSpacing), 0, patchWidth, m_lineHeight);
        KoColor patchColor = m_parentProxy->converter()->fromHsvF(hue, saturation, value);

        patchColor.convertTo(m_realPixelCache->colorSpace());
        m_realPixelCache->fill(patchRect, patchColor);

        z++;
    }

    QPainter wpainter(this);
    QImage renderedImage = m_parentProxy->converter()->toQImage(m_realPixelCache);
    wpainter.drawImage(0, 0, renderedImage);

    if(m_displayHelpText) {
        QString helpText(i18n("delta h=%1 s=%2 v=%3 shift h=%4 s=%5 v=%6",
                         m_hueDelta,
                         m_saturationDelta,
                         m_valueDelta,
                         m_hueShift,
                         m_saturationShift,
                         m_valueShift));
        wpainter.setPen(QColor(255,255,255));
        wpainter.drawText(rect(), helpText);
    }
}
コード例 #7
0
void QAbstractFormField::showHelpText()
{
	QMessageBox::information(widget(), tr("Help on the parameter '%1'").arg(fieldName()),
						tr("%1: %2").arg(fieldName()).arg(helpText()));
}
コード例 #8
0
ファイル: helptopic.cpp プロジェクト: mpharrigan/gromacs
void AbstractSimpleHelpTopic::writeHelp(const HelpWriterContext &context) const
{
    context.writeTextBlock(helpText());
}
コード例 #9
0
ファイル: helptopic.cpp プロジェクト: mpharrigan/gromacs
void AbstractCompositeHelpTopic::writeHelp(const HelpWriterContext &context) const
{
    context.writeTextBlock(helpText());
    writeSubTopicList(context, "\nAvailable subtopics:");
}
コード例 #10
0
void ImageImporter::initGUI() {
    m_ImageImporterLayout = new QVBoxLayout( this, 11, 6, "ImageImporterLayout");

    m_grpSource = new QGroupBox( this, "grpSource" );
    m_grpSource->setTitle( i18n( "Source" ) );
    m_grpSource->setColumnLayout(0, Qt::Vertical );
    m_grpSource->layout()->setSpacing( 6 );
    m_grpSource->layout()->setMargin( 11 );
    m_grpSourceLayout = new QGridLayout( m_grpSource->layout() );
    m_grpSourceLayout->setAlignment( Qt::AlignTop );


    m_cmbSourceDevice = new QComboBox( false, m_grpSource, "cmbSourceDevice" );
    m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceDevice, i18n( "Device:" ), m_grpSource, "lblDevice" ), 0, 0 );
    connect(m_cmbSourceDevice, SIGNAL(highlighted(const QString& )), SLOT(slotUpdateMountStatus()));
    //     m_cmbSourceDevice->setEditable( true );
    m_grpSourceLayout->addWidget( m_cmbSourceDevice, 0, 1 );
    QWhatsThis::add(m_cmbSourceDevice, i18n( "Here you can select a device which you can <i>mount</i> and then import your images from.<br>"
                                             "Mountpoints are only listed, if they are mountable by this user!" ));

    m_btnMountDevice = new QPushButton( m_grpSource, "btnMountDevice" );
    m_btnMountDevice->setText( i18n( "Mount" ) );
    //m_btnMountDevice->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, m_btnMountDevice->sizePolicy().hasHeightForWidth() ) );
    m_btnMountDevice->setToggleButton( TRUE );
    connect(m_btnMountDevice, SIGNAL(clicked()), SLOT(slotMountDevice()));
    m_grpSourceLayout->addWidget( m_btnMountDevice, 0, 2 );
    QWhatsThis::add(m_btnMountDevice, i18n( "Mounts/Unmounts the currently selected mountpoint." ));

    m_cmbSourceFolder = new QComboBox( m_grpSource, "txtSourceFolder" );
    m_cmbSourceFolder->setEditable(true);
    m_cmbSourceFolder->setDuplicatesEnabled( false );

    m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceFolder, i18n( "Folder:" ), m_grpSource, "lblFolder" ), 1, 0 );
    m_grpSourceLayout->addWidget( m_cmbSourceFolder, 1, 1 );
    QWhatsThis::add(m_cmbSourceFolder, i18n( "Enter the name of the folder, from where you want to import your Images." ));

    m_btnSourceFolder = new QPushButton( m_grpSource, "btnSourceFolder" );
    m_btnSourceFolder->setText( i18n( "..." ) );
    connect(m_btnSourceFolder, SIGNAL(clicked()), SLOT(slotBtnSourceFolder()));
    m_grpSourceLayout->addWidget( m_btnSourceFolder, 1, 2 );
    QWhatsThis::add(m_btnSourceFolder, i18n( "Select the import folder." ));

    QFrame* line = new QFrame( m_grpSource, "lineSource1" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 );

    m_txtSourceFilename = new QLineEdit( m_grpSource, "txtSourceFilename" );
    m_grpSourceLayout->addWidget( new QLabel(m_txtSourceFilename, i18n("Filename:"), m_grpSource, "lblSourceFilename" ), 3, 0 );
    m_grpSourceLayout->addMultiCellWidget( m_txtSourceFilename, 3, 3, 1, 2 );
    QWhatsThis::add(m_txtSourceFilename, i18n( "Contains a Regular Expression to match the files you want to import."
                                               "You can use captures here '()'. These will replace $0 and $1, $2, etc... "
                                               "in the output names." ));


    m_chkIgnoreCase = new QCheckBox("Ignore case", m_grpSource);
    m_grpSourceLayout->addWidget( m_chkIgnoreCase, 4, 1 );
    QWhatsThis::add( m_chkIgnoreCase, i18n( "Toggles, whether the filename-regexp should be matched case sensitive or not" ) );

    line = new QFrame( m_grpSource, "lineSource2" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 );
    m_grpSourceLayout->addMultiCellWidget( line, 5, 5, 0, 2 );

    m_chkSrcIncludeSubfolders = new QCheckBox( m_grpSource, "chkSrcIncludeSubfolders" );
    m_chkSrcIncludeSubfolders->setText( i18n( "Include subfolders" ) );
    m_chkSrcIncludeSubfolders->setChecked( true );
    m_grpSourceLayout->addMultiCellWidget( m_chkSrcIncludeSubfolders, 6, 6, 1, 2 );
    QWhatsThis::add(m_chkSrcIncludeSubfolders, i18n( "If you also want to import files placed in subfolders of the given basefolder, check this." ));

    m_chkSrcRemoveFilesFromSrc = new QCheckBox( m_grpSource, "chkSrcRemoveFilesFromSource" );
    m_chkSrcRemoveFilesFromSrc->setText( i18n( "Remove successfully transfered files from given source (i.e. move the files)" ) );
    m_chkSrcRemoveFilesFromSrc->setChecked( true );
    m_grpSourceLayout->addMultiCellWidget( m_chkSrcRemoveFilesFromSrc, 7, 7, 1, 2 );
    QWhatsThis::add(m_chkSrcRemoveFilesFromSrc, i18n( "If you want the imported images to be removed from the source, check this." ));

    m_ImageImporterLayout->addWidget( m_grpSource );

    m_ImageImporterLayout->addItem(new QSpacerItem( 40, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));


    m_groupArchive = new QGroupBox( this, "groupArchive" );
    m_groupArchive->setTitle( i18n( "Archive" ) );
    m_groupArchive->setCheckable( true );
    m_groupArchive->setColumnLayout(0, Qt::Vertical );
    m_groupArchive->layout()->setSpacing( 6 );
    m_groupArchive->layout()->setMargin( 11 );
    m_groupArchiveLayout = new QGridLayout( m_groupArchive->layout() );
    m_groupArchiveLayout->setAlignment( Qt::AlignTop );
    QWhatsThis::add( m_groupArchive, i18n( "If you want to create a copy of your original images (for security reasons), select this option." ) );

    m_txtArchiveBaseFolder = new QLineEdit( m_groupArchive, "txtArchiveBaseFolder" );
    connect(m_txtArchiveBaseFolder, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveBaseFolder, 0, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveBaseFolder, i18n( "Base Folder" ), m_groupArchive, "lblArchiveBaseFolder" ), 0, 0 );
    QPushButton* btn = new QPushButton(i18n( "..." ), m_groupArchive, "btnArhiveBaseFolder" );
    m_groupArchiveLayout->addWidget( btn, 0, 2 );
    connect(btn, SIGNAL(clicked()), this, SLOT(slotBtnArchiveBaseFolder()));
    QWhatsThis::add( m_txtArchiveBaseFolder, i18n( "This is the base folder, all your archived images will be copied to." ) );

    m_txtArchiveSubfolders = new QLineEdit( m_groupArchive, "txtArchiveSubfolders" );
    connect(m_txtArchiveSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveSubfolders, 1, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveSubfolders, i18n( "Subfolders" ), m_groupArchive, "blbArchiveSubfolders" ), 1, 0 );
    QWhatsThis::add(m_txtArchiveSubfolders, helpText("For every image a subfolder is created in the base folder."));

    m_txtArchiveFilename = new QLineEdit( m_groupArchive, "txtArchiveFilename" );
    connect(m_txtArchiveFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveFilename, 2, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveFilename, i18n( "File RegExp" ), m_groupArchive, "lblArchiveFilename" ), 2, 0 );
    QWhatsThis::add(m_txtArchiveFilename, helpText("This is the name of archived image in the subfolder."));

    m_chkArchiveLowercase = new QCheckBox( m_groupArchive, "chkArchiveLowercase" );
    m_chkArchiveLowercase->setText( i18n( "lowercase filenames" ) );
    m_chkArchiveLowercase->setChecked( true );
    m_groupArchiveLayout->addMultiCellWidget( m_chkArchiveLowercase, 3, 3, 1, 2 );
    QWhatsThis::add(m_chkArchiveLowercase, i18n( "Should your images be translated to lowercase finally?" ));


    line = new QFrame( m_groupArchive, "lineArchive" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_groupArchiveLayout->addMultiCellWidget( line, 4, 4, 0, 2 );

    m_groupArchiveLayout->addWidget( new QLabel(i18n( "Example" ), m_groupArchive, "lblArchiveExample" ), 5, 0 );

    m_lblArchiveExampleString = new KSqueezedTextLabel( m_groupArchive, "kSqueezedTextLabel1" );
    m_groupArchiveLayout->addMultiCellWidget( m_lblArchiveExampleString, 5, 5, 1, 2 );

    m_ImageImporterLayout->addWidget( m_groupArchive );

    m_groupDest = new QGroupBox( this, "groupDest" );
    m_groupDest->setTitle( i18n( "Destination" ) );
    m_groupDest->setCheckable( FALSE );
    m_groupDest->setColumnLayout(0, Qt::Vertical );
    m_groupDest->layout()->setSpacing( 6 );
    m_groupDest->layout()->setMargin( 11 );
    m_groupDestLayout = new QGridLayout( m_groupDest->layout() );
    m_groupDestLayout->setAlignment( Qt::AlignTop );

    m_cmbDestBasefolder = new QComboBox( m_groupDest, "txtDestBasefolder" );
//     m_cmbDestBasefolder->setEditable( true );
    m_cmbDestBasefolder->setDuplicatesEnabled( false );
    connect(m_cmbDestBasefolder, SIGNAL(highlighted(int)), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_cmbDestBasefolder, 0, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_cmbDestBasefolder, i18n( "Base Folder" ), m_groupDest, "lblDestBaseFolder" ), 0, 0 );
    btn = new QPushButton(i18n( "..." ), m_groupDest, "btnDestBaseFolder" );
    m_groupDestLayout->addWidget( btn, 0, 2 );
    //this is a temporary hack: it is intended, that someday the user can select an arbitrary folder to copy the images to,
    // which finally is added to the album. But currently the user only can select from folders here, which are already contained in
    // the album.
    btn->hide();
    connect(btn, SIGNAL(clicked()), SLOT(slotBtnDestBaseFolder()));


    m_txtDestSubfolders = new QLineEdit( m_groupDest, "txtDestSubfolders" );
    connect(m_txtDestSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_txtDestSubfolders, 1, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_txtDestSubfolders, i18n( "Subfolders" ), m_groupDest, "lblDestSubfolders" ), 1, 0 );
    QWhatsThis::add(m_txtDestSubfolders, helpText("Set the name of the subfolders of your images."));

    m_txtDestFilename = new QLineEdit( m_groupDest, "txtDestFilename" );
    connect(m_txtDestFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_txtDestFilename, 2, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_txtDestFilename, i18n( "Filename" ), m_groupDest, "lblDestFilename" ), 2, 0 );
    QWhatsThis::add(m_txtDestFilename, helpText("Set the name of your images."));

    m_chkDestLowercase = new QCheckBox( m_groupDest, "chkDestLowercase" );
    m_chkDestLowercase->setText( i18n( "lowercase filenames" ) );
    m_chkDestLowercase->setChecked( true );
    m_groupDestLayout->addMultiCellWidget( m_chkDestLowercase, 3, 3, 1, 2 );
    QWhatsThis::add(m_chkDestLowercase, i18n( "Should your images be translated to lowercase finally?" ));

    line = new QFrame( m_groupDest, "lineDest" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_groupDestLayout->addMultiCellWidget( line, 4, 4, 0, 2 );

    m_groupDestLayout->addWidget( new QLabel(i18n( "Example" ), m_groupDest, "lblDestExample" ), 5, 0 );

    m_lblDestExampleString = new KSqueezedTextLabel( m_groupDest, "lblDestExampleString" );
    m_groupDestLayout->addMultiCellWidget( m_lblDestExampleString, 5, 5, 1, 2 );

    m_ImageImporterLayout->addWidget( m_groupDest );



    QHBoxLayout* btnBottom = new QHBoxLayout( 0, 0, 6, "btnBottom");
    btnBottom->addItem(new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ));

    btn = new QPushButton(i18n( "Import" ), this, "import" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(slotImport()));

    btn = new QPushButton(i18n( "Quit" ), this, "quit" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(slotQuit()));

    btn = new QPushButton(i18n( "Cancel" ), this, "cancel" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(reject()));


    m_ImageImporterLayout->addLayout( btnBottom );

    resize( QSize(551, 519).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );
}
コード例 #11
0
void KisShadeSelectorLine::paintEvent(QPaintEvent *)
{
    m_pixelCache = QImage(width(), height(), QImage::Format_ARGB32_Premultiplied);
    QPainter painter(&m_pixelCache);
    painter.fillRect(0,0, width(), height(), m_backgroundColor);

    KisMinimalShadeSelector* parent = dynamic_cast<KisMinimalShadeSelector*>(parentWidget());

    const KoColorSpace* colorspace;
    if(parent)
        colorspace = parent->colorSpace();
    else
        colorspace = KoColorSpaceRegistry::instance()->rgb8();
    KoColor koColor(colorspace);

    int patchCount;
    int patchSpacing;

    if(m_gradient) {
        patchCount = width();
        patchSpacing = 0;
    }
    else {
        patchCount = m_patchCount;
        patchSpacing = 3;
    }
    qreal patchWidth = (width()-patchSpacing*patchCount)/qreal(patchCount);

    qreal hueStep=m_hueDelta/qreal(patchCount);
    qreal saturationStep=m_saturationDelta/qreal(patchCount);
    qreal valueStep=m_valueDelta/qreal(patchCount);

    int z=0;
    for(int i=-patchCount/2; i<=patchCount/2; i++) {
        if(i==0 && patchCount%2==0) continue;

        qreal hue=m_color.hueF()+(i*hueStep)+m_hueShift;
        while(hue<0) hue+=1.;
        while(hue>1) hue-=1.;

        qreal saturation = qBound<qreal>(0., m_color.saturationF()+(i*saturationStep)+m_saturationShift, 1.);

        qreal value = qBound<qreal>(0., m_color.valueF()+(i*valueStep)+m_valueShift, 1.);


        koColor.fromQColor(QColor::fromHsvF(hue, saturation, value));
        painter.fillRect(z*(patchWidth+patchSpacing)/*+1*/, 0, patchWidth, m_lineHeight, koColor.toQColor());
        z++;
    }

    QPainter wpainter(this);
    wpainter.drawImage(0,0, m_pixelCache);
    if(m_displayHelpText) {
        QString helpText(i18n("delta h=%1 s=%2 v=%3 shift h=%4 s=%5 v=%6",
                         m_hueDelta,
                         m_saturationDelta,
                         m_valueDelta,
                         m_hueShift,
                         m_saturationShift,
                         m_valueShift));
        wpainter.setPen(QColor(255,255,255));
        wpainter.drawText(rect(), helpText);
    }
}