mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Add new QCheckBox in QET settings for Keep projects in read-only, their
files will cannot be over written git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4872 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -238,6 +238,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool();
|
bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool();
|
||||||
bool terminal_exportlist = settings.value("nomenclature-exportlist", true).toBool();
|
bool terminal_exportlist = settings.value("nomenclature-exportlist", true).toBool();
|
||||||
QString default_element_informations = settings.value("elementeditor/default-informations", "").toString();
|
QString default_element_informations = settings.value("elementeditor/default-informations", "").toString();
|
||||||
|
bool readonly = settings.value("qetproject/readonly", false).toBool();
|
||||||
|
|
||||||
appearance_ = new QGroupBox(tr("Apparence"), this);
|
appearance_ = new QGroupBox(tr("Apparence"), this);
|
||||||
use_system_colors_ = new QCheckBox(tr("Utiliser les couleurs du système"), appearance_);
|
use_system_colors_ = new QCheckBox(tr("Utiliser les couleurs du système"), appearance_);
|
||||||
@@ -249,6 +250,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
folio_panel_ = new QCheckBox(tr("Utiliser les labels de folio à la place de leurs ID"), projects_view_mode_);
|
folio_panel_ = new QCheckBox(tr("Utiliser les labels de folio à la place de leurs ID"), projects_view_mode_);
|
||||||
terminal_exportlist_ = new QCheckBox(tr("Exporter les bornes dans la nomenclature"), projects_view_mode_);
|
terminal_exportlist_ = new QCheckBox(tr("Exporter les bornes dans la nomenclature"), projects_view_mode_);
|
||||||
m_zoom_out_beyond_folio = new QCheckBox(tr("Autoriser le dézoom au delà du folio"), this);
|
m_zoom_out_beyond_folio = new QCheckBox(tr("Autoriser le dézoom au delà du folio"), this);
|
||||||
|
readonly_ = new QCheckBox(tr("Keep projects in read-only, their files will cannot be over written"), this);
|
||||||
|
|
||||||
elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
|
elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
|
||||||
highlight_integrated_elements_ = new QCheckBox(tr("Mettre en valeur dans le panel les éléments fraîchement intégrés", "configuration option"));
|
highlight_integrated_elements_ = new QCheckBox(tr("Mettre en valeur dans le panel les éléments fraîchement intégrés", "configuration option"));
|
||||||
@@ -268,6 +270,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
save_label_paste_ -> setChecked(save_label_paste);
|
save_label_paste_ -> setChecked(save_label_paste);
|
||||||
folio_panel_ ->setChecked(panel_folio);
|
folio_panel_ ->setChecked(panel_folio);
|
||||||
terminal_exportlist_ ->setChecked(terminal_exportlist);
|
terminal_exportlist_ ->setChecked(terminal_exportlist);
|
||||||
|
readonly_ ->setChecked(readonly);
|
||||||
|
|
||||||
if (tabbed) {
|
if (tabbed) {
|
||||||
tabbed_mode_ -> setChecked(true);
|
tabbed_mode_ -> setChecked(true);
|
||||||
@@ -292,6 +295,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
projects_view_mode_layout -> addWidget(save_label_paste_);
|
projects_view_mode_layout -> addWidget(save_label_paste_);
|
||||||
projects_view_mode_layout -> addWidget(folio_panel_);
|
projects_view_mode_layout -> addWidget(folio_panel_);
|
||||||
projects_view_mode_layout -> addWidget(terminal_exportlist_);
|
projects_view_mode_layout -> addWidget(terminal_exportlist_);
|
||||||
|
projects_view_mode_layout -> addWidget(readonly_);
|
||||||
|
|
||||||
projects_view_mode_ -> setLayout(projects_view_mode_layout);
|
projects_view_mode_ -> setLayout(projects_view_mode_layout);
|
||||||
|
|
||||||
@@ -359,6 +363,7 @@ void GeneralConfigurationPage::applyConf()
|
|||||||
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked());
|
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked());
|
||||||
settings.setValue("genericpanel/folio",folio_panel_->isChecked());
|
settings.setValue("genericpanel/folio",folio_panel_->isChecked());
|
||||||
settings.setValue("nomenclature/terminal-exportlist",terminal_exportlist_->isChecked());
|
settings.setValue("nomenclature/terminal-exportlist",terminal_exportlist_->isChecked());
|
||||||
|
settings.setValue("qetproject/readonly",readonly_->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return l'icone de cette page
|
/// @return l'icone de cette page
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ class GeneralConfigurationPage : public ConfigPage {
|
|||||||
QCheckBox *save_label_paste_;
|
QCheckBox *save_label_paste_;
|
||||||
QCheckBox *folio_panel_;
|
QCheckBox *folio_panel_;
|
||||||
QCheckBox *terminal_exportlist_;
|
QCheckBox *terminal_exportlist_;
|
||||||
|
QCheckBox *readonly_;
|
||||||
QGroupBox *projects_view_mode_;
|
QGroupBox *projects_view_mode_;
|
||||||
QRadioButton *windowed_mode_;
|
QRadioButton *windowed_mode_;
|
||||||
QRadioButton *tabbed_mode_;
|
QRadioButton *tabbed_mode_;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
|||||||
m_auto_conductor (true ),
|
m_auto_conductor (true ),
|
||||||
m_elements_collection (nullptr)
|
m_elements_collection (nullptr)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
//Open the file
|
//Open the file
|
||||||
QFile project_file(path);
|
QFile project_file(path);
|
||||||
if (!project_file.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!project_file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
@@ -798,6 +799,10 @@ QETResult QETProject::write()
|
|||||||
// if the project was opened read-only and the file is still non-writable, do not save the project
|
// if the project was opened read-only and the file is still non-writable, do not save the project
|
||||||
if (isReadOnly() && !QFileInfo(file_path_).isWritable())
|
if (isReadOnly() && !QFileInfo(file_path_).isWritable())
|
||||||
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
|
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
|
||||||
|
|
||||||
|
if (settings.value("qetproject/readonly", true).toBool()){
|
||||||
|
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
|
||||||
|
}
|
||||||
|
|
||||||
//Get the project in xml
|
//Get the project in xml
|
||||||
QDomDocument xml_project;
|
QDomDocument xml_project;
|
||||||
|
|||||||
Reference in New Issue
Block a user