File indexing completed on 2024-04-28 04:32:02
0001 /* 0002 * Copyright (C) 2010-2015 by Stephen Allewell 0003 * steve.allewell@gmail.com 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 */ 0010 0011 #include "LibraryPatternPropertiesDlg.h" 0012 0013 #include <QIcon> 0014 0015 #include <KConfigGroup> 0016 #include <KHelpClient> 0017 #include <KLocalizedString> 0018 #include <KSharedConfig> 0019 0020 LibraryPatternPropertiesDlg::LibraryPatternPropertiesDlg(QWidget *parent, 0021 qint32 key, 0022 Qt::KeyboardModifiers modifiers, 0023 qint16 baseline, 0024 const QString &scheme, 0025 int width, 0026 int height, 0027 const QIcon &icon) 0028 : QDialog(parent) 0029 { 0030 setWindowTitle(i18n("Library Pattern Properties")); 0031 ui.setupUi(this); 0032 0033 ui.FlossScheme->setText(scheme); 0034 ui.Width->setText(QString().setNum(width)); 0035 ui.Height->setText(QString().setNum(height)); 0036 ui.Baseline->setValue(baseline); 0037 ui.KeyCode->setKeyModifiers(key, modifiers); 0038 ui.Icon->setPixmap(icon.pixmap(ui.Icon->size())); 0039 } 0040 0041 qint32 LibraryPatternPropertiesDlg::key() const 0042 { 0043 return ui.KeyCode->key(); 0044 } 0045 0046 Qt::KeyboardModifiers LibraryPatternPropertiesDlg::modifiers() const 0047 { 0048 return ui.KeyCode->modifiers(); 0049 } 0050 0051 qint16 LibraryPatternPropertiesDlg::baseline() const 0052 { 0053 return ui.Baseline->value(); 0054 } 0055 0056 void LibraryPatternPropertiesDlg::hideEvent(QHideEvent *event) 0057 { 0058 KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("LibraryPatternPropertiesDlg"), size()); 0059 0060 QDialog::hideEvent(event); 0061 } 0062 0063 void LibraryPatternPropertiesDlg::showEvent(QShowEvent *event) 0064 { 0065 QDialog::showEvent(event); 0066 0067 if (KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).hasKey(QStringLiteral("LibraryPatternPropertiesDlg"))) { 0068 resize(KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).readEntry(QStringLiteral("LibraryPatternPropertiesDlg"), QSize())); 0069 } 0070 } 0071 0072 void LibraryPatternPropertiesDlg::on_DialogButtonBox_accepted() 0073 { 0074 accept(); 0075 } 0076 0077 void LibraryPatternPropertiesDlg::on_DialogButtonBox_rejected() 0078 { 0079 reject(); 0080 } 0081 0082 void LibraryPatternPropertiesDlg::on_DialogButtonBox_helpRequested() 0083 { 0084 KHelpClient::invokeHelp(QStringLiteral("PatternLibraryDialog"), QStringLiteral("kxstitch")); 0085 } 0086 0087 #include "moc_LibraryPatternPropertiesDlg.cpp"