File indexing completed on 2024-04-28 04:32:00
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 "ExtendPatternDlg.h" 0012 0013 #include <KConfigGroup> 0014 #include <KHelpClient> 0015 #include <KLocalizedString> 0016 #include <KSharedConfig> 0017 0018 ExtendPatternDlg::ExtendPatternDlg(QWidget *parent) 0019 : QDialog(parent) 0020 { 0021 setWindowTitle(i18n("Extend Pattern")); 0022 ui.setupUi(this); 0023 } 0024 0025 int ExtendPatternDlg::top() const 0026 { 0027 return ui.TopMargin->value(); 0028 } 0029 0030 int ExtendPatternDlg::left() const 0031 { 0032 return ui.LeftMargin->value(); 0033 } 0034 0035 int ExtendPatternDlg::right() const 0036 { 0037 return ui.RightMargin->value(); 0038 } 0039 0040 int ExtendPatternDlg::bottom() const 0041 { 0042 return ui.BottomMargin->value(); 0043 } 0044 0045 void ExtendPatternDlg::hideEvent(QHideEvent *event) 0046 { 0047 KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("ExtendPatternDlg"), size()); 0048 0049 QDialog::hideEvent(event); 0050 } 0051 0052 void ExtendPatternDlg::showEvent(QShowEvent *event) 0053 { 0054 QDialog::showEvent(event); 0055 0056 if (KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).hasKey(QStringLiteral("ExtendPatternDlg"))) { 0057 resize(KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("DialogSizes")).readEntry(QStringLiteral("ExtendPatternDlg"), QSize())); 0058 } 0059 } 0060 0061 void ExtendPatternDlg::on_DialogButtonBox_accepted() 0062 { 0063 accept(); 0064 } 0065 0066 void ExtendPatternDlg::on_DialogButtonBox_rejected() 0067 { 0068 reject(); 0069 } 0070 0071 void ExtendPatternDlg::on_DialogButtonBox_helpRequested() 0072 { 0073 KHelpClient::invokeHelp(QStringLiteral("ExtendPatternDialog"), QStringLiteral("kxstitch")); 0074 } 0075 0076 #include "moc_ExtendPatternDlg.cpp"