Added initial preferences dialog.
This commit is contained in:
@@ -37,6 +37,7 @@ set (glabels_sources
|
|||||||
ObjectEditor.cpp
|
ObjectEditor.cpp
|
||||||
Outline.cpp
|
Outline.cpp
|
||||||
PageRenderer.cpp
|
PageRenderer.cpp
|
||||||
|
PreferencesDialog.cpp
|
||||||
PrintView.cpp
|
PrintView.cpp
|
||||||
PropertiesView.cpp
|
PropertiesView.cpp
|
||||||
Preview.cpp
|
Preview.cpp
|
||||||
@@ -74,6 +75,7 @@ set (glabels_qobject_headers
|
|||||||
Merge.h
|
Merge.h
|
||||||
MergePropertyEditor.h
|
MergePropertyEditor.h
|
||||||
ObjectEditor.h
|
ObjectEditor.h
|
||||||
|
PreferencesDialog.h
|
||||||
PrintView.h
|
PrintView.h
|
||||||
PropertiesView.h
|
PropertiesView.h
|
||||||
Preview.h
|
Preview.h
|
||||||
@@ -88,6 +90,7 @@ set (glabels_qobject_headers
|
|||||||
set (glabels_forms
|
set (glabels_forms
|
||||||
ui/MergePropertyEditor.ui
|
ui/MergePropertyEditor.ui
|
||||||
ui/ObjectEditor.ui
|
ui/ObjectEditor.ui
|
||||||
|
ui/PreferencesDialog.ui
|
||||||
ui/PrintView.ui
|
ui/PrintView.ui
|
||||||
ui/PropertiesView.ui
|
ui/PropertiesView.ui
|
||||||
ui/SelectProductDialog.ui
|
ui/SelectProductDialog.ui
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "libglabels/Db.h"
|
#include "libglabels/Db.h"
|
||||||
|
#include "PreferencesDialog.h"
|
||||||
#include "PropertiesView.h"
|
#include "PropertiesView.h"
|
||||||
#include "View.h"
|
#include "View.h"
|
||||||
#include "ObjectEditor.h"
|
#include "ObjectEditor.h"
|
||||||
@@ -983,7 +984,8 @@ void MainWindow::editUnSelectAll()
|
|||||||
///
|
///
|
||||||
void MainWindow::editPreferences()
|
void MainWindow::editPreferences()
|
||||||
{
|
{
|
||||||
qDebug() << "ACTION: edit->Preferences";
|
PreferencesDialog dialog( this );
|
||||||
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/* PreferencesDialog.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PreferencesDialog.h"
|
||||||
|
|
||||||
|
#include "Settings.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
PreferencesDialog::PreferencesDialog( QWidget *parent )
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
setupUi( this );
|
||||||
|
|
||||||
|
switch ( Settings::units() )
|
||||||
|
{
|
||||||
|
case glabels::Distance::Units::IN:
|
||||||
|
unitsInchesRadio->setChecked( true );
|
||||||
|
break;
|
||||||
|
case glabels::Distance::Units::MM:
|
||||||
|
unitsMillimetersRadio->setChecked( true );
|
||||||
|
break;
|
||||||
|
case glabels::Distance::Units::CM:
|
||||||
|
unitsCentimetersRadio->setChecked( true );
|
||||||
|
break;
|
||||||
|
case glabels::Distance::Units::PC:
|
||||||
|
unitsPicasRadio->setChecked( true );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unitsPointsRadio->setChecked( true );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Settings::preferIsoPaperSizes() )
|
||||||
|
{
|
||||||
|
preferedPaperSizesIsoRadio->setChecked( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preferedPaperSizesUsRadio->setChecked( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Units Radios Changed
|
||||||
|
///
|
||||||
|
void PreferencesDialog::onUnitsRadiosChanged()
|
||||||
|
{
|
||||||
|
if ( unitsInchesRadio->isChecked() )
|
||||||
|
{
|
||||||
|
Settings::setUnits( glabels::Distance::Units::IN );
|
||||||
|
}
|
||||||
|
else if ( unitsMillimetersRadio->isChecked() )
|
||||||
|
{
|
||||||
|
Settings::setUnits( glabels::Distance::Units::MM );
|
||||||
|
}
|
||||||
|
else if ( unitsCentimetersRadio->isChecked() )
|
||||||
|
{
|
||||||
|
Settings::setUnits( glabels::Distance::Units::CM );
|
||||||
|
}
|
||||||
|
else if ( unitsPicasRadio->isChecked() )
|
||||||
|
{
|
||||||
|
Settings::setUnits( glabels::Distance::Units::PC );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Settings::setUnits( glabels::Distance::Units::PT );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Prefered Paper Sizes Radios Changed
|
||||||
|
///
|
||||||
|
void PreferencesDialog::onPreferedPaperSizesRadiosChanged()
|
||||||
|
{
|
||||||
|
Settings::setPreferIsoPaperSizes( preferedPaperSizesIsoRadio->isChecked() );
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/* PreferencesDialog.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PreferencesDialog_h
|
||||||
|
#define PreferencesDialog_h
|
||||||
|
|
||||||
|
#include "ui_PreferencesDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// New Label Dialog Widget
|
||||||
|
///
|
||||||
|
class PreferencesDialog : public QDialog, public Ui_PreferencesDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Life Cycle
|
||||||
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
|
PreferencesDialog( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Slots
|
||||||
|
/////////////////////////////////
|
||||||
|
private slots:
|
||||||
|
void onUnitsRadiosChanged();
|
||||||
|
void onPreferedPaperSizesRadiosChanged();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PreferencesDialog_h
|
||||||
@@ -88,14 +88,13 @@ glabels::Distance::Units Settings::units()
|
|||||||
{
|
{
|
||||||
// Guess at a suitable default
|
// Guess at a suitable default
|
||||||
QString defaultIdString;
|
QString defaultIdString;
|
||||||
switch (QLocale::system().measurementSystem())
|
if ( QLocale::system().measurementSystem() == QLocale::ImperialSystem )
|
||||||
{
|
{
|
||||||
case QLocale::ImperialSystem:
|
defaultIdString = glabels::Distance::toId( glabels::Distance::Units::IN );
|
||||||
defaultIdString = "in";
|
}
|
||||||
break;
|
else
|
||||||
default:
|
{
|
||||||
defaultIdString = "mm";
|
defaultIdString = glabels::Distance::toId( glabels::Distance::Units::MM );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mInstance->beginGroup( "Locale" );
|
mInstance->beginGroup( "Locale" );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "libglabels/Db.h"
|
#include "libglabels/Db.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "StartupWizard.h"
|
#include "StartupWizard.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ int main( int argc, char **argv )
|
|||||||
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
||||||
QCoreApplication::setApplicationName( "glabels-qt" );
|
QCoreApplication::setApplicationName( "glabels-qt" );
|
||||||
|
|
||||||
|
Settings::init();
|
||||||
glabels::Db::init();
|
glabels::Db::init();
|
||||||
////// TEMPORARY TESTING ////////
|
////// TEMPORARY TESTING ////////
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -0,0 +1,265 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PreferencesDialog</class>
|
||||||
|
<widget class="QDialog" name="PreferencesDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>299</width>
|
||||||
|
<height>385</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>gLabels - Preferences</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Locale</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select locale specific behavior.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Units</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QRadioButton" name="unitsPointsRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Points</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QRadioButton" name="unitsCentimetersRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Centimeters</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QRadioButton" name="unitsMillimetersRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Millimeters</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QRadioButton" name="unitsInchesRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Inches</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QRadioButton" name="unitsPicasRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Picas</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Prefered Paper Sizes</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="preferedPaperSizesUsRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>US</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QRadioButton" name="preferedPaperSizesIsoRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>ISO</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>clicked(QAbstractButton*)</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>289</x>
|
||||||
|
<y>368</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>312</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unitsPointsRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>184</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>105</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unitsInchesRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>102</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>139</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unitsMillimetersRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>131</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>172</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>preferedPaperSizesUsRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onPreferedPaperSizesRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>276</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>221</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>preferedPaperSizesIsoRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onPreferedPaperSizesRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>303</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>298</x>
|
||||||
|
<y>255</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unitsCentimetersRadio</sender>
|
||||||
|
<signal>clicked(bool)</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>264</x>
|
||||||
|
<y>154</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>295</x>
|
||||||
|
<y>164</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unitsPicasRadio</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PreferencesDialog</receiver>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>243</x>
|
||||||
|
<y>215</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>295</x>
|
||||||
|
<y>215</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot>onUnitsRadiosChanged()</slot>
|
||||||
|
<slot>onPreferedPaperSizesRadiosChanged()</slot>
|
||||||
|
</slots>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user