if ( _app_version.isEmpty() )
{
QString resVersion = tr( "APP_VERSION" );
- if ( resVersion != "APP_VERSION" )
+ if ( resVersion != "APP_VERSION" )
{
_app_version = resVersion;
}
- else
+ else
{
QString path( ::getenv( "GUI_ROOT_DIR" ) );
if ( !path.isEmpty() )
QString line;
vf.readLine( line, 1024 );
vf.close();
-
+
if ( !line.isEmpty() )
{
while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
line.remove( line.length() - 1, 1 );
-
+
int idx = line.findRev( ":" );
if ( idx != -1 )
- _app_version = line.mid( idx + 1 ).stripWhiteSpace();
+ _app_version = line.mid( idx + 1 ).stripWhiteSpace();
}
}
}
if ( actName == modName )
return true;
- putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) );
+ putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) );
saveWindowsGeometry();
updateModuleActions();
- putInfo( "" );
+ putInfo( "" );
if ( !status )
return false;
_PTR(Study) aStudyDS = aStudy->studyDS();
_PTR(StudyBuilder) aStudyBuilder = aStudyDS->NewBuilder();
_PTR(SObject) anObj;
-
+
for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
{
if ( it.Value()->hasEntry() )
pref->setItemProperty( vtkTS, "min", 1 );
pref->setItemProperty( vtkTS, "max", 150 );
-
+
pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
SalomeApp_Preferences::Bool, "Plot2d", "ShowLegend" );
aLegendPosList.append( tr("PREF_RIGHT") );
aLegendPosList.append( tr("PREF_TOP") );
aLegendPosList.append( tr("PREF_BOTTOM") );
-
+
QValueList<QVariant> anIndexesList;
anIndexesList.append(0);
anIndexesList.append(1);
anIndexesList.append(2);
anIndexesList.append(3);
-
+
pref->setItemProperty( legendPosition, "strings", aLegendPosList );
pref->setItemProperty( legendPosition, "indexes", anIndexesList );
-
+
int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
SalomeApp_Preferences::Selector, "Plot2d", "CurveType" );
QStringList aCurveTypesList;
aCurveTypesList.append( tr("PREF_POINTS") );
aCurveTypesList.append( tr("PREF_LINES") );
aCurveTypesList.append( tr("PREF_SPLINE") );
-
+
anIndexesList.clear();
anIndexesList.append(0);
anIndexesList.append(1);
anIndexesList.append(2);
-
+
pref->setItemProperty( curveType, "strings", aCurveTypesList );
pref->setItemProperty( curveType, "indexes", anIndexesList );
pref->setItemProperty( markerSize, "min", 0 );
pref->setItemProperty( markerSize, "max", 100 );
-
+
QStringList aScaleModesList;
aScaleModesList.append( tr("PREF_LINEAR") );
aScaleModesList.append( tr("PREF_LOGARITHMIC") );
-
+
anIndexesList.clear();
anIndexesList.append(0);
anIndexesList.append(1);
-
+
int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
SalomeApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
SalomeApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
-
+
pref->setItemProperty( verScale, "strings", aScaleModesList );
pref->setItemProperty( verScale, "indexes", anIndexesList );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
SalomeApp_Preferences::Color, "Plot2d", "Background" );
-
+
int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
pref->setItemProperty( dirGroup, "columns", 1 );
//study->updateCaptions();
updateDesktopTitle();
+ updateActions();
}
/*!*/
mgr->selectedObjects(aList);
// "Delete reference" item should appear only for invalid references
-
+
// Check if selected objects is invalid references
bool isInvalidRefs = true;
-
+
if ( aList.Extent() < 1 )
isInvalidRefs = false;
-
+
if ( isInvalidRefs )
{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
_PTR(Study) aStudyDS = aStudy->studyDS();
_PTR(SObject) anObj;
-
+
for ( SALOME_ListIteratorOfListIO it( aList ); it.More() && isInvalidRefs; it.Next() )
{
if ( it.Value()->hasEntry() )
}
}
}
-
+
// Add "Delete refrence" item to popup
if ( isInvalidRefs )
{
if (currentModule && currentModule->moduleName() == aModuleTitle)
return;
thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
-
+
}
/*!Update obect browser*/
#include "SalomeApp_Study.h"
#include "SUIT_Session.h"
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+// OCCT Includes
+#include <OSD_Process.hxx>
+#include <Quantity_Date.hxx>
+// CORBA Headers
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+// QT Includes
#include <qpushbutton.h>
#include <qlayout.h>
+
using namespace std;
#define DEFAULT_MARGIN 11
{
QStringList list;
switch(getUserType()) {
- case SalomeApp_StudyPropertiesDlg::prpModeId:
- {
- list << SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_SCRATCH") <<
- SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_COPYFROM");
- theWidget->insertList(list);
- break;
- }
+ //case SalomeApp_StudyPropertiesDlg::prpModeId:
+ // {
+ // list << SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_SCRATCH") <<
+ // SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_COPYFROM");
+ // theWidget->insertList(list);
+ // break;
+ // }
case SalomeApp_StudyPropertiesDlg::prpLockedId:
{
list << SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) << SalomeApp_StudyPropertiesDlg::tr( "PRP_YES" );
- theWidget->insertList(list, getValue() == SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) ? 0 : 1 );
+ theWidget->insertList(list, getValue() == SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) ? 0 : 1 );
break;
}
case SalomeApp_StudyPropertiesDlg::prpModificationsId:
{
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if (study) {
+ SalomeApp_Study* study =
+ dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if (study) {
_PTR(Study) studyDoc = study->studyDS();
_PTR(AttributeStudyProperties) propAttr;
if ( studyDoc ) {
int aCnt = aUsers.size();
for ( int i = 0; i < aCnt; i++ ) {
QString val;
- val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [i],
- aMonths[i],
- aYears [i],
- aHours [i],
+ val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
+ aDays [i],
+ aMonths[i],
+ aYears [i],
+ aHours [i],
aMins [i]);
val = val + " : " + QString( aUsers[i].c_str() );
list.prepend(val);
}
theWidget->setDuplicatesEnabled(true);
- theWidget->insertList(list);
+ theWidget->insertList(list);
}
}
}
QGridLayout* mainLayout = new QGridLayout(this);
mainLayout->setMargin(DEFAULT_MARGIN);
mainLayout->setSpacing(DEFAULT_SPACING);
-
+
myPropList = new SalomeApp_ListView(this);
myPropList->addColumn("");
myPropList->addColumn("");
myCancelBtn = new QPushButton(tr("BUT_CANCEL"), this);
mainLayout->addWidget(myCancelBtn, 1, 2);
- QSpacerItem* spacer1 = new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ QSpacerItem* spacer1 =
+ new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum);
mainLayout->addItem(spacer1, 1, 1);
// Display study properties
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ SalomeApp_Study* study =
+ dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if (study)
myStudyDoc = study->studyDS();
{
bool hasData = myStudyDoc;
_PTR(AttributeStudyProperties) propAttr;
- if (hasData)
+ if (hasData)
propAttr = myStudyDoc->GetProperties();
hasData = hasData && propAttr;
item->setValue(strDate);
}
}
-
+
// Creation mode
// item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODE")+":", true, prpModeId);
// item->setEditingType( SalomeApp_EntityEdit::etComboBox);
// Locked or not
item = new SalomeApp_PropItem(myPropList, item, tr("PRP_LOCKED")+":", true, prpLockedId);
- item->setEditingType( SalomeApp_EntityEdit::etComboBox);
+ item->setEditingType( SalomeApp_EntityEdit::etComboBox);
if ( hasData )
item->setValue( tr( propAttr->IsLocked() ? "PRP_YES" : "PRP_NO" ) );
// Saved or not
item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFIED")+":", false, prpSavedId);
+ bool isModified = false;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>
+ (SUIT_Session::session()->activeApplication()->activeStudy());
+ if (study) {
+ isModified = study->isModified();
+ if (hasData) {
+ if (propAttr->IsModified() != isModified) {
+ propAttr->SetModified((int)isModified);
+ }
+ }
+ }
if (hasData) {
if (propAttr->IsModified())
item->setValue( tr( "PRP_YES" ) );
}
// Modifications list
- item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFICATIONS")+":", true, prpModificationsId);
- item->setEditingType( SalomeApp_EntityEdit::etComboBox);
- if (hasData) {
+ item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFICATIONS")+":", true, prpModificationsId);
+ item->setEditingType( SalomeApp_EntityEdit::etComboBox);
+ if (hasData) {
std::vector<std::string> aUsers;
std::vector<int> aMins, aHours, aDays, aMonths, aYears;
propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
int aLast = aUsers.size()-1;
if (aLast >= 0) {
QString val;
- val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [aLast],
- aMonths[aLast],
- aYears [aLast],
- aHours [aLast],
+ val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
+ aDays [aLast],
+ aMonths[aLast],
+ aYears [aLast],
+ aHours [aLast],
aMins [aLast]);
val = val + " : " + QString(aUsers[aUsers.size()-1].c_str());
item->setValue(val);
if (acceptData()) {
_PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
- myChanged = propChanged();
- if ( propAttr && myChanged ) {
+ //myChanged = propChanged();
+ if ( propAttr /*&& myChanged*/ ) {
QListViewItemIterator it( myPropList );
// iterate through all items of the listview
for ( ; it.current(); ++it ) {
SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
switch (item->getUserType()) {
case prpAuthorId:
- propAttr->SetUserName(item->getValue().stripWhiteSpace().latin1());
- break;
- case prpModeId:
- propAttr->SetCreationMode(item->getValue().stripWhiteSpace().latin1());
+ if (QString(propAttr->GetUserName().c_str()) != item->getValue().stripWhiteSpace()) {
+ if (!propAttr->IsLocked()) {
+ propAttr->SetUserName(item->getValue().stripWhiteSpace().latin1());
+ myChanged = true;
+ } else {
+ SUIT_MessageBox::warn1(SUIT_Session::session()->activeApplication()->desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK"));
+ }
+ }
break;
+ //case prpModeId:
+ // propAttr->SetCreationMode(item->getValue().stripWhiteSpace().latin1());
+ // break;
case prpLockedId:
- propAttr->SetLocked(item->getValue().compare(tr("PRP_YES")) == 0);
+ {
+ bool bLocked = item->getValue().compare(tr("PRP_YES")) == 0;
+ if (propAttr->IsLocked() != bLocked) {
+ propAttr->SetLocked(bLocked);
+ myChanged = true;
+ }
+ }
break;
default:
break;
}
/*!
- Check is properties chenged?
+ Check is properties changed?
*/
-bool SalomeApp_StudyPropertiesDlg::propChanged() {
+bool SalomeApp_StudyPropertiesDlg::propChanged()
+{
_PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
- if ( propAttr ) {
- QListViewItemIterator it( myPropList );
+ if (propAttr) {
+ QListViewItemIterator it (myPropList);
// iterate through all items of the listview
- for ( ; it.current(); ++it ) {
+ for (; it.current(); ++it) {
SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
switch (item->getUserType()) {
case prpAuthorId:
return true;
}
break;
- case prpModeId:
- if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().stripWhiteSpace() ) {
- return true;
- }
- break;
+ //case prpModeId:
+ // if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().stripWhiteSpace() ) {
+ // return true;
+ // }
+ // break;
case prpLockedId:
{
bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0;