r25009 by craig - Rename ok/cancel button variables in NewDocDialog and use
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 10 22:15:48 UTC 2022
Author: craig
Date: Thu Mar 10 22:15:48 2022
New Revision: 25009
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25009
Log:
Rename ok/cancel button variables in NewDocDialog and use
QDialogButtonBox in PreferencesDialog. Remove old Apply Button
Modified:
trunk/Scribus/scribus/ui/newdocdialog.cpp
trunk/Scribus/scribus/ui/newdocdialog.h
trunk/Scribus/scribus/ui/preferencesdialog.cpp
trunk/Scribus/scribus/ui/preferencesdialog.h
trunk/Scribus/scribus/ui/preferencesdialogbase.ui
Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25009&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp Thu Mar 10 22:15:48 2022
@@ -145,12 +145,12 @@
Layout1->addItem( spacer );
buttonBox = new QDialogButtonBox();
Layout1->addWidget(buttonBox);
- OKButton = new QPushButton( CommonStrings::tr_OK, this );
- OKButton->setDefault( true );
- buttonBox->addButton(OKButton, QDialogButtonBox::AcceptRole);
- CancelB = new QPushButton( CommonStrings::tr_Cancel, this );
- CancelB->setAutoDefault( false );
- buttonBox->addButton(CancelB, QDialogButtonBox::RejectRole);
+ okButton = new QPushButton( CommonStrings::tr_OK, this );
+ okButton->setDefault( true );
+ buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole);
+ cancelButton = new QPushButton( CommonStrings::tr_Cancel, this );
+ cancelButton->setAutoDefault( false );
+ buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole);
TabbedNewDocLayout->addLayout( Layout1 );
//tooltips
pageSizeComboBox->setToolTip( tr( "Document page size, either a standard size or a custom size" ) );
@@ -693,7 +693,7 @@
setWindowTitle(tr("Open Recent Document"));
else
setWindowTitle(tr("New Document"));
- OKButton->setEnabled(tab!=2);
+ okButton->setEnabled(tab!=2);
}
void NewDocDialog::locationDropped(const QString& fileUrl)
@@ -745,5 +745,5 @@
void NewDocDialog::openFileDialogFileClicked(const QString& path)
{
- OKButton->setEnabled(!path.isEmpty());
-}
+ okButton->setEnabled(!path.isEmpty());
+}
Modified: trunk/Scribus/scribus/ui/newdocdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25009&path=/trunk/Scribus/scribus/ui/newdocdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.h (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.h Thu Mar 10 22:15:48 2022
@@ -110,26 +110,26 @@
QFrame* recentDocFrame {nullptr};
QListWidget* recentDocListBox {nullptr};
QDialogButtonBox* buttonBox {nullptr};
- QPushButton* OKButton {nullptr};
- QPushButton* CancelB {nullptr};
+ QPushButton* okButton {nullptr};
+ QPushButton* cancelButton {nullptr};
bool onStartup() const { return m_onStartup;}
- int tabSelected() const { return m_tabSelected;}
+ int tabSelected() const { return m_tabSelected;}
QString selectedFile() const { return m_selectedFile; }
- int unitIndex() const { return m_unitIndex;}
+ int unitIndex() const { return m_unitIndex;}
QString unitSuffix() const { return m_unitSuffix;}
- double unitRatio() const { return m_unitRatio; }
+ double unitRatio() const { return m_unitRatio; }
- int orientation() const { return m_orientation;}
- int choosenLayout() const { return m_choosenLayout;}
+ int orientation() const { return m_orientation;}
+ int choosenLayout() const { return m_choosenLayout;}
double pageWidth() const { return m_pageWidth;}
double pageHeight() const { return m_pageHeight;}
double distance() const { return m_distance;}
double bleedBottom() const { return m_bleedBottom;}
- double bleedTop() const { return m_bleedTop;}
- double bleedLeft() const { return m_bleedLeft;}
- double bleedRight() const { return m_bleedRight;}
+ double bleedTop() const { return m_bleedTop;}
+ double bleedLeft() const { return m_bleedLeft;}
+ double bleedRight() const { return m_bleedRight;}
public slots:
void setHeight(double v);
Modified: trunk/Scribus/scribus/ui/preferencesdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25009&path=/trunk/Scribus/scribus/ui/preferencesdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/preferencesdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/preferencesdialog.cpp Thu Mar 10 22:15:48 2022
@@ -6,6 +6,7 @@
*/
#include <QDebug>
+#include <QDialogButtonBox>
#include <QPushButton>
#include <QLayout>
#include <QListWidget>
@@ -32,7 +33,6 @@
while (prefsStackWidget->currentWidget()!=nullptr)
prefsStackWidget->removeWidget(prefsStackWidget->currentWidget());
- applyButton->hide();
exportButton->hide();
if(doc)
@@ -138,14 +138,10 @@
connect(prefs_DocumentSetup, SIGNAL(changeToOtherSection(QString)), this, SLOT(setNewItemSelected(QString)));
connect(prefs_DocumentSetup, SIGNAL(prefsChangeUnits(int)), this, SLOT(changeUnits(int)));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
- connect(applyButton, SIGNAL(clicked()), this, SLOT(applyButtonClicked()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::reject);
connect(preferencesTypeList, SIGNAL(itemSelectionChanged()), this, SLOT(newItemSelected()));
}
-
-
-PreferencesDialog::~PreferencesDialog() = default;
void PreferencesDialog::restoreDefaults()
{
@@ -225,13 +221,6 @@
if (prefs_ImageCache) prefs_ImageCache->saveGuiToPrefs(&localPrefs);
}
-void PreferencesDialog::applyButtonClicked()
-{
- Prefs_Pane* pp=qobject_cast<Prefs_Pane *>(prefsStackWidget->currentWidget());
- if (pp)
- pp->saveGuiToPrefs(&localPrefs);
-}
-
void PreferencesDialog::accept()
{
saveGuiToPrefs();
Modified: trunk/Scribus/scribus/ui/preferencesdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25009&path=/trunk/Scribus/scribus/ui/preferencesdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/preferencesdialog.h (original)
+++ trunk/Scribus/scribus/ui/preferencesdialog.h Thu Mar 10 22:15:48 2022
@@ -56,7 +56,7 @@
public:
PreferencesDialog(QWidget* parent, ApplicationPrefs& prefsData, ScribusDoc *doc=nullptr);
- ~PreferencesDialog();
+ ~PreferencesDialog() = default;
ApplicationPrefs prefs() const { return localPrefs; }
void getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins);
@@ -74,7 +74,6 @@
protected slots:
virtual void languageChange();
- void applyButtonClicked();
protected:
void addWidget(Prefs_Pane* tab);
Modified: trunk/Scribus/scribus/ui/preferencesdialogbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25009&path=/trunk/Scribus/scribus/ui/preferencesdialogbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/preferencesdialogbase.ui (original)
+++ trunk/Scribus/scribus/ui/preferencesdialogbase.ui Thu Mar 10 22:15:48 2022
@@ -11,29 +11,29 @@
</rect>
</property>
<property name="windowTitle">
- <string>Preferences</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>9</number>
- </property>
- <property name="topMargin">
- <number>9</number>
- </property>
- <property name="rightMargin">
- <number>9</number>
- </property>
- <property name="bottomMargin">
- <number>9</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="frameHorizontalLayout">
- <property name="spacing">
- <number>9</number>
- </property>
- <item>
- <widget class="QListWidget" name="preferencesTypeList">
- <property name="minimumSize">
+ <string>Preferences</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="frameHorizontalLayout">
+ <property name="spacing">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QListWidget" name="preferencesTypeList">
+ <property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
@@ -52,7 +52,7 @@
<bool>false</bool>
</property>
<property name="dragDropMode">
- <enum>QAbstractItemView::NoDragDrop</enum>
+ <enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
@@ -63,95 +63,72 @@
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <property name="spacing">
- <number>9</number>
- </property>
- <item>
- <widget class="QStackedWidget" name="prefsStackWidget">
- <widget class="QWidget" name="page_2"/>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="buttonHorizontalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="exportButton">
- <property name="text">
- <string>Export...</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="defaultsButton">
- <property name="text">
- <string>Defaults</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="buttonHorizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="applyButton">
- <property name="text">
- <string>&Apply</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="okButton">
- <property name="text">
- <string>&OK</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelButton">
- <property name="text">
- <string>&Cancel</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </item>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="spacing">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QStackedWidget" name="prefsStackWidget">
+ <widget class="QWidget" name="page_2"/>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="buttonHorizontalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="exportButton">
+ <property name="text">
+ <string>Export...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="defaultsButton">
+ <property name="text">
+ <string>Defaults</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="buttonHorizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<resources/>
More information about the scribus-commit
mailing list