KarbonSmallStylePreview::KarbonSmallStylePreview(QWidget* parent)
        : QWidget(parent)
{
    setFont(KGlobalSettings::smallestReadableFont());

    /* Create widget layout */
    QHBoxLayout *layout = new QHBoxLayout(this);
    QLabel * strokeLabel = new QLabel(i18n("Stroke:"), this);
    strokeLabel->setMinimumHeight(FRAMEHEIGHT);
    m_strokeFrame = new KarbonStrokeStyleWidget(this);
    m_strokeFrame->setMinimumSize(QSize(FRAMEWIDTH, FRAMEHEIGHT));

    QLabel * fillLabel = new QLabel(i18n("Fill:"), this);
    fillLabel->setMinimumHeight(FRAMEHEIGHT);
    m_fillFrame = new KarbonFillStyleWidget(this);
    m_fillFrame->setMinimumSize(QSize(FRAMEWIDTH, FRAMEHEIGHT));

    layout->addWidget(strokeLabel);
    layout->addWidget(m_strokeFrame);
    layout->addWidget(fillLabel);
    layout->addWidget(m_fillFrame);
    layout->setContentsMargins(0, 0, 0, 0);

    setLayout(layout);

    connect(KoToolManager::instance(), SIGNAL(changedCanvas(const KoCanvasBase *)),
            this, SLOT(canvasChanged(const KoCanvasBase *)));
    connect(m_strokeFrame, SIGNAL(clicked()), this, SIGNAL(strokeApplied()));
    connect(m_fillFrame, SIGNAL(clicked()), this, SIGNAL(fillApplied()));
}
Пример #2
0
void CGraphicBuildingTile::display(QList<QString> _toDisplay)
{
    QDialog* infoDialog = new QDialog;//(dynamic_cast<QWidget*>(this->parent()));
    QVBoxLayout* newLayout = new QVBoxLayout();
    int q=0;
    QScrollArea* scrolArea = new QScrollArea(dynamic_cast<QWidget*>(this->parent()));
    for(int i=0;i<_toDisplay.count();i++)
    {   QLabel* newLabel = new QLabel(_toDisplay.at(i));
        newLabel->setFixedWidth(280);
        newLabel->setMinimumHeight(22);
        newLabel->setStyleSheet("border: 1px solid black");
        newLayout->addWidget(newLabel);
        q++;
    }
    QPalette pal;
    pal.setColor(QPalette::Background,QColor(230,200,167));
    infoDialog->setFixedWidth(330);
    infoDialog->setMinimumHeight(30+22*q);
    infoDialog->setLayout(newLayout);
    infoDialog->setAutoFillBackground(true);
    infoDialog->setPalette(pal);
    infoDialog->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
    scrolArea->setWidget(infoDialog);
    scrolArea->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
    scrolArea->setMaximumHeight(infoDialog->size().height()+2);
    scrolArea->setWindowTitle(QString("Info about"));
    scrolArea->show();
}
Пример #3
0
AudioPlayingDialog::AudioPlayingDialog(QWidget *parent,
                                       const QString &name):
        QDialog(parent)
{
    setModal(true);
    setWindowTitle(tr("Playing audio file"));

    QGridLayout *metagrid = new QGridLayout;
    setLayout(metagrid);
    QWidget *w = new QWidget(this);
    QHBoxLayout *wLayout = new QHBoxLayout;
    metagrid->addWidget(w, 0, 0);

    QLabel *label = new QLabel(tr("Playing audio file \"%1\"").arg(name), w );
    wLayout->addWidget(label);
    w->setLayout(wLayout);

    label->setMinimumHeight(80);


    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel);
    metagrid->addWidget(buttonBox, 1, 0);
    metagrid->setRowStretch(0, 10);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
Пример #4
0
KeyboardWidget::KeyboardWidget(int width, int height, QWidget *parent):
    FlashableWidget(width, height, parent)
{

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

}
Пример #5
0
void SupportPage::setupUi()
{
   QVBoxLayout * vb = new QVBoxLayout;

	QLabel * lblCaption = new QLabel(this);
	lblCaption->setMinimumHeight(30);
   lblCaption->setText("<h3><center>" + tr("Support & Help") + "</center></h3>");
   lblCaption->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   lblCaption->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d9ebfb, stop: 0.4 #a1d4fb,stop: 0.5 #a1d4fb, stop: 1.0 #d9ebfb); background-position: left top; border-style: solid; border-width: 1px; border-color: silver; border-radius: 3px; color: black;");

   vb->addWidget(lblCaption);
   
   QTabWidget * tab = new QTabWidget(this);
   SupportWidget * sup = new SupportWidget(this);
   HelpWidget * help = new HelpWidget(this);
   //VideoWidget * video = new VideoWidget(this);
   EulaWidget * eula = new EulaWidget(this);
   tab->addTab(sup, tr("Support"));
   //tab->addTab(video, tr("Video Tutorial"));
   tab->addTab(help, tr("Help"));
   tab->addTab(eula, tr("EULA"));
   vb->addWidget(tab);
   //vb->addStretch(1);
   setLayout(vb);
}
Пример #6
0
/**
* Adds the specified HintingLineEdit widgets to this view. A hinting line edit
* comes with a label and an algorithm's name. Headings are also shown.
* @param stages : The stages, pre-process, process or post-process, as a vector
* @param algNames : The algorithm names as a vector
* @param hints : The hints for each algorithm as a vector
*/
void QDataProcessorWidget::setGlobalOptions(
    const std::vector<std::string> &stages,
    const std::vector<std::string> &algNames,
    const std::vector<std::map<std::string, std::string>> &hints) {
  // Headers
  QLabel *stageHeader = new QLabel(QString::fromStdString("<b>Stage</b>"));
  QLabel *algorithmHeader =
      new QLabel(QString::fromStdString("<b>Algorithm</b>"));
  QLabel *optionsHeader =
      new QLabel(QString::fromStdString("<b>Global Options</b>"));
  stageHeader->setMinimumHeight(30);
  ui.processLayout->addWidget(stageHeader, 0, 0);
  ui.processLayout->addWidget(algorithmHeader, 0, 1);
  ui.processLayout->addWidget(optionsHeader, 0, 2);

  int rows = static_cast<int>(stages.size());

  for (int row = 0; row < rows; row++) {

    // The title
    QLabel *stageLabel =
        new QLabel(QString::fromStdString(stages.at(row)), this);
    stageLabel->setMinimumSize(100, 10);
    ui.processLayout->addWidget(stageLabel, row + 1, 0);
    // The name
    QLabel *nameLabel =
        new QLabel(QString::fromStdString(algNames.at(row)), this);
    ui.processLayout->addWidget(new HintingLineEdit(this, hints.at(row)),
                                row + 1, 2);
    // The content
    ui.processLayout->addWidget(nameLabel, row + 1, 1);
  }
}
Пример #7
0
// Create new label widget
QtWidgetObject* AtenTreeGuiDialog::addLabel(TreeGuiWidget* widget, QString text)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QLabel *label = new QLabel(this);
	qtwo->set(widget, label, text);
	label->setText(text);
	label->setEnabled(widget->enabled());
	label->setVisible(widget->visible());
	label->setMinimumHeight(WIDGETHEIGHT);
	label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	return qtwo;
}
Пример #8
0
void LyricWidget::setLyric(const QLyricList &lyric) {
    if (animWidget) delete animWidget;
    animWidget = new QWidget(this);
    animWidget->raise();
    ui->border->raise();
    QRect geo = this->geometry();
    animWidget->setMinimumWidth(geo.width());
    animWidget->setMaximumWidth(geo.width());
    animWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    QVBoxLayout *vbox = new QVBoxLayout(animWidget);
    vbox->setMargin(0);
    vbox->setSpacing(0);
    vbox->setContentsMargins(0, 0, 0, 0);
    animWidget->setLayout(vbox);

    labels.clear();
    curInd = 0;
    this->lyric = lyric;
    firstShowing = false;

    int widgetWidth = this->geometry().width();
    int accuHeight = 0;
    for (const QLyric& lyr : lyric) {
        QLabel *label = new QLabel(animWidget);
        QFont font("文泉驿微米黑", 11);
        font.setStyleStrategy(QFont::PreferAntialias);
        label->setFont(font);
        label->setText(QString("<font color='grey'>") +
                        lyr.lyric + QString("</font>"));
        label->setMaximumWidth(widgetWidth);
        label->setMaximumWidth(widgetWidth);
        label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        label->setWordWrap(true);
        labels.append(label);
        QRect fsize = label->fontMetrics().boundingRect(label->text());
        int height = (widgetWidth + fsize.width()) / widgetWidth * fsize.height() + 15;
        heights.append(height);
        label->setMinimumHeight(height);
        label->setMaximumHeight(height);
        accuHeight += height;

        animWidget->layout()->addWidget(label);
    }

    if (heights.size() > 0) {
        animWidget->setGeometry(0, this->geometry().height() / 2 + heights[0],
                                this->geometry().width(), accuHeight);
    }
    animWidget->show();
    ui->border->setText("");
}
Пример #9
0
void DetailWindow::blankKeyLabel(){
  deleteKeyLabels();
  QLabel* dummyLabel = new QLabel();
  QPalette pal = dummyLabel->palette();
  pal.setColor(backgroundRole(), Qt::black);
  dummyLabel->setPalette(pal);
  dummyLabel->setAutoFillBackground(true);
  dummyLabel->setMinimumHeight(20);
  dummyLabel->setMaximumHeight(30);
  dummyLabel->setToolTip(wrapToolTip(tr("Drag an audio file onto the window.")));
  ui->horizontalLayout_keyLabels->addWidget(dummyLabel);
  keyLabels.push_back(dummyLabel);
}
Пример #10
0
void DevSettings::addSection(const QString & string)
{
    QString str;
    str.append("<b>");
    str.append(string);
    str.append("</b>");
    QLabel *label = new QLabel(str);
    label->setAlignment(Qt::AlignHCenter/*Left*/ | Qt::AlignBottom);
    if(numWidgets_!=0)
        label->setMinimumHeight(40);
    layout_->addWidget(label, numWidgets_, 0, 1, 2);
    numWidgets_++;
}
Пример #11
0
QWidget* TKAction::createLayout(QWidget* parent, QWidget* children)
{
  QWidget* base = new QWidget(parent,"KTToolBarLayout");
  QLabel* textLabel = new QLabel(base,"text");
  textLabel->setMinimumHeight(1);
  QLabel* pixLabel = new QLabel(base,"pixmap");
  children->reparent(base,QPoint(0,0));
  children->setName("widget");
  QHBoxLayout* layout = new QHBoxLayout(base,0,3);
  layout->setResizeMode(QLayout::Minimum);
  layout->addWidget(textLabel);
  layout->addWidget(pixLabel);
  layout->addWidget(children,1);

  updateLayout(base);
  return base;
}
Пример #12
0
XmlWindow::XmlWindow(QWidget *parent) : QWidget(parent){

    QFont font;
    font.setFamily("Courier");
    font.setFixedPitch(true);
    font.setPointSize(11);
    font.setBold(true);

    setNulls();

    //Used to avoid loading simulation again when this caused the initial change
    during_update_of_schema = false;

    textEdit = new CodeEditor(this);
    textEdit->setFont(font);
    textEdit->setWordWrapMode( QTextOption::NoWrap );


    QLabel *aa = new QLabel(this);
    aa->setText("");
    aa->setMinimumHeight(37);
    aa->setMaximumHeight(37);
    toolBar = new QToolBar("File/edit", aa);//addToolBar(tr("File"));

    layout = new QVBoxLayout(this);
    layout->setContentsMargins(QMargins(0,0,0,0));
    layout->addWidget(aa);
    layout->addWidget(textEdit);
    this->setLayout(layout);

    highlighter = new XMLHighlighter(textEdit->document());

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
    //setUnifiedTitleAndToolBarOnMac(true);
}
Пример #13
0
ImageComposer::ImageComposer(ImageConnector *conn){
	/**
	 * Create a Qt Window for displaying images and transmitting user commands
	 */
	qRegisterMetaType<Movement>("Movement"); 	// Register Movement struct with Qt
	setFocusPolicy(Qt::ClickFocus);				// Setup window focus behavior
	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);	// Qt window size behavior
	QObject::connect(conn, SIGNAL(transmitImage(int *,Movement,int,int)), this, SLOT(loadImage(int *,Movement,int,int))); // Connect the image loading slots and signals
	QObject::connect(this, SIGNAL(transmitMovement(Movement)), conn, SLOT(receiveMovement(Movement)));	// Connect the user interaction slots and signals
	QObject::connect( qApp, SIGNAL(lastWindowClosed()), conn, SLOT(receiveDone()) ); // Connect the window close slots and signals

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

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

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

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

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

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

	updatePVM();	// Initial modelview update

	this->counter = 0;	// Frame count
	this->moved = true;	// Creation is movement...
	sendMovement();		// Tell Legion to create an image
}
Пример #14
0
void MimetypeViewer::addSearchIcon()
{
    QIcon searchIcon = QIcon::fromTheme("system-search");
    if (searchIcon.isNull())
        return;

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

    searchIconLabel->setPixmap(searchIcon.pixmap(QSize(20,20)));
    hBoxLayout->addWidget(searchIconLabel, 0, Qt::AlignRight | Qt::AlignVCenter);
}
Пример #15
0
QWidget * PrefsDialog::createLanguageForm(QFileInfoList & languages)
{
	QGroupBox * formGroupBox = new QGroupBox(tr("Language"));
    QVBoxLayout *layout = new QVBoxLayout();
	
	QComboBox* comboBox = new QComboBox(this);
    m_translatorListModel = new TranslatorListModel(languages, this);
	comboBox->setModel(m_translatorListModel);
	comboBox->setCurrentIndex(m_translatorListModel->findIndex(m_name));
	connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLanguage(int)));

	layout->addWidget(comboBox);	

	QLabel * ll = new QLabel();
	ll->setMinimumHeight(45);
	ll->setWordWrap(true);
	ll->setText(QObject::tr("Please note that a new language setting will not take effect "
		                    "until the next time you run Fritzing."));
	layout->addWidget(ll);

	formGroupBox->setLayout(layout);
	return formGroupBox;
}
Пример #16
0
void DetailWindow::analysisFinished(){
  QString error = analysisWatcher.result().errorMessage;
  if(error != ""){
    say(error);
    cleanUpAfterRun();
    return;
  }
  // Title bar
  TagLibMetadata md(filePath);
  QString shortName = md.getTitle();
  if(shortName == "")
    shortName = filePath.mid(filePath.lastIndexOf("/") + 1);
  this->setWindowTitle(GuiStrings::getInstance()->appName() + GuiStrings::getInstance()->delim() + tr("Detailed Analysis") + GuiStrings::getInstance()->delim() + shortName);
  // full chromagram
  chromagramImage = imageFromChromagram(analysisWatcher.result().core.fullChromagram);
  ui->chromagramLabel->setPixmap(QPixmap::fromImage(chromagramImage));
  ui->chromagramLabel->setMinimumHeight(analysisWatcher.result().core.fullChromagram.getBins()+2);
  ui->chromagramLabel->setMinimumWidth(analysisWatcher.result().core.fullChromagram.getHops()+2);
  // one octave chromagram
  miniChromagramImage = imageFromChromagram(analysisWatcher.result().core.oneOctaveChromagram);
  ui->miniChromagramLabel->setPixmap(QPixmap::fromImage(miniChromagramImage));
  //: A tooltip on the Detail window
  ui->miniChromagramLabel->setToolTip(wrapToolTip(tr("This is the same chromagram data, reduced to a single octave.")));
  // harmonic change signal
  int rateOfChangePrecision = 100;
  int size = (signed)analysisWatcher.result().core.harmonicChangeSignal.size();
  harmonicChangeImage = QImage(size*chromaScaleH,rateOfChangePrecision,QImage::Format_Indexed8);
  prefs.setImageColours(harmonicChangeImage,ui->chromaColourCombo->currentIndex());
  for(int h=0; h<size; h++){
    int value = analysisWatcher.result().core.harmonicChangeSignal[h] * rateOfChangePrecision;
    for(int y=0; y<rateOfChangePrecision; y++)
      for(int x=0; x<chromaScaleH; x++)
        harmonicChangeImage.setPixel(h*chromaScaleH+x, y, (rateOfChangePrecision - y > value ? 0 : 50));
  }
  ui->harmonicChangeLabel->setPixmap(QPixmap::fromImage(harmonicChangeImage));
  // Tooltip
  if(prefs.getSegmentation() == 'n'){
    //: A tooltip on the Detail window
    ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("You are not using segmentation, so there is no harmonic change data to display.")));
  }else if(prefs.getSegmentation() == 'a'){
    //: A tooltip on the Detail window
    ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("You are using arbitrary segmentation, so there is no harmonic change data to display.")));
  }else{
    //: A tooltip on the Detail window
    ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("This is the level of harmonic change detected in the chromagram over time. Peaks in this signal are used to segment the chromagram.")));
  }
  // Key estimates
  deleteKeyLabels();
  int lastChange = -1; // enable correct stretch policy for first segment
  for(int h = 0; h < (signed)analysisWatcher.result().core.segments.size(); h++){
    QLabel* newLabel = new QLabel(prefs.getKeyCode(analysisWatcher.result().core.segments[h].key));
    newLabel->setAlignment(Qt::AlignCenter);
    QPalette pal = newLabel->palette();
    pal.setColor(backgroundRole(), prefs.getKeyColour(analysisWatcher.result().core.segments[h].key));
    newLabel->setPalette(pal);
    newLabel->setFrameStyle(1);
    newLabel->setAutoFillBackground(true);
    newLabel->setMinimumHeight(20);
    newLabel->setMaximumHeight(30);
    if(prefs.getSegmentation() == 'n'){
      //: A tooltip on the Detail window
      newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimate for the unsegmented chromagram.")));
    }else if(prefs.getSegmentation() == 'a'){
      //: A tooltip on the Detail window
      newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimates for the arbitrary segments.")));
    }else{
      //: A tooltip on the Detail window
      newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimates for the segments between peak harmonic changes.")));
    }
    ui->horizontalLayout_keyLabels->addWidget(newLabel, h - lastChange);
    keyLabels.push_back(newLabel);
    lastChange = h;
  }
  //: Text in the Batch window status bar; includes a key code at %1
  say(tr("Key estimate: %1").arg(prefs.getKeyCode(analysisWatcher.result().core.globalKeyEstimate)));
  cleanUpAfterRun();
}
Пример #17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),font("Times",22),pause(true),secondsLeft(60)
{
    ui->setupUi(this);
    QScroller::grabGesture(ui->scrollArea->viewport(), QScroller::LeftMouseButtonGesture );

    timer = new QTimer(this);
    timer->setInterval(1000);
    connect(timer,SIGNAL(timeout()),this,SLOT(minusSecond()));
    connect(this,SIGNAL(timeIsLeft()),this,SLOT(handleMafiaAgreement()));
    QStringList avaibleRoles;
    avaibleRoles.push_back("");
    avaibleRoles.push_back("Citizen");
    avaibleRoles.push_back("Sherif");
    avaibleRoles.push_back("Don");
    avaibleRoles.push_back("Mafia");

    QStringList avaibleForVote;
    avaibleForVote.push_back(NOBODY);
    for (int i=1;i<=10;i++)
        avaibleForVote.push_back(QString("%1").arg(i));

    QList<QComboBox*> rolesComboBoxes;
    QList<QComboBox*> votesComboBoxes;
    for (int i=0;i<10;i++)
    {
        rolesComboBoxes.push_back(new QComboBox(this));
        rolesComboBoxes.back()->setMinimumHeight(MIN_HEIGHT);
        rolesComboBoxes.back()->setMinimumWidth(MIN_COMBOBOX_WIDTH);
        rolesComboBoxes.back()->addItems(avaibleRoles);
        rolesComboBoxes.back()->setFont(font);

        votesComboBoxes.push_back(new QComboBox(this));
        votesComboBoxes.back()->setMinimumHeight(MIN_HEIGHT);
        votesComboBoxes.back()->setMinimumWidth(MIN_COMBOBOX_WIDTH);
        votesComboBoxes.back()->addItems(avaibleForVote);
        votesComboBoxes.back()->setFont(font);
        votesComboBoxes.back()->setStyleSheet("alignment: right;");
        for (int j=0;j<10;j++)
            votesComboBoxes.back()->setItemData(j,Qt::AlignHCenter, Qt::TextAlignmentRole);


        warningButtons.push_back(new WarningButton);
        warningButtons.back()->setMinimumHeight(MIN_HEIGHT);
        warningButtons.back()->setMinimumWidth(MIN_WARNING_BUTTON_WIDTH);
        warningButtons.back()->setFont(font);

        names.push_back(new QLineEdit(this));
        names.back()->setMinimumHeight(MIN_HEIGHT);
        names.back()->setFont(font);

        players.push_back(new Player(rolesComboBoxes.back(),votesComboBoxes.back(),names.back(),warningButtons.back(), i + 1));

        ui->verticalLayout->addWidget(names.back());
        ui->verticalLayout_2->addWidget(rolesComboBoxes.back());
        ui->verticalLayout_3->addWidget(votesComboBoxes.back());
        ui->verticalLayout_4->addWidget(warningButtons.back());
    }
    currentSpeaker = players.begin();


    for (int i = 0; i < players.size(); i++)
    {
        connect(warningButtons[i],SIGNAL(scored4warnings()),players[i],SLOT(die()));
    }

    for (int i = 0; i < names.size() - 1; i++)
        connect(names[i],SIGNAL(returnPressed()),names[i+1],SLOT(setFocus()));

    wasRevoting = false;
    roleBoxController = new RoleBoxController(rolesComboBoxes,players,this);
    voteBoxController = new VoteBoxController(votesComboBoxes,players,this);
    QTime Ti; Ti=QTime::currentTime();
    QDate D; D=QDate::currentDate();
    //QString path = D.toString().append("_").append(Ti.toString()).append(".txt");
    QString path = "log.txt";
    logger            = new Logger(path,players,this);
    for (int i = 1; i <= 10; i++)
    {
        QLabel* label = new QLabel(QString("<html><head/><body><p><span style=\" font-size:22pt;\">%1</span></p>").arg(i));
        ui->verticalLayout_6->addWidget(label);
        label->setMinimumHeight(MIN_HEIGHT);
    }
    ui->pushButton_11->setMinimumHeight(MIN_HEIGHT);
    ui->pushButton_15->setMinimumHeight(MIN_HEIGHT);

    connect(roleBoxController,SIGNAL(rolesAreDefined()),this,SLOT(rolesAreDefined()));
    voteBoxController->setEnabled(false);
    ui->pushButton_15->setEnabled(false);
    ui->pushButton_11->setEnabled(false);
}
void Kleo::CryptoConfigModule::init( Layout layout ) {
  Kleo::CryptoConfig * const config = mConfig;
  const KPageView::FaceType type=determineJanusFace( config, layout );
  setFaceType(type);
  QVBoxLayout * vlay = 0;
  QWidget * vbox = 0;
  if ( type == Plain ) {
    vbox = new QWidget(this);
    vlay = new QVBoxLayout( vbox );
    vlay->setSpacing( KDialog::spacingHint() );
    vlay->setMargin( 0 );
    addPage( vbox, i18n("GpgConf Error") );
  }

  const QStringList components = config->componentList();
  for ( QStringList::const_iterator it = components.begin(); it != components.end(); ++it ) {
    //kDebug(5150) <<"Component" << (*it).toLocal8Bit() <<":";
    Kleo::CryptoConfigComponent* comp = config->component( *it );
    Q_ASSERT( comp );
    if ( comp->groupList().empty() )
      continue;
    if ( type != Plain ) {
      vbox = new QWidget(this);
      vlay = new QVBoxLayout( vbox );
      vlay->setSpacing( KDialog::spacingHint() );
      vlay->setMargin( 0 );
      KPageWidgetItem *pageItem = new KPageWidgetItem( vbox, comp->description() );
      if ( type != Tabbed )
          pageItem->setIcon( loadIcon( comp->iconName() ) );
      addPage(pageItem);
    }

    QScrollArea* scrollArea = type == Tabbed ? new QScrollArea( this ) : new ScrollArea( this );
    scrollArea->setWidgetResizable( true );

    vlay->addWidget( scrollArea );

    CryptoConfigComponentGUI* compGUI =
      new CryptoConfigComponentGUI( this, comp, scrollArea );
    compGUI->setObjectName( *it );
    scrollArea->setWidget( compGUI );
    scrollArea->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
    // KJanusWidget doesn't seem to have iterators, so we store a copy...
    mComponentGUIs.append( compGUI );

    // Set a nice startup size
    const int deskHeight = QApplication::desktop()->height();
    int dialogHeight;
    if (deskHeight > 1000) // very big desktop ?
      dialogHeight = 800;
    else if (deskHeight > 650) // big desktop ?
      dialogHeight = 500;
    else // small (800x600, 640x480) desktop
      dialogHeight = 400;
    assert( scrollArea->widget() );
    if ( type != Tabbed )
        scrollArea->setMinimumHeight( qMin( compGUI->sizeHint().height(), dialogHeight ) );
  }
  if ( mComponentGUIs.empty() ) {
      const QString msg = i18n("The gpgconf tool used to provide the information "
                               "for this dialog does not seem to be installed "
                               "properly. It did not return any components. "
                               "Try running \"%1\" on the command line for more "
                               "information.",
                               components.empty() ? "gpgconf --list-components" : "gpgconf --list-options gpg" );
      QLabel * label = new QLabel( msg, vbox );
      label->setWordWrap( true);
      label->setMinimumHeight( fontMetrics().lineSpacing() * 5 );
      vlay->addWidget( label );
  }
}
Пример #19
0
MapViewer::MapViewer(QWidget *parent) :
    QWidget(parent)
{
    // setup layout
    QHBoxLayout *mainLayout = new QHBoxLayout;

    // create viewport
    m_viewport = new Viewport;
    m_viewport->setFixedSize(800,480);
    mainLayout->addWidget(m_viewport);

    // vertical line
    QFrame * divViewportAndPanel = new QFrame;
    divViewportAndPanel->setFrameShape(QFrame::VLine);
    divViewportAndPanel->setFrameShadow(QFrame::Sunken);
    mainLayout->addWidget(divViewportAndPanel);

    // setup side panel
    QVBoxLayout *sideLayout = new QVBoxLayout;

        // map directory line edit
        m_mapLabel = new QLabel("Map Directory:");
        m_mapLine = new QLineEdit;
        m_mapButton = new QPushButton("Browse");
        QHBoxLayout *mapLocateBox = new QHBoxLayout;
        mapLocateBox->addWidget(m_mapLine);
        mapLocateBox->addWidget(m_mapButton);
        sideLayout->addWidget(m_mapLabel);
        sideLayout->addLayout(mapLocateBox);

        // style file line edit
        m_styleLabel = new QLabel("Style File:");
        m_styleLine = new QLineEdit;
        m_styleButton = new QPushButton("Browse");
        QHBoxLayout *styleLocateBox = new QHBoxLayout;
        styleLocateBox->addWidget(m_styleLine);
        styleLocateBox->addWidget(m_styleButton);
        sideLayout->addWidget(m_styleLabel);
        sideLayout->addLayout(styleLocateBox);

        // horizontal line
        QFrame * divLoadButtonTop = new QFrame;
        divLoadButtonTop->setFrameShape(QFrame::HLine);
        divLoadButtonTop->setFrameShadow(QFrame::Sunken);
        sideLayout->addWidget(divLoadButtonTop);

        // camera settings
        m_camLatLabel = new QLabel("Latitude:");
        m_camLonLabel = new QLabel("Longitude:");
        m_camAltLabel = new QLabel("Altitude:");
        m_camLatLine = new QLineEdit;
        m_camLonLine = new QLineEdit;
        m_camAltLine = new QLineEdit;
        sideLayout->addWidget(m_camLatLabel);
        sideLayout->addWidget(m_camLatLine);
        sideLayout->addWidget(m_camLonLabel);
        sideLayout->addWidget(m_camLonLine);
        sideLayout->addWidget(m_camAltLabel);
        sideLayout->addWidget(m_camAltLine);

        QDoubleValidator * latValidator = new QDoubleValidator;
        latValidator->setRange(-90.0,90.0,7);
        m_camLatLine->setValidator(latValidator);

        QDoubleValidator * lonValidator = new QDoubleValidator;
        lonValidator->setRange(-180.0,180.0,7);
        m_camLonLine->setValidator(lonValidator);

        QDoubleValidator * altValidator = new QDoubleValidator;
        altValidator->setRange(10.0,10000.0,7);
        m_camAltLine->setValidator(altValidator);

        // horizontal line
        QFrame * divLoadButtonBtm = new QFrame;
        divLoadButtonBtm->setFrameShape(QFrame::HLine);
        divLoadButtonBtm->setFrameShadow(QFrame::Sunken);
        sideLayout->addWidget(divLoadButtonBtm);

        QHBoxLayout * buttonLayout = new QHBoxLayout;
        m_loadButton = new QPushButton("Load Map");
        m_camButton = new QPushButton("Set Camera Position");
        buttonLayout->addWidget(m_loadButton);
        buttonLayout->addWidget(m_camButton);
        sideLayout->addLayout(buttonLayout);

        // horizontal line
        QFrame * divButtonLayoutBtm = new QFrame;
        divButtonLayoutBtm->setFrameShape(QFrame::HLine);
        divButtonLayoutBtm->setFrameShadow(QFrame::Sunken);
        sideLayout->addWidget(divButtonLayoutBtm);

        m_camRotate = new QRadioButton("Rotate");
        m_camRotate->setChecked(true);
        m_camPan = new QRadioButton("Pan");
        m_camZoom = new QRadioButton("Zoom");

//        sideLayout->addWidget(m_camRotate);
//        sideLayout->addWidget(m_camPan);
//        sideLayout->addWidget(m_camZoom);

        QLabel * usageNotes = new QLabel;
        usageNotes->setWordWrap(true);
        usageNotes->setAlignment(Qt::AlignTop);
        usageNotes->setMinimumHeight(140);
        usageNotes->setText("Select a directory containing valid "
                            "map data and choose a style file. Then "
                            "click on the Load Map button to load "
                            "the map into the viewport. Use the mouse "
                            "to rotate, zoom and pan the view. The "
                            "camera's position can be manually "
                            "specified by entering the desired "
                            "latitude, longitude and altitude in "
                            "the boxes above, and then pressing "
                            "the Set Camera Position button.");
        sideLayout->addWidget(usageNotes);

    mainLayout->addLayout(sideLayout);

    // debug
    m_mapLine->setText("?");
    m_styleLine->setText("/home/preet/Dev/projects/libosmscout-render/res/styles/debug.json");

    // set size
    this->setFixedSize(800+300,480+24);

    // set layout
    this->setLayout(mainLayout);

    // set title
    this->setWindowTitle("libosmscout-render mapviewer");

    // setup connections
    connect(this, SIGNAL(loadMap(QString,QString)),
            m_viewport,SLOT(onLoadMap(QString,QString)));

    connect(this, SIGNAL(setCameraLLA(double,double,double)),
            m_viewport,SLOT(onSetCameraLLA(double,double,double)));

    connect(m_loadButton,SIGNAL(clicked()),
            this,SLOT(onLoadButtonClicked()));

    connect(m_camButton,SIGNAL(clicked()),
            this,SLOT(onCamButtonClicked()));

    connect(m_camRotate, SIGNAL(clicked()),
            this,SLOT(onCamModeRotate()));

    connect(m_camPan, SIGNAL(clicked()),
            this,SLOT(onCamModePan()));

    connect(m_camZoom, SIGNAL(clicked()),
            this,SLOT(onCamModeZoom()));

    connect(this,SIGNAL(setCamMode(int)),
            m_viewport,SLOT(onSetCameraMouseMode(int)));
}
Пример #20
0
void SettingsPage::setupUi()
{
   QVBoxLayout * vb = new QVBoxLayout;
   QGridLayout * grid = new QGridLayout;

	QLabel * lblCaption = new QLabel(this);
	lblCaption->setMinimumHeight(30);
   lblCaption->setText("<h3><center>" + tr("Additional Settings") + "</center></h3>");
   lblCaption->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   lblCaption->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d9ebfb, stop: 0.4 #a1d4fb,stop: 0.5 #a1d4fb, stop: 1.0 #d9ebfb); background-position: left top; border-style: solid; border-width: 1px; border-color: silver; border-radius: 3px; color: black;");

   btnTurn_  = new QToolButton(this);
   btnFold_  = new QToolButton(this);
   btnCheck_ = new QToolButton(this);

   btnTurn_->setIcon(QIcon(":/images/speaker.png"));
   btnFold_->setIcon(QIcon(":/images/speaker.png"));
   btnCheck_->setIcon(QIcon(":/images/speaker.png"));

   btnTurn_->setAutoRaise(true);
   btnFold_->setAutoRaise(true); 
   btnCheck_->setAutoRaise(true);
   
   btnTurn_->setToolTip(tr("Soundcheck"));
   btnFold_->setToolTip(tr("Soundcheck")); 
   btnCheck_->setToolTip(tr("Soundcheck"));
   
   btnTurn_->setEnabled(false);
   btnFold_->setEnabled(false); 
   btnCheck_->setEnabled(false);
   connect(btnTurn_, SIGNAL(clicked()), this, SLOT(testTurn()));
   connect(btnFold_, SIGNAL(clicked()), this, SLOT(testFold()));
   connect(btnCheck_, SIGNAL(clicked()), this, SLOT(testCheck()));

   chkTurn_ = new QCheckBox(tr("&Play a sound when you have a good hand"), this);
   chkFold_ = new QCheckBox(tr("Play a sound when the cards are &folded"), this);
   chkCheck_ = new QCheckBox(tr("Play a sound when Maverick &checks"), this);
   chkVisual_ = new QCheckBox(tr("&Highlight the table with a good hand"), this);
   chkShowFolded_ = new QCheckBox(tr("&Show folded hands"), this);
   chkAdvisor_ = new QCheckBox(tr("&Advisor mode (only tips, no actual actions)"),
      this);
   //chkKeep_ = new QCheckBox(tr("&Keep a log of the folder"), this);
   
   connect(chkTurn_, SIGNAL(toggled(bool)), this, SLOT(turnSwitch(bool)));
   connect(chkFold_, SIGNAL(toggled(bool)), this, SLOT(foldSwitch(bool)));
   connect(chkCheck_, SIGNAL(toggled(bool)), this, SLOT(checkSwitch(bool)));

   spnInterval_ = new QDoubleSpinBox(this);
   spnInterval_->setMinimum(0.1);
   spnInterval_->setMaximum(5);
   spnInterval_->setSingleStep(0.1);
   spnInterval_->setMinimumWidth(80);
   spnInterval_->setValue(1.00);
   spnInterval_->setDecimals(1);

   QLabel * lblInterval = new QLabel(tr("Process tables every (&sec.):"), this);
   lblInterval->setBuddy(spnInterval_);
   
   QLabel * lblRoom = new QLabel(tr("&Poker room:"), this);
   cmbRoom_ = new QComboBox(this);
   cmbRoom_->setEditable(false);
#ifndef DEMO_MODE
   cmbRoom_->addItem("Party Poker", "party");
   cmbRoom_->addItem("Titan Poker", "titan");
#endif
   cmbRoom_->addItem("Cake Poker", "cake");
   cmbRoom_->addItem("Red Star Poker", "rsp1");
   cmbRoom_->addItem("Poker Academy Pro", "acad");
   cmbRoom_->setMinimumWidth(120);
   lblRoom->setBuddy(cmbRoom_);

   QLabel * lblLang = new QLabel(tr("&Interface language:"), this);
   cmbLang_ = new QComboBox(this);
   cmbLang_->setEditable(false);
   cmbLang_->addItem("English", "en");
   cmbLang_->setMinimumWidth(120);
   lblLang->setBuddy(cmbLang_);
   
   QString appExe = qApp->applicationDirPath();
   QDir dir(":/translations");
   QStringList files = dir.entryList(QDir::Files);
   foreach (QString file, files)
   {
      if (file.right(2) == "qm" && file.contains("HoldemFolder_"))
      {
         int idx = file.indexOf("_");
         QString loc = file.mid(idx + 1, 2);
         QLocale locale(loc);
         cmbLang_->addItem(QLocale::languageToString(locale.language()), loc);
      }
   }

   vb->addWidget(lblCaption);
   vb->addSpacerItem(new QSpacerItem(1, 12));
   vb->addLayout(grid);
   grid->setContentsMargins(6, 6, 6, 6);
   int row = 0;
   grid->addWidget(chkTurn_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnTurn_, row++, 1, Qt::AlignLeft);
   
   grid->addWidget(chkFold_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnFold_, row++, 1, Qt::AlignLeft);

   grid->addWidget(chkCheck_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnCheck_, row++, 1, Qt::AlignLeft);
   
   grid->addWidget(chkVisual_, row++, 0, 1, 2, Qt::AlignLeft);
   grid->addWidget(chkShowFolded_, row++, 0, 1, 2, Qt::AlignLeft);
   grid->addWidget(chkAdvisor_, row++, 0, 1, 2, Qt::AlignLeft);
   
   QGridLayout * grid1 = new QGridLayout;
   grid1->setMargin(0);
   grid1->addWidget(lblInterval,    0, 0, Qt::AlignLeft);
   grid1->addWidget(spnInterval_,   0, 1, Qt::AlignLeft);
   grid->addLayout(grid1, row++, 0);

   QGridLayout * grid2 = new QGridLayout;
   grid2->setMargin(0);
   grid2->addWidget(lblRoom,        0, 0, Qt::AlignLeft);
   grid2->addWidget(cmbRoom_,       0, 1, Qt::AlignLeft);
   //grid->addLayout(grid2, row++, 0);

   //QGridLayout * grid3 = new QGridLayout;
   //grid3->setMargin(0);
   grid2->addWidget(lblLang,        1, 0, Qt::AlignLeft);
   grid2->addWidget(cmbLang_,       1, 1, Qt::AlignLeft);
   grid->addLayout(grid2, row++, 0);

   
   grid->setColumnStretch(1, 1);
   //grid->addWidget(chkKeep_, row++, 0, 1, 2);

   vb->addStretch(1);
   setLayout(vb);

   //audioOutput_ = new Phonon::AudioOutput(this);
   //mediaObject_ = new Phonon::MediaObject(this);
   //Phonon::createPath(mediaObject_, audioOutput_);

}
Пример #21
0
void MainWindow::addToGridView(Rom *currentRom, int count)
{
    ClickableWidget *gameGridItem = new ClickableWidget(gridWidget);
    gameGridItem->setMinimumWidth(getGridSize("width"));
    gameGridItem->setMaximumWidth(getGridSize("width"));
    gameGridItem->setGraphicsEffect(getShadow(false));

    //Assign ROM data to widget for use in click events
    gameGridItem->setProperty("fileName", currentRom->fileName);
    gameGridItem->setProperty("directory", currentRom->directory);
    if (currentRom->goodName == getTranslation("Unknown ROM") ||
        currentRom->goodName == getTranslation("Requires catalog file"))
        gameGridItem->setProperty("search", currentRom->internalName);
    else
        gameGridItem->setProperty("search", currentRom->goodName);
    gameGridItem->setProperty("romMD5", currentRom->romMD5);
    gameGridItem->setProperty("zipFile", currentRom->zipFile);

    QGridLayout *gameGridLayout = new QGridLayout(gameGridItem);
    gameGridLayout->setColumnStretch(0, 1);
    gameGridLayout->setColumnStretch(3, 1);
    gameGridLayout->setRowMinimumHeight(1, getImageSize("Grid").height());

    QLabel *gridImageLabel = new QLabel(gameGridItem);
    gridImageLabel->setMinimumHeight(getImageSize("Grid").height());
    gridImageLabel->setMinimumWidth(getImageSize("Grid").width());
    QPixmap image;

    if (currentRom->imageExists) {
        //Use uniform aspect ratio to account for fluctuations in TheGamesDB box art
        Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio;

        //Don't warp aspect ratio though if image is too far away from standard size (JP box art)
        float aspectRatio = float(currentRom->image.width()) / currentRom->image.height();

        if (aspectRatio < 1.1 || aspectRatio > 1.8)
            aspectRatioMode = Qt::KeepAspectRatio;

        image = currentRom->image.scaled(getImageSize("Grid"), aspectRatioMode, Qt::SmoothTransformation);
    } else
        image = QPixmap(":/images/not-found.png").scaled(getImageSize("Grid"), Qt::IgnoreAspectRatio,
                                                         Qt::SmoothTransformation);

    gridImageLabel->setPixmap(image);
    gridImageLabel->setAlignment(Qt::AlignCenter);
    gameGridLayout->addWidget(gridImageLabel, 1, 1);

    if (SETTINGS.value("Grid/label","true") == "true") {
        QLabel *gridTextLabel = new QLabel(gameGridItem);

        //Don't allow label to be wider than image
        gridTextLabel->setMaximumWidth(getImageSize("Grid").width());

        QString text = "";
        QString labelText = SETTINGS.value("Grid/labeltext","Filename").toString();

        text = getRomInfo(labelText, currentRom);

        gridTextLabel->setText(text);

        QString textHex = getColor(SETTINGS.value("Grid/labelcolor","White").toString()).name();
        int fontSize = getGridSize("font");

        gridTextLabel->setStyleSheet("QLabel { font-weight: bold; color: " + textHex + "; font-size: "
                                     + QString::number(fontSize) + "px; }");
        gridTextLabel->setWordWrap(true);
        gridTextLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);

        gameGridLayout->addWidget(gridTextLabel, 2, 1);
    }

    gameGridItem->setLayout(gameGridLayout);

    gameGridItem->setMinimumHeight(gameGridItem->sizeHint().height());

    int columnCount = SETTINGS.value("Grid/columncount", "4").toInt();
    gridLayout->addWidget(gameGridItem, count / columnCount + 1, count % columnCount + 1);
    gridWidget->adjustSize();

    connect(gameGridItem, SIGNAL(singleClicked(QWidget*)), this, SLOT(highlightGridWidget(QWidget*)));
    connect(gameGridItem, SIGNAL(doubleClicked(QWidget*)), this, SLOT(launchRomFromWidget(QWidget*)));
}
Пример #22
0
NoteWidget::NoteWidget(QString title, QString text, QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	setBackgroundImage();
	this->setContentsMargins(0,0,0,0);
	
	/* create the GUI objects */
	backButton = new ButtonLabel(QPixmap(":/icons/backButton.png"), QPixmap(":/icons/backButtonPushed.png"), this);
	connect(backButton, SIGNAL(released()), this, SLOT(close()));
	quitButton = new ButtonLabel(QPixmap(":/icons/quitButton.png"), QPixmap(":/icons/quitButtonPushed.png"), this);
	connect(quitButton, SIGNAL(released()), QApplication::instance(), SLOT(quit()));
	patientIcon = new QLabel(this);
	patientIcon->setPixmap(QPixmap(":/icons/patientIcon.png"));
	
	/* initialize the footer object */
	footer = new ChangePatientFooter(this);
	
    QLabel *headerText = new QLabel(this);
    headerText->setStyleSheet("font-family: arial; font-weight: bold; font-size: 18px;");
    headerText->setText("<font color=\"#622181\">Paziente</font><font color=\"#9C9E9F\"> / </font><font color=\"#0B72B5\">Immagini</font>");
        
	QHBoxLayout *headerLayout = new QHBoxLayout();
	headerLayout->setContentsMargins(13, 13, 13, 0);
	headerLayout->addWidget(patientIcon);
	headerLayout->addSpacing(3);
	headerLayout->addWidget(headerText);
	headerLayout->setAlignment(headerText, Qt::AlignVCenter);
	headerLayout->addStretch();	
	headerLayout->addWidget(quitButton);
	
	QLabel *titleLabel = new QLabel("<font color=\"black\">Soggetto<br/></font> <font color=\"white\" >"+ title +"</font>", this);
	titleLabel->setMinimumHeight(100);
	titleLabel->setAutoFillBackground(true);
	titleLabel->setFont(QFont("helvetica"));
	titleLabel->setAlignment(Qt::AlignVCenter);
	QPalette titlePal(titleLabel->palette());
	titlePal.setColor(QPalette::Background, QColor(190,10,38));
	titleLabel->setPalette(titlePal);
	
	QLabel *note = new QLabel(text, this);
	note->setFont(QFont("helvetica"));
	QPalette notePal(note->palette());
	notePal.setColor(QPalette::Text, Qt::black);
	note->setPalette(notePal);
	note->setWordWrap(true);
	note->setAlignment(Qt::AlignJustify);
	note->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QScrollArea *scrollArea = new QScrollArea();
	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	scrollArea->setWidget(note);
	scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->addLayout(headerLayout);
	mainLayout->addWidget(titleLabel);
	
	QHBoxLayout *backHLayout = new QHBoxLayout();
	backHLayout->setContentsMargins(15, 0,0,0);
	backHLayout->addWidget(backButton);
	
	QHBoxLayout *scrollLayout = new QHBoxLayout();
	scrollLayout->addWidget(scrollArea);
	scrollLayout->setAlignment(scrollArea, Qt::AlignVCenter);
	mainLayout->addLayout(scrollLayout);
	mainLayout->addStretch(3);
	mainLayout->addLayout(backHLayout);
	mainLayout->addStretch(1);
	mainLayout->addWidget(footer);
			
	setLayout(mainLayout);
}
Пример #23
0
void ListView::addToListView(Rom *currentRom, int count, bool ddEnabled)
{
    if (ddEnabled) // Add place for "No Cart" entry
        count++;

    QStringList visible = SETTINGS.value("List/columns", "Filename|Internal Name|Size").toString().split("|");

    if (visible.join("") == "" && SETTINGS.value("List/displaycover", "") != "true")
        //Otherwise no columns, so don't bother populating
        return;

    ClickableWidget *gameListItem = new ClickableWidget(listWidget);
    gameListItem->setContentsMargins(0, 0, 20, 0);
    gameListItem->setContextMenuPolicy(Qt::CustomContextMenu);
    if (SETTINGS.value("List/theme","Light").toString() == "Dark")
        gameListItem->setStyleSheet("color:#EEE;");

    //Assign ROM data to widget for use in click events
    gameListItem->setProperty("fileName", currentRom->fileName);
    gameListItem->setProperty("directory", currentRom->directory);
    if (currentRom->goodName == getTranslation("Unknown ROM") ||
        currentRom->goodName == getTranslation("Requires catalog file"))
        gameListItem->setProperty("search", currentRom->internalName);
    else
        gameListItem->setProperty("search", currentRom->goodName);
    gameListItem->setProperty("romMD5", currentRom->romMD5);
    gameListItem->setProperty("zipFile", currentRom->zipFile);

    QGridLayout *gameListLayout = new QGridLayout(gameListItem);
    gameListLayout->setColumnStretch(3, 1);

    //Add image
    if (SETTINGS.value("List/displaycover", "") == "true") {
        QLabel *listImageLabel = new QLabel(gameListItem);
        listImageLabel->setMinimumHeight(getImageSize("List").height());
        listImageLabel->setMinimumWidth(getImageSize("List").width());

        QPixmap image;

        if (currentRom->imageExists)
            image = currentRom->image.scaled(getImageSize("List"), Qt::KeepAspectRatio,
                                            Qt::SmoothTransformation);
        else {
            if (ddEnabled && count == 0)
                image = QPixmap(":/images/no-cart.png").scaled(getImageSize("List"), Qt::KeepAspectRatio,
                                                                 Qt::SmoothTransformation);
            else
                image = QPixmap(":/images/not-found.png").scaled(getImageSize("List"), Qt::KeepAspectRatio,
                                                                 Qt::SmoothTransformation);
        }

        listImageLabel->setPixmap(image);
        listImageLabel->setAlignment(Qt::AlignCenter);
        gameListLayout->addWidget(listImageLabel, 0, 1);
    }

    //Create text label
    QLabel *listTextLabel = new QLabel("", gameListItem);
    QString listText = "";

    int i = 0;

    foreach (QString current, visible)
    {
        QString addition = "";

        if (i == 0 && SETTINGS.value("List/firstitemheader","true") == "true")
            addition += "<h2 style='line-height:120%;margin:0;padding:0;'>";
        else
            addition += "<div style='line-height:120%;margin:0;padding:0;'><b>" + current + ":</b> ";

        addition += getRomInfo(current, currentRom, true);

        if (i == 0 && SETTINGS.value("List/firstitemheader","true") == "true")
            addition += "</h2>";
        else
            addition += "</div>";

        if (addition.right(12) != ":</b> </div>")
            listText += addition;

        i++;
    }