コード例 #1
0
ファイル: state.cpp プロジェクト: GrimKriegor/openmw-tes3mp
void CSMPrefs::State::resetAll()
{
    for (Collection::iterator iter = mCategories.begin(); iter != mCategories.end(); ++iter)
    {
        resetCategory(iter->first);
    }
}
コード例 #2
0
Settings::BirthdayPage::BirthdayPage(QWidget* parent) : QWidget(parent)
{
    QVBoxLayout* mainLayout = new QVBoxLayout(this);

    QHBoxLayout* dataLayout = new QHBoxLayout;
    mainLayout->addLayout(dataLayout);

    QVBoxLayout* itemsLayout = new QVBoxLayout;
    dataLayout->addLayout(itemsLayout);

    QHBoxLayout* itemsHeaderLayout = new QHBoxLayout;
    itemsLayout->addLayout(itemsHeaderLayout);

    QLabel* categoryText = new QLabel(i18n("Category:"));
    itemsHeaderLayout->addWidget(categoryText);

    m_categoryBox = new QComboBox;
    itemsHeaderLayout->addWidget(m_categoryBox);
    connect(m_categoryBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCategory(int)));

    m_filter = new QLineEdit;
    m_filter->setPlaceholderText(i18n("Filter (Alt+f)"));
    itemsHeaderLayout->addWidget(m_filter);
    connect(m_filter, SIGNAL(textChanged(QString)), this, SLOT(resetCategory()));
    new QShortcut(Qt::AltModifier + Qt::Key_F, m_filter, SLOT(setFocus()));

    m_dataView = new QTableWidget;
    m_dataView->setColumnCount(2);
    m_dataView->verticalHeader()->hide();
    m_dataView->setShowGrid(false);
    itemsLayout->addWidget(m_dataView);
    connect(m_dataView, SIGNAL(cellActivated(int,int)), this, SLOT(editDate(int,int)));

    QVBoxLayout* calendarLayout = new QVBoxLayout;
    dataLayout->addLayout(calendarLayout);

    calendarLayout->addStretch();

    m_birthdayOfLabel = new QLabel;
    calendarLayout->addWidget(m_birthdayOfLabel);

    m_dateInput = new QLineEdit;
    calendarLayout->addWidget(m_dateInput);
    connect(m_dateInput, SIGNAL(textEdited(QString)), this, SLOT(parseDate(QString)));
    connect(m_dateInput, SIGNAL(editingFinished()), this, SLOT(checkDate()));

    m_locale = KGlobal::locale();
    m_calendar = new QCalendarWidget;
    switch (m_locale->weekStartDay()) {
    case 1: m_calendar->setFirstDayOfWeek(Qt::Monday); break;
    case 2: m_calendar->setFirstDayOfWeek(Qt::Tuesday); break;
    case 3: m_calendar->setFirstDayOfWeek(Qt::Wednesday); break;
    case 4: m_calendar->setFirstDayOfWeek(Qt::Thursday); break;
    case 5: m_calendar->setFirstDayOfWeek(Qt::Friday); break;
    case 6: m_calendar->setFirstDayOfWeek(Qt::Saturday); break;
    case 7: m_calendar->setFirstDayOfWeek(Qt::Sunday); break;
    }
    calendarLayout->addWidget(m_calendar);
    connect(m_calendar, SIGNAL(clicked(QDate)), this, SLOT(setDate(QDate)));

    m_unsetButton = new QPushButton(i18n("Remove birthday"));
    calendarLayout->addWidget(m_unsetButton);
    connect(m_unsetButton, SIGNAL(clicked()), this, SLOT(removeDate()));

    calendarLayout->addStretch();

    QLabel* info = new QLabel(i18n("Set the date of birth for items (say people) here, "
                                   "and then see their age when viewing the images."));
    mainLayout->addWidget(info);

    m_noDateString = QString::fromUtf8("---");
    m_boldFont.setBold(true);

    disableCalendar();
}