mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
New diagram properties dialog :
Merge the dialog of default configuration and the dialog of project configuration, into a single configuration dialog. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3317 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -207,143 +207,6 @@ void ProjectMainConfigPage::adjustReadOnly() {
|
||||
|
||||
//######################################################################################//
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@param project Project this page is editing.
|
||||
@param parent Parent QWidget
|
||||
*/
|
||||
ProjectNewDiagramConfigPage::ProjectNewDiagramConfigPage(QETProject *project, QWidget *parent) :
|
||||
ProjectConfigPage(project, parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
ProjectNewDiagramConfigPage::~ProjectNewDiagramConfigPage() {
|
||||
}
|
||||
|
||||
/**
|
||||
@return the title for this page
|
||||
*/
|
||||
QString ProjectNewDiagramConfigPage::title() const {
|
||||
return(tr("Nouveau sch\351ma", "project configuration page title"));
|
||||
}
|
||||
|
||||
/**
|
||||
@return the icon for this page
|
||||
*/
|
||||
QIcon ProjectNewDiagramConfigPage::icon() const {
|
||||
return(QET::Icons::NewDiagram);
|
||||
}
|
||||
|
||||
/**
|
||||
Apply the configuration after user input
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::applyProjectConf() {
|
||||
bool modified_project = false;
|
||||
|
||||
BorderProperties new_border_prop = border_ -> properties();
|
||||
if (project_ -> defaultBorderProperties() != new_border_prop) {
|
||||
project_ -> setDefaultBorderProperties(border_ -> properties());
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
TitleBlockProperties new_tbt_prop = titleblock_ -> properties();
|
||||
if (project_ -> defaultTitleBlockProperties() != new_tbt_prop) {
|
||||
project_ -> setDefaultTitleBlockProperties(titleblock_ -> properties());
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
ConductorProperties new_conductor_prop = conductor_ -> properties();
|
||||
if (project_ -> defaultConductorProperties() != new_conductor_prop) {
|
||||
project_ -> setDefaultConductorProperties(conductor_ -> properties());
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
QString new_report_prop = report_->ReportProperties();
|
||||
if (project_->defaultReportProperties() != new_report_prop) {
|
||||
project_->setDefaultReportProperties(new_report_prop);
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
QHash<QString, XRefProperties> new_xref_properties = xref_ -> properties();
|
||||
if (project_ -> defaultXRefProperties() != new_xref_properties) {
|
||||
project_ -> setDefaultXRefProperties(new_xref_properties);
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
if (modified_project) {
|
||||
project_ -> setModified(modified_project);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize widgets displayed by the page.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::initWidgets() {
|
||||
informative_label_ = new QLabel(
|
||||
tr(
|
||||
"Propri\351t\351s \340 utiliser lors de l'ajout d'un nouveau sch\351ma au projet :",
|
||||
"explicative label"
|
||||
)
|
||||
);
|
||||
border_ = new BorderPropertiesWidget(BorderProperties());
|
||||
titleblock_ = new TitleBlockPropertiesWidget(TitleBlockProperties(), true);
|
||||
conductor_ = new ConductorPropertiesWidget();
|
||||
conductor_ -> setContentsMargins(0, 0, 0, 0);
|
||||
report_ = new ReportPropertieWidget("_");
|
||||
xref_ = new XRefPropertiesWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the layout of this page.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::initLayout() {
|
||||
// main tab widget
|
||||
QTabWidget *tab_widget = new QTabWidget(this);
|
||||
|
||||
QWidget *diagram_widget = new QWidget();
|
||||
QVBoxLayout *diagram_layout = new QVBoxLayout(diagram_widget);
|
||||
diagram_layout -> addWidget(border_);
|
||||
diagram_layout -> addWidget(titleblock_);
|
||||
|
||||
tab_widget -> addTab (diagram_widget, tr("Sch\351ma"));
|
||||
tab_widget -> addTab (conductor_, tr("Conducteur"));
|
||||
tab_widget -> addTab (report_, tr("Report de folio"));
|
||||
tab_widget -> addTab (xref_, tr("R\351f\351rence crois\351es"));
|
||||
|
||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
||||
vlayout1->addWidget(tab_widget);
|
||||
|
||||
setLayout(vlayout1);
|
||||
}
|
||||
|
||||
/**
|
||||
Read properties from the edited project then fill widgets with them.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::readValuesFromProject() {
|
||||
border_ -> setProperties (project_ -> defaultBorderProperties());
|
||||
conductor_ -> setProperties (project_ -> defaultConductorProperties());
|
||||
titleblock_ -> setProperties (project_ -> defaultTitleBlockProperties());
|
||||
report_ -> setReportProperties (project_ -> defaultReportProperties());
|
||||
xref_ -> setProperties (project_ -> defaultXRefProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
editable if the project is editable.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::adjustReadOnly() {
|
||||
bool is_read_only = project_ -> isReadOnly();
|
||||
border_ -> setReadOnly(is_read_only);
|
||||
titleblock_ -> setReadOnly(is_read_only);
|
||||
conductor_ -> setReadOnly(is_read_only);
|
||||
xref_ -> setReadOnly(is_read_only);
|
||||
}
|
||||
|
||||
//######################################################################################//
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::ProjectAutoNumConfigPage
|
||||
* Default constructor
|
||||
|
||||
Reference in New Issue
Block a user