Ejemplo n.º 1
0
BOOL CDocument::DoFileSave()
/**************************/
{
    if( m_strPathName.IsEmpty() ) {
        return( DoSave( NULL ) );
    } else {
        return( DoSave( m_strPathName ) );
    }
}
Ejemplo n.º 2
0
void EditorConfig::SetRecentItems(const wxArrayString& files, const wxString& nodeName)
{
    if(nodeName.IsEmpty()) { return; }

    // find the root node
    wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), nodeName);
    if(node) {
        wxXmlNode* root = m_doc->GetRoot();
        root->RemoveChild(node);
        delete node;
    }
    // create new entry in the configuration file
    node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, nodeName);
    m_doc->GetRoot()->AddChild(node);
    for(size_t i = 0; i < files.GetCount(); i++) {
        wxXmlNode* child = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("File"));
        child->AddProperty(wxT("Name"), files.Item(i));
        node->AddChild(child);
    }

    // Update the cache
    if(m_cacheRecentItems.count(nodeName)) { m_cacheRecentItems.erase(nodeName); }
    m_cacheRecentItems.insert(std::make_pair(nodeName, files));

    // save the data to disk
    DoSave();
    wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED);
    evt.SetString(nodeName);
    EventNotifier::Get()->AddPendingEvent(evt);
}
Ejemplo n.º 3
0
//---------------------------------------------------------------------------
void TConfiguration::SetStorage(TStorage Value)
{
  if (FStorage != Value)
  {
    TStorage StorageBak = FStorage;
    try
    {
      std::unique_ptr<THierarchicalStorage> SourceStorage(CreateStorage(false));
      std::unique_ptr<THierarchicalStorage> TargetStorage(CreateStorage(false));
      SourceStorage->SetAccessMode(smRead);

      FStorage = Value;

      TargetStorage->SetAccessMode(smReadWrite);
      TargetStorage->SetExplicit(true);

      // copy before save as it removes the ini file,
      // when switching from ini to registry
      CopyData(SourceStorage.get(), TargetStorage.get());
      // save all and explicit
      DoSave(true, true);
    }
    catch (...)
    {
      // If this fails, do not pretend that storage was switched.
      // For instance:
      // - When writing to an IFI file fails (unlikely, as we fallback to user profile)
      // - When removing INI file fails, when switching to registry
      //   (possible, when the INI file is in Program files folder)
      FStorage = StorageBak;
      throw;
    }
  }
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TConfiguration::Import(const UnicodeString & FileName)
{
  THierarchicalStorage * Storage = NULL;
  THierarchicalStorage * ImportStorage = NULL;
  try
  {
    ImportStorage = new TIniFileStorage(FileName);
    ImportStorage->AccessMode = smRead;

    Storage = CreateScpStorage(false);
    Storage->AccessMode = smReadWrite;
    Storage->Explicit = true;

    CopyData(ImportStorage, Storage);

    Default();
    LoadFrom(ImportStorage);

    if (ImportStorage->OpenSubKey(Configuration->StoredSessionsSubKey, false))
    {
      StoredSessions->Clear();
      StoredSessions->DefaultSettings->Default();
      StoredSessions->Load(ImportStorage);
    }
  }
  __finally
  {
    delete ImportStorage;
    delete Storage;
  }

  // save all and explicit
  DoSave(true, true);
}
Ejemplo n.º 5
0
bool GenericHID::CheckDataChanged()
{
    if ( ui.tabWidget == NULL || m_pScene == NULL )
        return true;

    ui.tabWidget->setCurrentIndex(TAB_DESIGN);

    QString s = m_pScene->makeXML();
    if ( s != m_sLastFileContents )
    {
        QMessageBox::StandardButton nRet = QMessageBox::warning( this, "Save Changes?", "Do you wish to save changes first?", QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel );
        if ( nRet == QMessageBox::No )
            return true;
        else if ( nRet == QMessageBox::Cancel )
            return false;
        else
        {
            if ( m_sLastFile.isEmpty() )
                return DoSaveAs();
            else
                return DoSave();
        }
    }
    return true;
}
Ejemplo n.º 6
0
void CAttributeDlg::DoCheckSyntax()
{
    m_view.SyntaxChecking();
    CString ecl;
    m_view.GetText(ecl);
    CString cluster(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_CLUSTER));
    CString module(m_attribute->GetModuleQualifiedLabel());
    CString attribute(m_attribute->GetLabel());

    if (CComPtr<IEclCC> eclcc = CreateIEclCC())
    {
        if (!DoSave(false))
            return;
    }
    if (m_attribute->GetType() == CreateIAttributeECLType())
    {
        clib::thread run(__FUNCTION__, boost::bind(&EclCheckSyntax, this, ecl, cluster, module, attribute, _T(""), _T(""), false, false));
    }
    else
    {
        IAttributeVector attrs;
        Dali::CEclExceptionVector errors;
        m_attribute->PreProcess(PREPROCESS_SYNTAXCHECK, ecl, attrs, errors);
        SendMessage(CWM_SUBMITDONE, Dali::WUActionCheck, (LPARAM)&errors);
    }
}
Ejemplo n.º 7
0
void EditorConfig::SetRevision(const wxString& rev)
{
    wxXmlNode* root = m_doc->GetRoot();
    if(!root) { return; }

    XmlUtils::UpdateProperty(root, wxT("Revision"), rev);
    DoSave();
}
Ejemplo n.º 8
0
void        TDesignFrm::EditWorkSpace(WorkSpaceManager  *   workSpaceManager)
{
    m_LastMovePackHead = NULL;
    m_WorkSpaceManager = workSpaceManager;
    WorkspaceToGUI();
    this->ShowModal();
    DoSave();
}
Ejemplo n.º 9
0
void GenericHID::onFileSave()
{
    RetrieveProperties();

    if ( m_sLastFile.isEmpty() )
        DoSaveAs();
    else
        DoSave();
}
Ejemplo n.º 10
0
bool        _HYModelWindow::_ProcessMenuSelection (long msel)
{
    if (_HYTWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+1: // save menu
    case HY_WINDOW_MENU_ID_FILE+3: { // save as menu
        DoSave (msel-HY_WINDOW_MENU_ID_FILE-2);
        return true;
    }

    case HY_WINDOW_MENU_ID_FILE+2: { // print
        _HYTable* t = (_HYTable*)GetCellObject (MODEL_MATRIX_ROW,4);
        t->_PrintTable((_HYTable*)GetCellObject (MODEL_MATRIX_ROW-1,4));
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+1: { // copy
        DoCopyCell ();
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+3: { // paste
        DoPasteToCells();
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+5: { // select all
        DoSelectAll();
        return true;
    }

    case HY_MDL_WIN32_MENU_BASE: { // model menu
        DoEditModelName ();
        return true;
    }

    default: { // rate menu
        msel -= HY_MDL_WIN32_MENU_BASE+100;
        if (msel >=0 && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget_by_action(menu_items,HY_MDL_WIN32_MENU_BASE+100+msel))))
            if (msel!=rateChoice) {
                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget_by_action(menu_items,HY_MDL_WIN32_MENU_BASE+100+rateChoice)),false);
                rateChoice = msel;
                taint = true;
            }
        return true;
    }
    }


    return false;
}
Ejemplo n.º 11
0
bool EditorConfig::WriteObject(const wxString& name, SerializedObject* obj)
{
    if(!XmlUtils::StaticWriteObject(m_doc->GetRoot(), name, obj)) return false;

    // save the archive
    bool res = DoSave();
    wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED);
    evt.SetString(name);
    EventNotifier::Get()->AddPendingEvent(evt);
    return res;
}
Ejemplo n.º 12
0
// world.Save - saves the current world - under a new name if supplied
//              returns zero if no error
BOOL CMUSHclientDoc::Save(LPCTSTR Name) 
{
CString strName = Name;

// if empty, take document default path name [#459]

  if (strName.IsEmpty ())
    strName = m_strPathName;

  return !DoSave (strName, TRUE);

}  // end of CMUSHclientDoc::Save
Ejemplo n.º 13
0
BOOL CDocument::DoFileSave()
{
	DWORD dwAttrib = GetFileAttributes(m_strPathName);
	if (dwAttrib & FILE_ATTRIBUTE_READONLY)
	{
		// we do not have read-write access or the file does not (now) exist
		if (!DoSave(NULL))
		{
			TRACE0("Warning: File save with new name failed.\n");
			return FALSE;
		}
	}
	else
	{
		if (!DoSave(m_strPathName))
		{
			TRACE0("Warning: File save failed.\n");
			return FALSE;
		}
	}
	return TRUE;
}
Ejemplo n.º 14
0
HRESULT CVCAConfigure::SaveEngine(DWORD dwEngId, LPTSTR lpszFilename)
{
	HRESULT hr = E_FAIL;
	USES_CONVERSION;

	do
	{
		DoSave( dwEngId );


		libvca_saveCfgtoXMLFile( T2A(lpszFilename), dwEngId, VCA_CFGFLAG_ALL );
	}
	while( 0 );

	return S_OK;
}
Ejemplo n.º 15
0
//---------------------------------------------------------------------------
void __fastcall TConfiguration::SetStorage(TStorage value)
{
  if (FStorage != value)
  {
    TStorage StorageBak = FStorage;
    try
    {
      THierarchicalStorage * SourceStorage = NULL;
      THierarchicalStorage * TargetStorage = NULL;

      try
      {
        SourceStorage = CreateScpStorage(false);
        SourceStorage->AccessMode = smRead;

        FStorage = value;

        TargetStorage = CreateScpStorage(false);
        TargetStorage->AccessMode = smReadWrite;
        TargetStorage->Explicit = true;

        // copy before save as it removes the ini file,
        // when switching from ini to registry
        CopyData(SourceStorage, TargetStorage);
      }
      __finally
      {
        delete SourceStorage;
        delete TargetStorage;
      }

      // save all and explicit,
      // this also removes an INI file, when switching to registry storage
      DoSave(true, true);
    }
    catch (...)
    {
      // If this fails, do not pretend that storage was switched.
      // For instance:
      // - When writting to an INI file fails (unlikely, as we fallback to user profile)
      // - When removing INI file fails, when switching to registry
      //   (possible, when the INI file is in Program Files folder)
      FStorage = StorageBak;
      throw;
    }
  }
Ejemplo n.º 16
0
/// Save the settings file
bool ctConfigToolDoc::DoSave(const wxString& filename)
{
    wxFileOutputStream osFile(filename);
    if (!osFile.Ok())
        return false;

    wxTextOutputStream stream(osFile);

    stream << wxT("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
    stream << wxT("<settings xmlns=\"http://www.wxwidgets.org/wxs\" version=\"2.5.0.1\">");

    DoSave(m_topItem, osFile, 1);

    stream << wxT("\n</settings>\n");

    return true;
}
Ejemplo n.º 17
0
/**
 * @brief	Take actions specified by global error mode.
 *
 * e.g. if EM_MESSAGE_BOX is enabled DoMessageBox() will be called.\n\n
 *
 * Multiple error modes will be taken into account, so more than one action
 * can occur in one call to this method.
 */
void ErrorReport::DoErrorModeEvent() const
{
	if(IsErrorModeEnabled(EM_MESSAGE_BOX) == true)
	{
		DoMessageBox();
	}

	if(IsErrorModeEnabled(EM_SAVE) == true)
	{
		DoSave();
	}

	if(IsErrorModeEnabled(EM_EXCEPTION) == true)
	{
		DoRethrow();
	}
}
Ejemplo n.º 18
0
HRESULT CVCAConfigure::SaveEngine(DWORD dwEngId, char *pszBuf, unsigned int &uiBufLen )
{
	HRESULT hr = E_FAIL;
	USES_CONVERSION;

	do
	{
		DoSave( dwEngId );

		if( 0 == libvca_saveCfgtoXMLBuffer( pszBuf, &uiBufLen, dwEngId, VCA_CFGFLAG_ALL ) )
		{
			hr = S_OK;
		}
	}
	while( 0 );

	return hr;
}
Ejemplo n.º 19
0
void EditorConfig::SetTagsDatabase(const wxString& dbName)
{
    wxString nodeName = wxT("TagsDatabase");
    wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), nodeName);
    if(node) {
        XmlUtils::UpdateProperty(node, wxT("Path"), dbName);
    } else {
        // create new node
        node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, nodeName);
        node->AddProperty(wxT("Path"), dbName);
        m_doc->GetRoot()->AddChild(node);
    }

    DoSave();
    wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED);
    evt.SetString(nodeName);
    EventNotifier::Get()->AddPendingEvent(evt);
}
Ejemplo n.º 20
0
/**
 * ProcessSRQueue
 */
void ProcessSRQueue() {
	switch (SRstate) {
	case SR_DORESTORE:
		// If a load has been done directly from title screens, set a larger value for scene ctr so the
		// code used to skip the title screens in Discworld 1 gets properly disabled
		if (sceneCtr < 10) sceneCtr = 10;

		if (DoRestore()) {
			DoRestoreScene(srsd, false);
		}
		SRstate = SR_IDLE;
		break;

	case SR_DOSAVE:
		DoSave();
		SRstate = SR_IDLE;
		break;
	default:
		break;
	}
}
Ejemplo n.º 21
0
bool        _HYChartWindow::_ProcessMenuSelection (long msel)
{
    switch (msel) {
    case HY_CHART_WIN32_MENU_BASE: { // chart menu
        HandleChartOptions ();
        return true;
    }
    case HY_WINDOW_MENU_ID_FILE+1: // save menu
    case HY_WINDOW_MENU_ID_FILE+3: // save menu
    case HY_WINDOW_MENU_ID_FILE+4: { // save menu
        DoSave ((msel==HY_WINDOW_MENU_ID_FILE-1)?0:msel-HY_WINDOW_MENU_ID_FILE-2);
        return true;
    }
    case HY_WINDOW_MENU_ID_FILE+2: // print menu
    case HY_WINDOW_MENU_ID_FILE+5: { // print menu
        DoPrint ((msel==HY_WINDOW_MENU_ID_FILE+2)?0:-1);
        return true;
    }
    case HY_CHART_WIN32_MENU_BASE+1: // font menu
    case HY_CHART_WIN32_MENU_BASE+2: // font menu
    case HY_CHART_WIN32_MENU_BASE+3: { // font menu
        DoChangeFont (msel-HY_CHART_WIN32_MENU_BASE-1);
        return true;
    }
    case HY_CHART_WIN32_MENU_BASE+4: { // chart name
        RenameChartWindow ();
        return true;
    }
    default: { // proc menu
        if (msel>=HY_CHART_WIN32_MENU_BASE+5) {
            ExecuteProcessor (msel-HY_CHART_WIN32_MENU_BASE-5);
            return true;
        }
    }
    }

    return _HYTWindow::_ProcessMenuSelection(msel);
}
Ejemplo n.º 22
0
void EditorConfig::SetOptions(OptionsConfigPtr opts)
{
    // remove legacy tab-width setting
    wxXmlNode* child = XmlUtils::FindNodeByName(m_doc->GetRoot(), wxT("ArchiveObject"), wxT("EditorTabWidth"));
    if(child) {
        m_doc->GetRoot()->RemoveChild(child);
        delete child;
    }

    // locate the current node
    wxString nodeName = wxT("Options");
    wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), nodeName);
    if(node) {
        m_doc->GetRoot()->RemoveChild(node);
        delete node;
    }
    m_doc->GetRoot()->AddChild(opts->ToXml());

    DoSave();
    wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED);
    evt.SetString(nodeName);
    EventNotifier::Get()->AddPendingEvent(evt);
}
Ejemplo n.º 23
0
void CRegNewUserDlg::OnBnSave() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	
	m_nUseFlag = SAVE_WORK ;

	//입력전 다시 사용자 ID의 중복여부를 Check해야함
	
	if( m_strId != m_strIdValid )
	{
		OnBtnDupidCheck();
	}	
	else
	
	{
		// 저장 작업, 입력값 검사
		if( chkValidation() == FALSE )
		{
			return ;
		}

		// 확인메세지
		CString strTmp;
		strTmp.Format("==== 입력하신내용 =======\n"
			" 주민번호 : %s\n"
			" 사용자명 : %s\n"
			" 사용자ID : %s\n"
			" 비밀번호 : %s\n"
			" 소속       : %s\n"
			" 팀          : %s\n"
			" 직급       : %s\n"
			" 작업일지 : %s\n"
			" 사무실☎ : %s\n"
			" 내선번호 : %s\n"
			" 핸드폰☏ : %s\n"
			"=========================\n"
			"위내용으로 등록하시겠습니까?"
			, m_strJuminNo
			, m_strName
			, m_strId
			, m_strPw1
			, m_cbCompany.GetName()
			, m_cbTeam.GetName()
			, m_cbGrade.GetName()
			, (m_nDocYesNo==0) ? "작성" : "미작성"
			, m_strTelOfc
			, m_strTelIn
			, m_strTelHp
			);
		if( AfxMessageBox(strTmp, MB_YESNO|MB_ICONQUESTION) == IDNO )
		{
			return  ;
		}
				
		if( !DoSave() )
		{
			return ;
		}				
	}
}
Ejemplo n.º 24
0
void CDocument::OnFileSaveAs()
{
	if (!DoSave(NULL))
		TRACE0("Warning: File save-as failed.\n");
}
Ejemplo n.º 25
0
void TConfiguration::SaveExplicit()
{
  // only modified, explicit
  DoSave(false, true);
}
Ejemplo n.º 26
0
void TConfiguration::Save()
{
  // only modified, implicit
  DoSave(false, false);
}
Ejemplo n.º 27
0
void EditorConfig::Save()
{
    m_transcation = false;
    DoSave();
}
Ejemplo n.º 28
0
// 사용자 ID 중복 CHK 결과 처리
LRESULT CRegNewUserDlg::OnChkDupUserIDRslt(WPARAM wParam, LPARAM lParam)
{	
	CString strTmp;
	S_COM_RESPONSE * pComRslt = (S_COM_RESPONSE*) lParam;
	CSP_Utility<S_COM_RESPONSE> spTest = pComRslt;

	if(strcmp(pComRslt->szRsltCd ,"Y") == 0 )
	{
		TRACE("사용자 ID 이미 존재\n");
		if(m_strStatus != "00")
		{
			strTmp = "입력하신 사용자ID\n[" + m_strId + "]는 이미 등록된 사용자ID입니다\n"
		 		     "다른ID로 등록해주십시오";
		}
		else
		{
			if(m_strIdOld == m_strId)
			{
				strTmp = "기존 개발관리 사용자는 반드시 사용자ID를 댜시 설정하십시요";
			}
			else
			{
				strTmp = "입력하신 사용자ID\n[" + m_strId + "]는 이미 등록된 사용자ID입니다\n"
		 		     "다른ID로 등록해주십시오";
			}
			
		}

		AfxMessageBox(strTmp, MB_ICONINFORMATION);
		m_strId = _T("");
		SetDlgItemText(ID_EB_USER_ID, m_strId);
		GetDlgItem(ID_EB_USER_ID)->SetFocus();
		
		return FALSE;
	}
	else
	{
		if	(strcmp(pComRslt->szRsltCd ,"N") == 0 && strcmp(NODATA_FOUND, pComRslt->szErrMsg) == 0)
		{
			TRACE("사용자 ID 사용가능 \n");
			m_strIdValid = m_strId;
			strTmp = "입력하신 사용자ID\n[" + m_strId + "]는 사용가능합니다";
			AfxMessageBox(strTmp, MB_ICONINFORMATION);
			GetDlgItem(ID_EB_PWD)->SetFocus();		

			// 여기서 다음 작업을 시작한다. 
			if( m_nUseFlag == SAVE_WORK )
			{
				// 저장 작업
				// 입력값 검사
				if( chkValidation() == FALSE )
				{
					return FALSE ;
				}

				// 확인메세지
				CString strTmp;
				strTmp.Format("==== 입력하신내용 =======\n"
							  " 주민번호 : %s\n"
							  " 사용자명 : %s\n"
							  " 사용자ID : %s\n"
							  " 비밀번호 : %s\n"
							  " 소속       : %s\n"
							  " 팀          : %s\n"
							  " 직급       : %s\n"
							  " 작업일지 : %s\n"
							  " 사무실☎ : %s\n"
							  " 내선번호 : %s\n"
							  " 핸드폰☏ : %s\n"
							  "=========================\n"
							  "위내용으로 등록하시겠습니까?"
							   , m_strJuminNo
							   , m_strName
							   , m_strId
							   , m_strPw1
							   , m_cbCompany.GetName()
							   , m_cbTeam.GetName()
							   , m_cbGrade.GetName()
							   , (m_nDocYesNo==0) ? "작성" : "미작성"
							   , m_strTelOfc
							   , m_strTelIn
							   , m_strTelHp
							  );
				if( AfxMessageBox(strTmp, MB_YESNO|MB_ICONQUESTION) == IDNO )
				{
					return FALSE ;
				}
				
				if( !DoSave() )
				{
					return FALSE;
				}				
			}
		}
		else
		{
			strTmp.Format("ERROR : %s",pComRslt->szErrMsg);
			AfxMessageBox(strTmp, MB_ICONINFORMATION);
			m_strId = _T("");
			SetDlgItemText(ID_EB_USER_ID, m_strId);
			GetDlgItem(ID_EB_USER_ID)->SetFocus();
			
			return FALSE;
		}
		
	}
    
	return TRUE;
}
Ejemplo n.º 29
0
//______________________________________________________________________________
void MainWindow::DoOutput()
{
    ui_OutputLabel->setText(QString::fromStdString("write files"));

    QFileDialog::Options options;
    QString selectedFilter;
    QString OutputName = QFileDialog::getSaveFileName(this,
                                tr("QFileDialog::getSaveFileName()"),
                                0,
                                tr("All Files (*);;Text Files (*.txt)"),
                                &selectedFilter,
                                options);

    if (OutputName.isEmpty()){return;}
    QString out = OutputName + "_strengthfunctions.txt";
    QFile Strength_output(out);
    Strength_output.open(QIODevice::WriteOnly);
    QTextStream outStream(&Strength_output);
    for (k = 0;k<=(int)((ui_EmaxSpinBox->value())/(ui_BinSizeSpinBox->value()));k++){
      outStream << k*(ui_BinSizeSpinBox->value()) << " "<< AnalysisWidget->E1Strength[k]<<" "<<AnalysisWidget->M1Strength[k]<< " "<<AnalysisWidget->E2Strength[k]<<endl;
    }
    Strength_output.close();

    QString out3 = OutputName + "_levels.txt";
    QFile widths_output(out3);
    widths_output.open(QIODevice::WriteOnly);
    QTextStream outStream3(&widths_output);
    for ( int i =0;i<(AnalysisWidget->scheme.size());i++){
        outStream3  << AnalysisWidget->scheme[i].energy << "\t "
                    << (AnalysisWidget->scheme[i].spin)*(AnalysisWidget->scheme[i].parity)<< "\t"
                    << AnalysisWidget->scheme[i].levelnumber << "\t"
                    << AnalysisWidget->scheme[i].totalwidth/100./(2*(AnalysisWidget->scheme[i].spin)+1)*AnalysisWidget->scheme[i].levelnumber << "\t" //change average width to total width
                    << AnalysisWidget->scheme[i].gswidth << "\t"
                    << AnalysisWidget->scheme[i].S << endl;
    }
    widths_output.close();


    QFile output(OutputName);
    output.open(QIODevice::WriteOnly);
    QTextStream outa(&output);
    outa << "### GammaDex2.0 by R.Massarczyk and G.Schramm"<<endl;
    outa << "### Status 2012/2013 , see also PHYSICAL REVIEW C 85, 014311"<<endl;
    outa << "### contact [email protected]"<<endl;
    output.close();


    DoSave(OutputName+"_parameter.txt");

    if(ui_ReactionComboBox->currentIndex()==0){

        QString out1 = OutputName + "_strengthfunctions_excitedstate.txt";
        QFile Strength_output1(out1);
        Strength_output1.open(QIODevice::WriteOnly);
        QTextStream outStream1(&Strength_output1);
        for (k = 0;k<=(int)((ui_EmaxSpinBox->value())/(ui_BinSizeSpinBox->value()));k++){
          outStream1 << k*(ui_BinSizeSpinBox->value()) << " "<< AnalysisWidget->E1Strength_ex[k]<<" "<<AnalysisWidget->M1Strength_ex[k]<< " "<<AnalysisWidget->E2Strength_ex[k]<<endl;
        }
        Strength_output1.close();


        QString out2 = OutputName + "_gammaspectra.txt";
        QFile Gamma_output(out2);
        Gamma_output.open(QIODevice::WriteOnly);
        QTextStream outStream2(&Gamma_output);
        int a  = (int)(AnalysisWidget->GetIndex(ui_EmaxSpinBox->value(),ui->SpinParitySpinBox_n1->value(),ui->SpinParitySpinBox_n2->value()));
        //cout <<"here"<< a <<endl;
        for (k = 0;k<=(int)((ui_EmaxSpinBox->value())/(ui_BinSizeSpinBox->value()));k++){
           outStream2 << k*(ui_BinSizeSpinBox->value()) << " "<< AnalysisWidget->scheme[a].spectrum[k] <<" "<<AnalysisWidget->scheme[a].spectrum_primary[k]<<endl;
        }
        Gamma_output.close();
    }

    if(ui_ReactionComboBox->currentIndex()==1){

        QString out1 = OutputName + "_branching.txt";
        QFile branch_output1(out1);
        branch_output1.open(QIODevice::WriteOnly);
        QTextStream outStream1(&branch_output1);
        for (k = 0;k<=(int)((ui_EmaxSpinBox->value())/(ui_BinSizeSpinBox->value()));k++){
          outStream1 << k*(ui_BinSizeSpinBox->value()) << " "<< AnalysisWidget->branching[k] <<endl;
        }
        branch_output1.close();

        QString out2 = OutputName + "_output.txt";
        QFile Gamma_output(out2);
        Gamma_output.open(QIODevice::WriteOnly);
        QTextStream outStream2(&Gamma_output);
        int a  = (int)(AnalysisWidget->GetIndex(ui_EmaxSpinBox->value(),ui->SpinParitySpinBox_n1->value(),ui->SpinParitySpinBox_n2->value()));
        //cout <<"here"<< a <<endl;
        for (k = 0;k<=(int)((ui_EmaxSpinBox->value())/(ui_BinSizeSpinBox->value()));k++){
           outStream2 << k*(ui_BinSizeSpinBox->value()) << " "<< AnalysisWidget->GammaSpectrum[k] <<" "<<AnalysisWidget->GammaSpectrum_new[k] <<endl;
        }
        Gamma_output.close();

    }
}
Ejemplo n.º 30
0
//______________________________________________________________________________
void MainWindow::init()
{   //initialisation of the gui
    //recall objects from .ui file and connect them with user functions


    ui_ConvertButton    = this->findChild<QCommandLinkButton*>("ConvertButton");
    ui_ExitButton       = this->findChild<QCommandLinkButton*>("ExitButton");
    ui_OutputButton     = this->findChild<QCommandLinkButton*>("OutputButton");

    connect(ui_ConvertButton,   SIGNAL(clicked()), this, SLOT(DoConvert()));
    connect(ui_ExitButton,      SIGNAL(clicked()), this, SLOT(DoExit()));
    connect(ui_OutputButton,      SIGNAL(clicked()), this, SLOT(DoOutput()));

    ui_actionExit = this->findChild<QAction*>("actionExit");
    ui_actionLoad = this->findChild<QAction*>("actionLoad");
    ui_actionSave = this->findChild<QAction*>("actionSave");
    connect(ui_actionExit, SIGNAL(triggered()), this, SLOT(DoExit()));
    connect(ui_actionSave, SIGNAL(triggered()), this, SLOT(DoSave()));
    connect(ui_actionLoad, SIGNAL(triggered()), this, SLOT(DoLoad()));


    ui_EmaxSpinBox         = this->findChild<QSpinBox*>("EmaxSpinBox");
    ui_BinSizeSpinBox      = this->findChild<QSpinBox*>("BinSizeSpinBox");
    ui_ASpinBox            = this->findChild<QSpinBox*>("ASpinBox");
    ui_ZSpinBox            = this->findChild<QSpinBox*>("ZSpinBox");

    ui_SpinParitySpinBox   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox");
    ui_SpinParitySpinBox_2   = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_2");
    ui_SpinParitySpinBox_n1  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n1");
    ui_SpinParitySpinBox_n2  = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n2");
    ui_TorASpinBox_1       = this->findChild<QDoubleSpinBox*>("TorASpinBox_1");
    ui_TorASpinBox_2       = this->findChild<QDoubleSpinBox*>("TorASpinBox_2");
    ui_PairSpinBox         = this->findChild<QDoubleSpinBox*>("PairSpinBox");
    ui_ParityBox         = this->findChild<QDoubleSpinBox*>("ParityBox");

    ui_E1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_1");
    ui_E1doubleSpinBox_2   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_2");
    ui_E1doubleSpinBox_3   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_3");
    ui_E1doubleSpinBox_4   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_4");
    ui_E1doubleSpinBox_5   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_5");
    ui_E1doubleSpinBox_6   = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_6");
    ui_M1doubleSpinBox_1   = this->findChild<QDoubleSpinBox*>("M1doubleSpinBox_1");


    ui_OutputLabel    = this->findChild<QLabel*>("OutputLabel");
    ui_TorALabel_1    = this->findChild<QLabel*>("TorALabel_1");
    ui_TorALabel_2    = this->findChild<QLabel*>("TorALabel_2");
    ui_EmaxLabel      = this->findChild<QLabel*>("EmaxLabel");
    ui_E1label_1      = this->findChild<QLabel*>("E1Label_1");
    ui_E1label_2      = this->findChild<QLabel*>("E1Label_2");
    ui_E1label_3      = this->findChild<QLabel*>("E1Label_3");
    ui_E1label_4      = this->findChild<QLabel*>("E1Label_4");
    ui_E1label_5      = this->findChild<QLabel*>("E1Label_5");
    ui_E1label_6      = this->findChild<QLabel*>("E1Label_6");
    ui_M1label_1      = this->findChild<QLabel*>("M1Label_1");
    ui_M1label_2      = this->findChild<QLabel*>("M1Label_2");
    ui_Levellabel     = this->findChild<QLabel*>("Levellabel");
    ui_Spectrumlabel  = this->findChild<QLabel*>("SpectrumLabel");

    ui_progressbar      = this->findChild<QProgressBar*>("progressBar");

    ui_E1pushButton      = this->findChild<QPushButton*>("E1pushButton");
    connect(ui_E1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile1()));

    ui_M1pushButton      = this->findChild<QPushButton*>("M1pushButton");
    connect(ui_M1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile2()));

    ui_LevelpushButton      = this->findChild<QPushButton*>("LevelpushButton");
    connect(ui_LevelpushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile3()));

    ui_LevelpushButton_2      = this->findChild<QPushButton*>("LevelpushButton_2");
    connect(ui_LevelpushButton_2, SIGNAL(clicked()),this,SLOT(Clear()));

    ui_SpectrumButton      = this->findChild<QPushButton*>("SpectrumButton");
    connect(ui_SpectrumButton, SIGNAL(clicked()),this,SLOT(DoSelectfile4()));

    ui_DensityEnergyComboBox = this->findChild<QComboBox*>("DensityEnergyComboBox");
    connect(ui_DensityEnergyComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoModel()));

    ui_ReactionComboBox = this->findChild<QComboBox*>("ReactionComboBox");
    connect(ui_ReactionComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoEmax()));

    ui_E1StrengthComboBox = this->findChild<QComboBox*>("E1StrengthComboBox");
    connect(ui_E1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoE1()));

    ui_M1StrengthComboBox = this->findChild<QComboBox*>("M1StrengthComboBox");
    connect(ui_M1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoM1()));

    ui_E1pushButton->hide();  
    ui_E1label_6->hide();
    ui_E1doubleSpinBox_3->hide();
    ui_E1doubleSpinBox_4->hide();
    ui_E1doubleSpinBox_5->hide();
    ui_E1doubleSpinBox_6->hide();

    ui_M1label_1->hide();
    ui_M1label_2->hide();
    ui_M1doubleSpinBox_1->hide();
    ui_M1pushButton->hide();

    ui_Spectrumlabel->hide();
    ui_SpectrumButton->hide();


}