From: Christophe Dumez Date: Sat, 10 Jul 2010 19:35:17 +0000 (+0200) Subject: Minor cosmetic changes X-Git-Url: https://vcs.maemo.org/git/?p=timedsilencer;a=commitdiff_plain;h=518c5899683e6f5a8bb6b46fabdb87bfe622f7ed Minor cosmetic changes --- diff --git a/TimedSilencer.pro.user b/TimedSilencer.pro.user index 0a399d8..7e82d5e 100644 --- a/TimedSilencer.pro.user +++ b/TimedSilencer.pro.user @@ -138,7 +138,7 @@ 16 2010-06-29T00:09:20 - 2010-07-10T17:45:09 + 2010-07-10T21:27:51 1 diff --git a/eventlistdelegate.cpp b/eventlistdelegate.cpp index 600d547..36bcda0 100644 --- a/eventlistdelegate.cpp +++ b/eventlistdelegate.cpp @@ -25,13 +25,16 @@ EventListDelegate::EventListDelegate() } void EventListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { + QStyleOptionViewItem opt = option; + opt.displayAlignment = Qt::AlignCenter; + QStyledItemDelegate::paint(painter, opt, index); if(index.column() == EV_STATUS) { // Draw checkbox QIcon::fromTheme("general_tickmark_checked"); // Is selected // Draw checkbox QIcon cbIco; - if(index.data().toBool()) { + if(index.data(Qt::UserRole).toBool()) { cbIco = QIcon::fromTheme("clock_alarm_on"); } else { cbIco = QIcon::fromTheme("clock_alarm_off"); @@ -42,9 +45,5 @@ void EventListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt cbRect.setHeight(cbPix.height()); cbRect.moveCenter(option.rect.center());; painter->drawPixmap(cbRect, cbPix); - } else { - QStyleOptionViewItem opt = option; - opt.displayAlignment = Qt::AlignCenter; - QStyledItemDelegate::paint(painter, opt, index); } } diff --git a/lang/timedsilencer_en.ts b/lang/timedsilencer_en.ts index 976d855..72e583a 100644 --- a/lang/timedsilencer_en.ts +++ b/lang/timedsilencer_en.ts @@ -4,33 +4,155 @@ MainWindow - - Use the silent profile between + + New profile switching event + + + + + NewAlarmDlg + + + Edit profile switching event - - and + + New profile switching event - + + Use the silent profile + + + + + From + + + + + To + + + + + Repeat + + + + Activated - + + Delete + + + + Save - - The daily profile switching is activated + + This profile switching event already exists + + + + + ProfileEvent + + + Never + + + + + Every day + + + + + QMaemo5WeekDaysPickWidget + + + Repeat + + + + + Never + + + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + Every day + + + + + Done + + + + + SwitchingEventList + + + Status + + + + + From + + + + + To - - The daily profile switching is deactivated + + Repeat diff --git a/lang/timedsilencer_fr.qm b/lang/timedsilencer_fr.qm index ca39b43..6e4c8c1 100644 Binary files a/lang/timedsilencer_fr.qm and b/lang/timedsilencer_fr.qm differ diff --git a/lang/timedsilencer_fr.ts b/lang/timedsilencer_fr.ts index 2c30e91..32b851f 100644 --- a/lang/timedsilencer_fr.ts +++ b/lang/timedsilencer_fr.ts @@ -19,34 +19,28 @@ Utiliser le profil silencieux entre - Use the silent profile between - Utiliser le profil silencieux entre + Utiliser le profil silencieux entre - and - et + et - Activated - Activé + Activé - Save - Enregistrer + Enregistrer - The daily profile switching is activated - Le changement de profil journalier est activé + Le changement de profil journalier est activé - The daily profile switching is deactivated - Le changement de profil journalier est désactivé + Le changement de profil journalier est désactivé Enabled @@ -68,5 +62,157 @@ The Timed Silencer is now disabled La mise en silence est désormais inactive + + + New profile switching event + + + + + NewAlarmDlg + + + Edit profile switching event + + + + + New profile switching event + + + + + Use the silent profile + + + + + From + + + + + To + + + + + Repeat + + + + + Activated + Activé + + + + Delete + + + + + Save + Enregistrer + + + + This profile switching event already exists + + + + + ProfileEvent + + + Never + + + + + Every day + + + + + QMaemo5WeekDaysPickWidget + + + Repeat + + + + + Never + + + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + Every day + + + + + Done + + + + + SwitchingEventList + + + Status + + + + + From + + + + + To + + + + + Repeat + + diff --git a/lang/timedsilencer_zh.qm b/lang/timedsilencer_zh.qm index eabb8d5..fe90e44 100644 Binary files a/lang/timedsilencer_zh.qm and b/lang/timedsilencer_zh.qm differ diff --git a/lang/timedsilencer_zh.ts b/lang/timedsilencer_zh.ts index 9ed9769..87598b8 100644 --- a/lang/timedsilencer_zh.ts +++ b/lang/timedsilencer_zh.ts @@ -19,34 +19,28 @@ 使用静音模式时段 - Use the silent profile between - 使用静音模式时段 + 使用静音模式时段 - and - 至 + 至 - Activated - 已激活 + 已激活 - Save - 保存 + 保存 - The daily profile switching is activated - 每日模式交换已激活 + 每日模式交换已激活 - The daily profile switching is deactivated - 每日模式交换已禁用 + 每日模式交换已禁用 Enabled @@ -68,5 +62,157 @@ The Timed Silencer is now disabled 定时静音器已禁用 + + + New profile switching event + + + + + NewAlarmDlg + + + Edit profile switching event + + + + + New profile switching event + + + + + Use the silent profile + + + + + From + + + + + To + + + + + Repeat + + + + + Activated + 已激活 + + + + Delete + + + + + Save + 保存 + + + + This profile switching event already exists + + + + + ProfileEvent + + + Never + + + + + Every day + + + + + QMaemo5WeekDaysPickWidget + + + Repeat + + + + + Never + + + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + Every day + + + + + Done + + + + + SwitchingEventList + + + Status + + + + + From + + + + + To + + + + + Repeat + + diff --git a/switchingeventlist.cpp b/switchingeventlist.cpp index abcc147..8773bcb 100644 --- a/switchingeventlist.cpp +++ b/switchingeventlist.cpp @@ -25,6 +25,8 @@ #include "eventlistdelegate.h" #include "alarmd_backend.h" +const int ROW_HEIGHT = 60; + SwitchingEventList::SwitchingEventList(QWidget *parent) : QTableView(parent) { @@ -44,6 +46,11 @@ SwitchingEventList::SwitchingEventList(QWidget *parent) : hideColumn(EV_ID); // Load saved events loadSavedEvents(); + // Height hint + if(verticalHeader()->defaultSectionSize() < ROW_HEIGHT) + verticalHeader()->setDefaultSectionSize(ROW_HEIGHT); + if (sizeHintForRow(0)>0) + setMinimumHeight(sizeHintForRow(0) * 5); } SwitchingEventList::~SwitchingEventList() { @@ -51,7 +58,7 @@ SwitchingEventList::~SwitchingEventList() { } void SwitchingEventList::updateRow(int row, ProfileEvent *pe) { - model->setData(model->index(row, EV_STATUS), pe->activated); + model->setData(model->index(row, EV_STATUS), pe->activated, Qt::UserRole); model->setData(model->index(row, EV_FROM), pe->from_time.toString()); model->setData(model->index(row, EV_TO), pe->to_time.toString()); model->setData(model->index(row, EV_REPEAT), ProfileEvent::formatDays(pe->days)); @@ -101,8 +108,8 @@ void SwitchingEventList::loadSavedEvents() { long to_cookie = settings.value("unsilencing_cookie", 0).toLongLong(); if(to_cookie > 0) pe.alarmd_cookies << to_cookie; - if(to_cookie == 0 || from_cookie == 0) - pe.activated = 0; + if(to_cookie <= 0 || from_cookie <= 0) + pe.activated = false; events.insert(pe.getID(), pe.save()); // Remove old format values settings.clear(); @@ -145,7 +152,7 @@ void SwitchingEventList::editEvent(QByteArray id, bool new_status) { const int row = getRowFromID(id); qDebug("Editing event at row %d", row); Q_ASSERT(row >= 0); - model->setData(model->index(row, EV_STATUS), new_status); + model->setData(model->index(row, EV_STATUS), new_status, Qt::UserRole); } void SwitchingEventList::deleteEvent(QByteArray id) {