EventEditor::EventEditor( const Event& event, QWidget* parent ) : QDialog( parent ) , m_ui( new Ui::EventEditor ) , m_event( event ) { m_ui->setupUi( this ); m_ui->dateEditEnd->calendarWidget()->setFirstDayOfWeek( Qt::Monday ); m_ui->dateEditEnd->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers ); m_ui->dateEditStart->calendarWidget()->setFirstDayOfWeek( Qt::Monday ); m_ui->dateEditStart->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers ); // Ctrl+Return for OK m_ui->buttonBox->button(QDialogButtonBox::Ok)->setShortcut(Qt::CTRL + Qt::Key_Return); // connect stuff: connect( m_ui->spinBoxHours, SIGNAL(valueChanged(int)), SLOT(durationHoursEdited(int)) ); connect( m_ui->spinBoxMinutes, SIGNAL(valueChanged(int)), SLOT(durationMinutesEdited(int)) ); connect( m_ui->dateEditStart, SIGNAL(dateChanged(QDate)), SLOT(startDateChanged(QDate)) ); connect( m_ui->timeEditStart, SIGNAL(timeChanged(QTime)), SLOT(startTimeChanged(QTime)) ); connect( m_ui->dateEditEnd, SIGNAL(dateChanged(QDate)), SLOT(endDateChanged(QDate)) ); connect( m_ui->timeEditEnd, SIGNAL(timeChanged(QTime)), SLOT(endTimeChanged(QTime)) ); connect( m_ui->pushButtonSelectTask, SIGNAL(clicked()), SLOT(selectTaskClicked()) ); connect( m_ui->textEditComment, SIGNAL(textChanged()), SLOT(commentChanged()) ); connect( m_ui->startToNowButton, SIGNAL(clicked()), SLOT(startToNowButtonClicked()) ); connect( m_ui->endToNowButton, SIGNAL(clicked()), SLOT(endToNowButtonClicked()) ); // what a fricking hack - but QDateTimeEdit does not seem to have // a simple function to toggle 12h and 24h mode: // yeah, I know, this will survive changes in the user prefs, but // only for this instance of the edit dialog QString originalDateTimeFormat = m_ui->timeEditStart->displayFormat(); QString format = originalDateTimeFormat .remove( QStringLiteral("ap") ) .remove( QStringLiteral("AP") ) .simplified(); m_ui->timeEditStart->setDisplayFormat( format ); m_ui->timeEditEnd->setDisplayFormat( format ); // initialize to some sensible values, unless we got something valid passed in if ( !m_event.isValid() ) { QSettings settings; QDateTime start = settings.value( MetaKey_LastEventEditorDateTime, QDateTime::currentDateTime() ).toDateTime(); m_event.setStartDateTime( start ); m_event.setEndDateTime( start ); m_endDateChanged = false; } updateValues( true ); }
void setEndTime(const uint32_t &a) { m_EndTime = a; endTimeChanged();}