Example #1
0
void __fastcall TfrmRatTanksMainDialog::FormDestroy(TObject *Sender)
{
	clearComboBox(Site_ComboBox);
	clearComboBox(Vessel_ComboBox);
	clearComboBox(Project_ComboBox);
	clearComboBox(Aliquot_ComboBox);
}
Example #2
0
void TfrmRatTanksMainDialog::reSetAll()
{
	Site_ComboBox->Enabled = false;
	Vessel_ComboBox->Enabled = false;
	Project_ComboBox->Enabled = false;
	Aliquot_ComboBox->Enabled = false;
	TrackBarThreshold->Enabled = false;
	BoxType_Button->Enabled = false;
	ChosenBoxType_Edit->Text = "";
	DefragButton->Enabled = false;
	m_bShowingBoxSelectionDialog = false;
	Memo->Clear();

	clearComboBox(Site_ComboBox);
	clearComboBox(Vessel_ComboBox);
	clearComboBox(Project_ComboBox);
	clearComboBox(Aliquot_ComboBox);
}
Example #3
0
void QtVoxOxCallBarFrame::clearOutgoingCalls(){
	/*if (_qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile() && _qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile()->getCHistory()) {
		_qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile()->getCHistory()->clear(HistoryMemento::OutgoingCall);
	}*/
	if (_cUserProfile && _cUserProfile->getCHistory()) {
		_cUserProfile->getCHistory()->clear(HistoryMemento::OutgoingCall);
	}
	clearComboBox();

}
Example #4
0
void TfrmRatTanksMainDialog::fillVesselComboBox()
{
	int index = Site_ComboBox->ItemIndex;
	if (index == -1)
		return;

	util_mapHolder *mapHolder = static_cast<util_mapHolder * >(Site_ComboBox->Items->Objects[index]);
	if (mapHolder == 0)
		return;

	clearComboBox(Vessel_ComboBox);
	try
	{
		std::map<int,std::map<String,String> > newVesselLists;
		m_rationaliseTanks.getVesslList(newVesselLists ,mapHolder->m_map);

		std::map<int,std::map<String,String> >::iterator it;
		for (it = newVesselLists.begin(); it != newVesselLists.end(); ++it)
		{
			std::map<String,String>  &data = it->second;
			util_mapHolder *ValueHolder = new util_mapHolder(data);
			String s = /*data[String(RationaliseTanks::database::DEFINE_OBJECT_NAME_EXTERNAL_NAME.c_str())] + " -  " +*/ data[String(RationaliseTanks::database::DEFINE_OBJECT_NAME_EXTERNAL_FULL.c_str())];
			Vessel_ComboBox->AddItem(s,ValueHolder);
		}
		if (newVesselLists.size() > 0)
		{
			Vessel_ComboBox->ItemIndex = 0;
			Vessel_ComboBox->Text = "Please select a vessel";
			Memo->Clear();
			debugMemo->Clear();
			Memo->Lines->Add("Please select a vessel to scan from the drop down list");

			Site_ComboBox->Enabled = true;
			Vessel_ComboBox->Enabled = true;
			Vessel_ComboBox->SetFocus();
			Project_ComboBox->Enabled = false;
			Aliquot_ComboBox->Enabled = false;
			TrackBarThreshold->Enabled = false;
			DefragButton->Enabled = false;
			BoxType_Button->Enabled = false;
			ChosenBoxType_Edit->Text = "";
			m_BoxTypeDialog->clearDetails();

			Project_ComboBox->Clear();
			Aliquot_ComboBox->Clear();
		}
	}
	catch( const String& msg )
	{
		String displayString = String("Failed to acess database, please try again- \n\n Reason :\n") + msg;
		Application->MessageBox(UnicodeString(displayString.c_str()).c_str(), L"Error", MB_OK);
	}
	Vessel_ComboBox->Enabled = true;
	Screen->Cursor = crDefault;
}
Example #5
0
void QtVoxOxCallBarFrame::fillComboBox() {
	QStringList tobeinserted = QStringList();
	clearComboBox();

	//CUserProfile * cUserProfile =
	//	_qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile();
	if (!_cUserProfile) {
		return;
	}

	//completion of history
	//if _qtHistoryWidget is set it means that History has been created
	
	bool isWengoAccountConnected = _cUserProfile->getUserProfile().hasWengoAccount();
	
	CHistory* chistory = _cUserProfile->getCHistory();
	if (chistory) {
		HistoryMementoCollection * mementos = chistory->getMementos(HistoryMemento::OutgoingCall, 10);
		Config & config = ConfigManager::getInstance().getCurrentConfig();
		QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() );
		for (HistoryMap::iterator it = mementos->begin(); it != mementos->end(); it++) {
			HistoryMemento * memento = (*it).second;
			SipAddress sipAddress(memento->getPeer());
			
			QString username(sipAddress.getSipAddress().c_str());
			if (isWengoAccountConnected) {
				username.remove(wengoSuffix);
			}
			username.remove("sip:");	

			if( !username.isEmpty() && (memento->getState()==HistoryMemento::OutgoingCall) && !tobeinserted.contains(username) ) {
				tobeinserted << username;
			}
		}
		OWSAFE_DELETE(mementos);
	}
	////

	tobeinserted.sort();

	QStringList::const_iterator constIterator;
	for (constIterator = tobeinserted.constBegin(); constIterator != tobeinserted.constEnd();++constIterator){		
		
		addComboBoxItem(*constIterator);

	}

	if(tobeinserted.count() > 0){
		if(_ui->callBarComboBox->findText(CLEAR_RECENT_CALLS_MESSAGE) == -1){
			_ui->callBarComboBox->insertItem (_ui->callBarComboBox->count(), CLEAR_RECENT_CALLS_MESSAGE );
		}
	}

	clearComboBoxEditText();
}
Example #6
0
void TfrmRatTanksMainDialog::fillSiteComboBox()
{
	clearComboBox(Site_ComboBox);
	try
	{
		std::map<int,std::map<String,String> > newSiteLists;
		m_rationaliseTanks.getSiteList(newSiteLists);

		std::map<int,std::map<String,String> >::iterator it;
		for (it = newSiteLists.begin(); it != newSiteLists.end(); ++it)
		{
			std::map<String,String>  &data = it->second;
			util_mapHolder *ValueHolder = new util_mapHolder(data);
			String s = data[String(RationaliseTanks::database::DEFINE_OBJECT_NAME_EXTERNAL_NAME.c_str())] + " -  " + data[String(RationaliseTanks::database::DEFINE_OBJECT_NAME_EXTERNAL_FULL.c_str())];
			Site_ComboBox->AddItem(s,ValueHolder);
		}
		if (newSiteLists.size() > 0)
		{
			Site_ComboBox->ItemIndex = 0;
			Site_ComboBox->Text = "Please select a site";
			Site_ComboBox->Enabled = true;
			Site_ComboBox->SetFocus();
			Vessel_ComboBox->Enabled = false;
			Project_ComboBox->Enabled = false;
			Aliquot_ComboBox->Enabled = false;
			TrackBarThreshold->Enabled = false;
			DefragButton->Enabled = false;
			BoxType_Button->Enabled = false;
			ChosenBoxType_Edit->Text = "";
         	m_BoxTypeDialog->clearDetails();

			debugMemo->Clear();
			Memo->Clear();
			Memo->Lines->Add("Please select a site from the drop down list");
		}
		else
			Site_ComboBox->Text = "No sites found!";
	}
	catch( const String& msg )
	{
		String displayString = String("Failed to acess database, please try again- \n\n Reason :\n") + msg;
		Application->MessageBox(UnicodeString(displayString.c_str()).c_str(), L"Error", MB_OK);
	}
	Screen->Cursor = crDefault;
}
Example #7
0
void TfrmRatTanksMainDialog::scan()
{
	int index = Vessel_ComboBox->ItemIndex;
	if (index == -1)
		return;

	Memo->Clear();
	Memo->Lines->Add("Searching....");

	String threshHold = ThreshHoldEdit->Text;
	std::string stdThreshHold = std::string();
	int ithreshhold = atoi(AnsiString(threshHold.c_str()).c_str());
	if (ithreshhold == 0)
		ithreshhold = 5;
	util_mapHolder *mapHolder = static_cast<util_mapHolder * >(Vessel_ComboBox->Items->Objects[index]);
	try
	{
		m_PleaseWaitDialog->Position = poOwnerFormCenter;
		m_PleaseWaitDialog->Show();
		m_rationaliseTanks.scanVessel(mapHolder->m_map,Memo,this);
		m_PleaseWaitDialog->Hide();

	//fill comboBox with Projects in vessel
		clearComboBox(Project_ComboBox);

		std::map<std::string, std::map<std::string,std::string> > projectsLists;
		m_rationaliseTanks.getProjectsList(projectsLists);

		std::map<std::string, std::map<std::string,std::string> >::iterator it;
		for (it = projectsLists.begin(); it != projectsLists.end(); ++it)
		{
			std::map<std::string,std::string>  &data = it->second;
			util_stdStringmapHolder *ValueHolder = new util_stdStringmapHolder(data);
			String s = String(data["external_name"].c_str()) + " -  " + String(data["external_full"].c_str());

//Check the activity flag.. put a note on it if you can't rationalise.
			std::string activityFlag = data["activity_flags"];
			if (!((activityFlag== "5") || (activityFlag== "6")))
				s = L"[Analyse only] " + s;
			Project_ComboBox->AddItem(s,ValueHolder);
		}
		if (projectsLists.size() > 1)
		{
			Project_ComboBox->ItemIndex = 0;
			Project_ComboBox->Text = "Please select a project";
			Memo->Clear();
			Memo->Lines->Add("Please select a project from the drop down list");

			m_BoxTypeDialog->clearDetails();
			BoxType_Button->Enabled = false;
			ChosenBoxType_Edit->Text = "";
	
			Site_ComboBox->Enabled = true;
			Vessel_ComboBox->Enabled = false;
			Project_ComboBox->Enabled = true;
			Project_ComboBox->SetFocus();
			debugMemo->Clear();
			Aliquot_ComboBox->Enabled = false;
			TrackBarThreshold->Enabled = false;

			DefragButton->Enabled = false;
		}
		else if (projectsLists.size() == 1)
		{
			Project_ComboBox->ItemIndex = 0;
			fillAlquotComboBox();
		}
		else // == 0
		{
			Memo->Clear();
			Memo->Lines->Add(L"Vessel is empty.");
		}
	}
	catch( const String& msg )
	{
		String displayString = String("Failed to acess database, please try again- \n\n Reason :\n") + msg;
		Application->MessageBox(UnicodeString(displayString.c_str()).c_str(), L"Error", MB_OK);
	}
}
Example #8
0
void TfrmRatTanksMainDialog::fillAlquotComboBox()
{
	int index = Project_ComboBox->ItemIndex;
	if (index == -1)
		return;

	ChosenBoxType_Edit->Text = "";
	m_BoxTypeDialog->clearDetails();

	util_stdStringmapHolder *mapHolder = static_cast<util_stdStringmapHolder * >(Project_ComboBox->Items->Objects[index]);
	std::string project_cid = mapHolder->m_map["project_cid"];
//fill comboBox with Projects in vessel
	clearComboBox(Aliquot_ComboBox);
	try
	{
		std::map<std::string, std::map<std::string,std::string> > aliquotLists;
		m_rationaliseTanks.getAliquotList(project_cid,aliquotLists);

		std::map<std::string, std::map<std::string,std::string> >::iterator it;
		for (it = aliquotLists.begin(); it != aliquotLists.end(); ++it)
		{
			std::map<std::string,std::string>  &data = it->second;
			util_stdStringmapHolder *ValueHolder = new util_stdStringmapHolder(data);
			String s = String(data["external_name"].c_str()) + " -  " + String(data["external_full"].c_str());
			Aliquot_ComboBox->AddItem(s,ValueHolder);
		}
		Aliquot_ComboBox->ItemIndex = 0;
		if (aliquotLists.size() > 1)
		{
			Aliquot_ComboBox->Text = "Please select a aliquot";
			Memo->Clear();
			Memo->Lines->Add("Please select a aliquot from the drop down list");

			Site_ComboBox->Enabled = true;
			Vessel_ComboBox->Enabled = true;
			Project_ComboBox->Enabled = true;
			Aliquot_ComboBox->Enabled = true;
			BoxType_Button->Enabled = false;
            m_BoxTypeDialog->clearDetails();
			Aliquot_ComboBox->SetFocus();
			TrackBarThreshold->Enabled = false;
			DefragButton->Enabled = false;
			debugMemo->Clear();
		}
		if (aliquotLists.size() == 1)
		{
			mapHolder = static_cast<util_stdStringmapHolder * >(Project_ComboBox->Items->Objects[Project_ComboBox->ItemIndex]);
			std::string project_cid = mapHolder->m_map["project_cid"];

			mapHolder = static_cast<util_stdStringmapHolder * >(Aliquot_ComboBox->Items->Objects[Aliquot_ComboBox->ItemIndex]);
			std::string aliquot_cid = mapHolder->m_map["object_cid"];

			int threshHold = getThreshHold();

			m_rationaliseTanks.analyseVessel(Memo,project_cid,aliquot_cid,this);

			if (!m_rationaliseTanks.refineSearch(threshHold,this))
			{
				fillBoxTypeComboBox();
				Memo->Clear();
				Memo->Lines->Add("Nothing fits your criteria");
				return;
			}
			Aliquot_ComboBox->ItemIndex = 0;
			//THIS CULLS!!!!
			if (!m_rationaliseTanks.checkForCombiningBoxesInTheAliquot(false))
			{
				fillBoxTypeComboBox();
				Memo->Clear();
				Memo->Lines->Add("Cancelled");
				return;
			}
			TrackBarThreshold->Enabled = true;
			fillBoxTypeComboBox();
		}
	}
	catch( const String& msg )
	{
		String displayString = String("Failed to acess database, please try again- \n\n Reason :\n") + msg;
		Application->MessageBox(UnicodeString(displayString.c_str()).c_str(), L"Error", MB_OK);
	}
	Screen->Cursor = crDefault;
}
void __fastcall TfrmRatTanksBoxSelection::FormDestroy(TObject *Sender)
{
	clearComboBox(boxTypeComboBox);
}