Scale::Scale(bool verbose, QWidget *parent) : MyWidget(parent) { this->setVisibleArea(QSize(550,300)); // Some variables ignoreSizeChange = false; this->verbose = verbose; // A title label CustomLabel *title = new CustomLabel("<center><h1>" + tr("Scale Image") + "</h1></center>"); // A label to display the current size curSize = new CustomLabel("<center>" + tr("Current Size:") + "</center>"); // Layout for the spinboxes and their labels QGridLayout *spinLay = new QGridLayout; // Width label and spinbox CustomLabel *widthLabel = new CustomLabel(" " + tr("New Width:")); widthLabel->setAlignment(Qt::AlignRight); widthSpin = new CustomSpinBox; widthSpin->setObjectName("w"); widthSpin->setMaximum(999999); widthSpin->setFixedWidth(70); widthSpin->setBackground("white", "black"); widthSpin->setBorder("black",1); widthSpin->setFontColor("black","grey"); widthSpin->setEnabled(false); spinLay->addWidget(widthLabel,0,0); spinLay->addWidget(widthSpin,0,1); connect(widthSpin, SIGNAL(valueChanged(int)), this, SLOT(sizeChanged())); // Height label and spinbox CustomLabel *heightLabel = new CustomLabel(" " + tr("New Height:")); heightLabel->setAlignment(Qt::AlignRight); heightSpin = new CustomSpinBox; heightSpin->setObjectName("h"); heightSpin->setMaximum(999999); heightSpin->setFixedWidth(70); heightSpin->setBackground("white", "black"); heightSpin->setBorder("black",1); heightSpin->setFontColor("black","grey"); heightSpin->setEnabled(false); spinLay->addWidget(heightLabel,1,0); spinLay->addWidget(heightSpin,1,1); connect(heightSpin, SIGNAL(valueChanged(int)), this, SLOT(sizeChanged())); // Checkbox to keep aspect ratio keepratio = new CustomCheckBox(tr("Aspect Ratio")); keepratio->setIndicatorImage(":/img/ratioKeep.png",":/img/ratioDontKeep.png", ":/img/ratioKeep.png",":/img/ratioDontKeep.png"); keepratio->setChecked(true); keepRatioClicked(); // Set tooltip etc. connect(keepratio, SIGNAL(clicked()), this, SLOT(keepRatioClicked())); connect(keepratio, SIGNAL(clicked()), this, SLOT(sizeChanged())); // Layout to put the above in horizontal order QHBoxLayout *spinCheckLay = new QHBoxLayout; spinCheckLay->addStretch(); spinCheckLay->addLayout(spinLay); spinCheckLay->addWidget(keepratio); spinCheckLay->addStretch(); // Set the quality of the scaling CustomLabel *qualityLabel = new CustomLabel(tr("Quality:")); CustomSpinBox *qualityValue = new CustomSpinBox; qualityValue->setMinimum(0); qualityValue->setMaximum(100); qualityValue->setValue(90); quality = new CustomSlider; quality->setMinimum(0); quality->setMaximum(100); quality->setFixedWidth(150); quality->setValue(90); QHBoxLayout *qualityLay = new QHBoxLayout; qualityLay->addStretch(); qualityLay->addWidget(qualityLabel); qualityLay->addWidget(quality); qualityLay->addWidget(qualityValue); qualityLay->addStretch(); connect(qualityValue, SIGNAL(valueChanged(int)), quality, SLOT(setValue(int))); connect(quality, SIGNAL(valueChanged(int)), qualityValue, SLOT(setValue(int))); // Pushbuttons to go ahead or cancel enterInPlace = new CustomPushButton(tr("Scale in place")); enterInPlace->setObjectName("enterInPlace"); CustomPushButton *enterNew = new CustomPushButton(tr("Scale in new file")); enterNew->setObjectName("enterNew"); CustomPushButton *cancel = new CustomPushButton(tr("Don't Scale")); QHBoxLayout *butLay = new QHBoxLayout; butLay->addStretch(); butLay->addWidget(enterInPlace); butLay->addWidget(enterNew); butLay->addWidget(cancel); butLay->addStretch(); connect(cancel, SIGNAL(clicked()), this, SLOT(disableAllSpinBoxAndClose())); connect(enterInPlace, SIGNAL(clicked()), this, SLOT(enterClicked())); connect(enterNew, SIGNAL(clicked()), this, SLOT(enterClicked())); // Put everything into layout and set to widget QVBoxLayout *lay = new QVBoxLayout; lay->addWidget(title); lay->addSpacing(15); lay->addWidget(curSize); lay->addSpacing(20); lay->addLayout(spinCheckLay); lay->addSpacing(10); lay->addLayout(qualityLay); lay->addSpacing(15); lay->addLayout(butLay); lay->addStretch(); this->setWidgetLayout(lay); // We need to initialise them here, otherwise the system shortcut in mainwindow.cpp might cause a crash confirmNotSupported = new CustomConfirm("",""); confirmInPlace = new CustomConfirm("",""); confirmNew = new CustomConfirm("",""); }
ManualRideDialog::ManualRideDialog(MainWindow *mainWindow, const QDir &home, bool useMetric) : mainWindow(mainWindow), home(home) { useMetricUnits = useMetric; int row; mainWindow->getBSFactors(timeBS,distanceBS,timeDP,distanceDP); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Manually Enter Ride Data")); // ride date QLabel *manualDateLabel = new QLabel(tr("Ride date: "), this); dateTimeEdit = new QDateTimeEdit( QDateTime::currentDateTime(), this ); // Wed 6/24/09 6:55 AM dateTimeEdit->setDisplayFormat(tr("ddd MMM d, yyyy h:mm AP")); dateTimeEdit->setCalendarPopup(true); // ride length QLabel *manualLengthLabel = new QLabel(tr("Ride length: "), this); QHBoxLayout *manualLengthLayout = new QHBoxLayout; hrslbl = new QLabel(tr("hours"),this); hrslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken); hrsentry = new QLineEdit(this); QIntValidator * hoursValidator = new QIntValidator(0,99,this); //hrsentry->setInputMask("09"); hrsentry->setValidator(hoursValidator); manualLengthLayout->addWidget(hrslbl); manualLengthLayout->addWidget(hrsentry); minslbl = new QLabel(tr("mins"),this); minslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken); minsentry = new QLineEdit(this); QIntValidator * secsValidator = new QIntValidator(0,60,this); //minsentry->setInputMask("00"); minsentry->setValidator(secsValidator); manualLengthLayout->addWidget(minslbl); manualLengthLayout->addWidget(minsentry); secslbl = new QLabel(tr("secs"),this); secslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken); secsentry = new QLineEdit(this); //secsentry->setInputMask("00"); secsentry->setValidator(secsValidator); manualLengthLayout->addWidget(secslbl); manualLengthLayout->addWidget(secsentry); // ride distance QString *DistanceString = new QString(tr("Distance ")); if (useMetricUnits) DistanceString->append("(" + tr("km") + "):"); else DistanceString->append("(" + tr("miles") + "):"); QLabel *DistanceLabel = new QLabel(*DistanceString, this); QDoubleValidator * distanceValidator = new QDoubleValidator(0,9999,2,this); distanceentry = new QLineEdit(this); //distanceentry->setInputMask("009.00"); distanceentry->setValidator(distanceValidator); distanceentry->setMaxLength(6); // AvgHR QLabel *HRLabel = new QLabel(tr("Average HR: "), this); HRentry = new QLineEdit(this); QIntValidator *hrValidator = new QIntValidator(30,200,this); //HRentry->setInputMask("099"); HRentry->setValidator(hrValidator); // how to estimate BikeScore: QLabel *BSEstLabel = NULL; boost::shared_ptr<QSettings> settings = GetApplicationSettings(); QVariant BSmode = settings->value(GC_BIKESCOREMODE); estBSbyTimeButton = NULL; estBSbyDistButton = NULL; if (timeBS || distanceBS) { BSEstLabel = new QLabel(tr("Estimate BikeScore by: ")); if (timeBS) { estBSbyTimeButton = new QRadioButton(tr("Time")); // default to time based unless no timeBS factor if (BSmode.toString() != "distance") estBSbyTimeButton->setDown(true); } if (distanceBS) { estBSbyDistButton = new QRadioButton(tr("Distance")); if (BSmode.toString() == "distance" || ! timeBS) estBSbyDistButton->setDown(true); } } // BikeScore QLabel *ManualBSLabel = new QLabel(tr("BikeScore: "), this); QDoubleValidator * bsValidator = new QDoubleValidator(0,9999,2,this); BSentry = new QLineEdit(this); BSentry->setValidator(bsValidator); BSentry->setMaxLength(6); BSentry->clear(); // DanielsPoints QLabel *ManualDPLabel = new QLabel(tr("Daniels Points: "), this); QDoubleValidator * dpValidator = new QDoubleValidator(0,9999,2,this); DPentry = new QLineEdit(this); DPentry->setValidator(dpValidator); DPentry->setMaxLength(6); DPentry->clear(); // buttons enterButton = new QPushButton(tr("&OK"), this); cancelButton = new QPushButton(tr("&Cancel"), this); // don't let Enter write a new (and possibly incomplete) manual file: enterButton->setDefault(false); cancelButton->setDefault(true); // Set up the layout: QGridLayout *glayout = new QGridLayout(this); row = 0; glayout->addWidget(manualDateLabel, row, 0); glayout->addWidget(dateTimeEdit, row, 1, 1, -1); row++; glayout->addWidget(manualLengthLabel, row, 0); glayout->addLayout(manualLengthLayout,row,1,1,-1); row++; glayout->addWidget(DistanceLabel,row,0); glayout->addWidget(distanceentry,row,1,1,-1); row++; glayout->addWidget(HRLabel,row,0); glayout->addWidget(HRentry,row,1,1,-1); row++; if (timeBS || distanceBS) { glayout->addWidget(BSEstLabel,row,0); if (estBSbyTimeButton) glayout->addWidget(estBSbyTimeButton,row,1,1,-1); if (estBSbyDistButton) glayout->addWidget(estBSbyDistButton,row,2,1,-1); row++; } glayout->addWidget(ManualBSLabel,row,0); glayout->addWidget(BSentry,row,1,1,-1); row++; glayout->addWidget(ManualDPLabel,row,0); glayout->addWidget(DPentry,row,1,1,-1); row++; glayout->addWidget(enterButton,row,1); glayout->addWidget(cancelButton,row,2); this->resize(QSize(400,275)); connect(enterButton, SIGNAL(clicked()), this, SLOT(enterClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(hrsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst())); //connect(secsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst())); connect(minsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst())); connect(distanceentry, SIGNAL(editingFinished()), this, SLOT(setBsEst())); if (estBSbyTimeButton) connect(estBSbyTimeButton,SIGNAL(clicked()),this, SLOT(bsEstChanged())); if (estBSbyDistButton) connect(estBSbyDistButton,SIGNAL(clicked()),this, SLOT(bsEstChanged())); }
void KMyMoneyBriefSchedule::slotEnterClicked() { hide(); emit enterClicked(m_scheduleList[m_index], m_date); }
OpenFileDialog::OpenFileDialog(QWidget *parent) : QDialog(parent) { /* layouts */ QVBoxLayout* layout = new QVBoxLayout(); QHBoxLayout* hlayout; /* title area */ title = new QLabel("Open File"); title->setStyleSheet("font: 24pt; color: white;"); QFrame* line = new QFrame; line->setFrameStyle(QFrame::HLine | QFrame::Raised); line->setStyleSheet("background: white; border: 2px solid white;"); layout->addWidget(title); layout->addWidget(line); /* files header */ path = new QLabel(QDir::homePath()); path->setStyleSheet("color: white; font: 14pt;"); drive = new QPushButton("Drives"); drive->setFixedSize(QSize(150, 50)); drive->setStyleSheet("QPushButton{color: white; border: 0px; font: 14pt;} QPushButton::hover{border: 2px solid white;}"); connect(drive, SIGNAL(clicked(bool)), this, SLOT(onDriveClicked())); hlayout = new QHBoxLayout(); hlayout->addWidget(path); hlayout->addStretch(); hlayout->addWidget(drive); layout->addLayout(hlayout); /* files area */ model = new QFileSystemModel(); model->setFilter(QDir::AllEntries | QDir::NoDot); view = new QListView(); view->setModel(model); view->setRootIndex(model->setRootPath(path->text())); view->setStyleSheet("QListView{border: 2px solid white; } QListView::item{color: white; height: 50px;} QListView::item:hover{border: 2px solid white; } QListView::item:selected{border: 2px solid white;}"); view->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 45px; }"); connect(view, SIGNAL(clicked(QModelIndex)), this, SLOT(onViewClicked(QModelIndex))); layout->addWidget(view); /* open area */ input = new Input(); input->setFixedHeight(50); input->setStyleSheet("color: white; font: 14pt;"); open = new QPushButton("Open"); open->setFixedSize(QSize(150, 50)); open->setStyleSheet("QPushButton{color: white; border: 0px; font: 14pt;} QPushButton::hover{border: 2px solid white;}"); connect(open, SIGNAL(clicked(bool)), this, SLOT(onOpenClicked())); cancel = new QPushButton("Cancel"); cancel->setFixedSize(QSize(150, 50)); cancel->setStyleSheet("QPushButton{color: white; border: 0px; font: 14pt;} QPushButton::hover{border: 2px solid white;}"); connect(cancel, SIGNAL(clicked(bool)), this, SLOT(onCancelClicked())); hlayout = new QHBoxLayout(); hlayout->addWidget(input); hlayout->addWidget(open); hlayout->addWidget(cancel); layout->addLayout(hlayout); /* keyboard */ keyboard = new VirtualKeyboard(input, this); keyboard->setStyleSheet("font: 14pt;"); keyboard->hide(); connect(keyboard, SIGNAL(enterClicked()), this, SLOT(onOpenClicked())); layout->addWidget(keyboard); /* window */ setLayout(layout); setStyleSheet("background: rgb(46,46,46);"); showFullScreen(); }