foreach(eleF, listFeh) { CustomRadioButton *r = new CustomRadioButton("--bg-" + eleF); r->setObjectName(eleF); if(eleF == "fill") r->setChecked(true); otherFehPicOptLay->addWidget(r); otherFehOptions.insert(eleF,r); otherFehGrp->addButton(r); }
Wallpaper::Wallpaper(QMap<QString, QVariant> set, bool v, QWidget *parent) : MyWidget(parent) { this->setBorderArea(150,100); verbose = v; globSet = set; // The buttons to proceed or abort are always visible (i.e. not scrolled) ok = new CustomPushButton(tr("Okay, do it!")); cancel = new CustomPushButton(tr("Nooo, don't!")); QHBoxLayout *butLay = new QHBoxLayout; butLay->addStretch(); butLay->addWidget(ok); butLay->addWidget(cancel); butLay->addStretch(); CustomLine *line = new CustomLine; QVBoxLayout *botLay = new QVBoxLayout; botLay->addWidget(line); botLay->addLayout(butLay); this->addButtonLayout(botLay); connect(ok, SIGNAL(clicked()), this, SLOT(goAheadAndSetWallpaper())); connect(cancel, SIGNAL(clicked()), this, SLOT(animate())); QVBoxLayout *lay = new QVBoxLayout; // the widget title QLabel *title = new QLabel("<center><span style=\"font-size: 30pt; font-weight: bold\">" + tr("Set as Wallpaper") + "</span></center>"); title->setStyleSheet("color: white"); lay->addWidget(title); lay->addSpacing(10); // The filename is always set to this label filenameLabel = new CustomLabel("<center>---</center>"); filenameLabel->setFontColor("lightgrey"); filenameLabel->setItalic(true); lay->addWidget(filenameLabel); lay->addSpacing(20); // Label explaining the wm detection CustomLabel *wmDetectedLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Window Manager") + "</span></b> " + "<br><br>" + tr("PhotoQt tries to detect you window manager according to the environment variables set by your system. If it still got it wrong, you can change the window manager here manually.")); wmDetectedLabel->setWordWrap(true); lay->addWidget(wmDetectedLabel); lay->addSpacing(10); // Combobox to change WM wm = new CustomComboBox; wm->setFontSize(15); wm->setBorder(1,"white"); wm->addItem("KDE4","kde"); wm->addItem("Gnome/Unity","gnome"); wm->addItem("XFCE4","xfce"); wm->addItem("Razor-Qt", "razor"); wm->addItem(tr("Other"),"other"); QHBoxLayout *wmLay = new QHBoxLayout; wmLay->addStretch(); wmLay->addWidget(wm); wmLay->addStretch(); lay->addLayout(wmLay); lay->addSpacing(10); // This message is used to show an (error or other) message depending on the window manager wmMessage = new CustomLabel; wmMessage->setAlignment(Qt::AlignCenter); wmMessage->setWordWrap(true); wmMessage->setVisible(false); lay->addSpacing(10); lay->addWidget(wmMessage); lay->addSpacing(20); connect(wm, SIGNAL(currentIndexChanged(int)), this, SLOT(wmSelected())); //////// GNOME SETTINGS ///////////// // Some image options can be set (the label is globsl, because it is hidden/shown depending on wm choice) gnomePicOpsLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Picture Options") + "</span></b> " + "<br><br>" + tr("There are several picture options that can be set for the wallpaper image.")); gnomePicOpsLabel->setMargin(5); gnomePicOpsLabel->setWordWrap(true); // A layout holding the image options QVBoxLayout *gnomePicOpsLayCenter = new QVBoxLayout; gnomeButGrp = new QButtonGroup; gnomePictureOptions.clear(); // These options are possible QStringList picOpts; picOpts << "wallpaper"; picOpts << "centered"; picOpts << "scaled"; picOpts << "zoom"; picOpts << "spanned"; // Setup radiobuttons, add to layout, to button group and store in QMap for(int i = 0; i < picOpts.size(); ++i) { CustomRadioButton *chk = new CustomRadioButton(picOpts.at(i)); if(i == 3) chk->setChecked(true); gnomePicOpsLayCenter->addWidget(chk); gnomeButGrp->addButton(chk); gnomePictureOptions.insert(picOpts.at(i),chk); } // And center in a horizontal layout QHBoxLayout *gnomePicOpsLay = new QHBoxLayout; gnomePicOpsLay->addStretch(); gnomePicOpsLay->addLayout(gnomePicOpsLayCenter); gnomePicOpsLay->addStretch(); // Add label and button layout to central widget layout lay->addWidget(gnomePicOpsLabel); lay->addLayout(gnomePicOpsLay); ////// THE FOLLOWING SCREEN SELECT IS USED BY DIFFERENT WMs ////// QVBoxLayout *wmMonitorLayCenter = new QVBoxLayout; wmMonitorSelect.clear(); QDesktopWidget desk; for(int i = 0; i < desk.screenCount(); ++i) { CustomCheckBox *mon = new CustomCheckBox(tr("Screen") + QString(" #%1").arg(i)); mon->setChecked(true); wmMonitorLayCenter->addWidget(mon); wmMonitorSelect.insert(i,mon); } QHBoxLayout *wmMonitorLay = new QHBoxLayout; wmMonitorLay->addStretch(); wmMonitorLay->addLayout(wmMonitorLayCenter); wmMonitorLay->addStretch(); wmMonitorLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Select Monitors") + "</span></b> " + "<br><br>" + tr("The wallpaper can be set to either of the available monitors (or any combination).")); wmMonitorLabel->setWordWrap(true); wmMonitorLabel->setMargin(5); lay->addWidget(wmMonitorLabel); lay->addLayout(wmMonitorLay); /////// XFCE SETTINGS ///////////// QVBoxLayout *xfcePicOpsLayCenter = new QVBoxLayout; xfceButGrp = new QButtonGroup; xfcePictureOptions.clear(); QStringList xfcePicOpts; xfcePicOpts << "automatic"; xfcePicOpts << "centered"; xfcePicOpts << "tiled"; xfcePicOpts << "spanned"; xfcePicOpts << "scaled"; xfcePicOpts << "magnified"; for(int i = 0; i < xfcePicOpts.size(); ++i) { CustomRadioButton *chk = new CustomRadioButton(xfcePicOpts.at(i)); if(i == 0) chk->setChecked(true); xfcePicOpsLayCenter->addWidget(chk); xfceButGrp->addButton(chk); xfcePictureOptions.insert(xfcePicOpts.at(i),chk); } QHBoxLayout *xfcePicOpsLay = new QHBoxLayout; xfcePicOpsLay->addStretch(); xfcePicOpsLay->addLayout(xfcePicOpsLayCenter); xfcePicOpsLay->addStretch(); xfcePicOpsLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Picture Options") + "</span></b> " + "<br><br>" + tr("There are several picture options that can be set for the wallpaper image.")); xfcePicOpsLabel->setMargin(5); xfcePicOpsLabel->setWordWrap(true); lay->addWidget(xfcePicOpsLabel); lay->addLayout(xfcePicOpsLay); ///////// OTHER SETTINGS /////////// otherFeh = new CustomRadioButton(tr("Use 'feh'")); otherFeh->setIndicatorImage(":/img/checkbox_checked.png",":/img/checkbox_checked.png",":/img/checkbox_unchecked.png",":/img/checkbox_unchecked.png"); otherFeh->setChecked(true); otherNitrogen = new CustomRadioButton(tr("Use 'nitrogen'")); otherNitrogen->setIndicatorImage(":/img/checkbox_checked.png",":/img/checkbox_checked.png",":/img/checkbox_unchecked.png",":/img/checkbox_unchecked.png"); QButtonGroup *otherGrp = new QButtonGroup; otherGrp->addButton(otherFeh); otherGrp->addButton(otherNitrogen); QHBoxLayout *externLay = new QHBoxLayout; externLay->addStretch(); externLay->addWidget(otherFeh); externLay->addWidget(otherNitrogen); externLay->addStretch(); connect(otherFeh, SIGNAL(clicked()), this, SLOT(swapFehNitrogen())); connect(otherNitrogen, SIGNAL(clicked()), this, SLOT(swapFehNitrogen())); otherNitrogenGrp = new QButtonGroup; otherNitrogenOptions.clear(); QVBoxLayout *otherNitrogenPicOptLay = new QVBoxLayout; otherNitrogenPicOptLay->setMargin(5); QStringList listNitrogen; listNitrogen << "auto"; listNitrogen << "centered"; listNitrogen << "scaled"; listNitrogen << "tiled"; listNitrogen << "zoom"; listNitrogen << "zoom-fill"; QString eleN; foreach(eleN, listNitrogen) { CustomRadioButton *r = new CustomRadioButton("--set-" + eleN); r->setObjectName(eleN); if(eleN == "auto") r->setChecked(true); otherNitrogenPicOptLay->addWidget(r); otherNitrogenOptions.insert(eleN,r); otherNitrogenGrp->addButton(r); }