예제 #1
0
void QtVoxOxCallBarFrame::addComboBoxItem(QString text) {

	QString codeAreaFound;
	bool error;
	QString prefix = QString("011");
	QPixmap flagPixmap;

	QtFlag flag = getFlagByPhoneNumber(_qtFlagsManager, FLAGS_NAME_LANGUAGE, text, prefix, &error, &codeAreaFound);
	
	if(text.startsWith(prefix)){
		text.remove(0, prefix.size());
		text.insert(0, QChar('+'));
	}

	if(!error){
		flagPixmap = flag.getPixmap();
	}
	else{
		flagPixmap = QPixmap();
	}

	if(_ui->callBarComboBox->findText(text) == -1){		
		_ui->callBarComboBox->insertItem ( _ui->callBarComboBox->count() - 1, text );		
	}

	if(_ui->callBarComboBox->findText(CLEAR_RECENT_CALLS_MESSAGE) == -1){
		_ui->callBarComboBox->insertItem (_ui->callBarComboBox->count(), CLEAR_RECENT_CALLS_MESSAGE );
	}
}
예제 #2
0
void QtVoxOxCallBarFrame::setCountryCodeText(QString countryName){	

	if(!countryName.isEmpty() && countryName.toLower() != QString("none")){//if countryName is valid		
		//searches the corresponding flag according countryName and flagsNameLanguage
		QtFlag qtFlag = _qtFlagsManager->getFlagByCountryName(countryName, FLAGS_NAME_LANGUAGE);
		_ui->areaCodeLabel->setText(qtFlag.getCountryCode());
		_ui->areaCodeLabel->setToolTip(QString("Current country selected: ") + countryName);
	}
	else{
		_ui->areaCodeLabel->setText(QString(""));
		_ui->areaCodeLabel->setToolTip(QString("Select the country where you want to call"));
	}
	
}
예제 #3
0
//VOXOX CHANGE by Rolando - 2009.06.28 
void QtVoxOxCallBarFrame::setFullPhoneNumber(QString fullPhoneNumber){

	fullPhoneNumber = getPhoneNumberOnlyDigits(fullPhoneNumber);//VOXOX CHANGE by Rolando - 2009.06.28 

	QString phoneNumber;
	QString codeAreaFound;
	bool error;
	bool removePrefix = false;
	QString prefix = QString("011");

	if(fullPhoneNumber.startsWith(QString("+"))){//VOXOX CHANGE by Rolando - 2009.06.28 
		fullPhoneNumber = fullPhoneNumber.replace(0,1,prefix);
	}

	if(fullPhoneNumber.startsWith(prefix)){//VOXOX CHANGE by Rolando - 2009.06.28 
		removePrefix = true;
	}

	QtFlag flag = getFlagByPhoneNumber(_qtFlagsManager, FLAGS_NAME_LANGUAGE, fullPhoneNumber, prefix, &error, &codeAreaFound);//VOXOX CHANGE by Rolando - 2009.06.28 
			
	if(!error){//VOXOX CHANGE by Rolando - 2009.06.28 
		setFlagButtonPixmap(flag.getDefaultCountryName());
		setCountryCodeText(flag.getDefaultCountryName());
		_qtFlagsListWidget->setDefaultFlagByCountryName(flag.getDefaultCountryName());
		if(removePrefix){
			codeAreaFound = prefix + codeAreaFound;			
		}

		if(codeAreaFound == CODE_AREA_USA){
			phoneNumber = fullPhoneNumber;
		}
		else{
			phoneNumber = fullPhoneNumber.remove(0,codeAreaFound.length());
		}
		
		_voxOxToolTipLineEdit->setText(phoneNumber);//VOXOX CHANGE by Rolando - 2009.08.05 
	}
	else{
		setFlagButtonPixmap(QString(""));//VOXOX CHANGE by Rolando - 2009.06.28 
		setCountryCodeText(QString(""));
		_qtFlagsListWidget->setDefaultFlagByCountryName(QString(""));
		_voxOxToolTipLineEdit->setText(fullPhoneNumber);//VOXOX CHANGE by Rolando - 2009.08.05 
	}


}
예제 #4
0
/*
* setFlagButtonPixmap: displays a flag image according countryName parameter
* parameters: QString countryName
* returns void
*/
void QtVoxOxCallBarFrame::setFlagButtonPixmap(QString countryName){	

	QtFlag qtFlag = _qtFlagsManager->getFlagByCountryName(countryName, FLAGS_NAME_LANGUAGE);
	_ui->flagLabel->setPixmap(qtFlag.getPixmap());

	if(!qtFlag.isNullCountryName()){

		if(qtFlag.getDefaultCountryName() != ""){//if countryName is valid		
			_ui->flagLabel->setToolTip(QString("Current country selected: ") + qtFlag.getDefaultCountryName());
		}
		else{		
			_ui->flagLabel->setToolTip(QString("Select the country where you want to call"));
		}
	}
	else{		
		_ui->flagLabel->setToolTip(QString("Select the country where you want to call"));
	}
}
예제 #5
0
void QtVoxOxCallBarFrame::itemActivatedComboBoxSlot(int index){
	QString newText = _ui->callBarComboBox->itemText(index);

	if(newText == CLEAR_RECENT_CALLS_MESSAGE){
		clearOutgoingCalls();
		clearComboBoxEditText();
	}
	else{
		if(_ui->callBarComboBox->currentText() != newText){
			QString codeAreaFound;
			bool error;
			QString prefix = QString("011");
			QPixmap flagPixmap;

			QtFlag flag = getFlagByPhoneNumber(_qtFlagsManager, FLAGS_NAME_LANGUAGE, newText, prefix, &error, &codeAreaFound);
			
			if(!error){
				setFlagButtonPixmap(flag.getDefaultCountryName());
				setCountryCodeText(flag.getDefaultCountryName());
				_qtFlagsListWidget->setDefaultFlagByCountryName(flag.getDefaultCountryName());
			}
			else{
				setFlagButtonPixmap(QString(""));
				setCountryCodeText(QString(""));
				_qtFlagsListWidget->setDefaultFlagByCountryName(QString(""));
			}
			
			if(_ui->callBarComboBox->findText(newText) != -1){
				
				newText = newText.remove(QString("+") + codeAreaFound);
				_voxOxToolTipLineEdit->setText(newText);//VOXOX CHANGE by Rolando - 2009.08.05 
			}

			comboBoxTextChanged(newText);
		}

	}
	
}
예제 #6
0
/* //added by Rolando 04-11-08
 * getWidthNeededInItem: gets the width size needed in QtListWidget according the largest text in QtFlagsManager
 * parameters:  QtFlagsManager * qtFlagsManager, QString flagsNameLanguage
 * returns int, the width size needed in QtListWidget
*/
int QtFlagsListWidget::getWidthNeededInItem( QtFlagsManager * qtFlagsManager, QString flagsNameLanguage) {

    QFont font = _qListWidget->font();	//VOXOX CHANGE by Rolando - 2009.06.12

    //gets the largest country name text and sets their name to the variable
    QString largestCountryNameText = qtFlagsManager->getLargestCountryNameText();

    QtFlag flag = qtFlagsManager->getFlagByCountryName(largestCountryNameText,flagsNameLanguage);

    //gets the largest country name size in pixels
    int largestCountryNamePixelSize = qtFlagsManager->getPixelSizeText(largestCountryNameText, font);

    int pixmapWidthSize = flag.getPixmap().width();
    int blankSpacePixelSize = qtFlagsManager->getPixelSizeText(QString(" "), font);
    int largestCountryCodePixelSize = 0;

    //gets the flaglist according flagsNameLanguage
    QtFlagsManager::QtFlagList flagList = qtFlagsManager->getQtFlagList(flagsNameLanguage);
    QtFlagsManager::QtFlagList::iterator it;

    QString areaCode;
    int tmpCountryCodePixelSize = 0;

    for (it = flagList.begin(); it != flagList.end(); it++) {
        areaCode = it->getDefaultCountryCode();
        tmpCountryCodePixelSize =  qtFlagsManager->getPixelSizeText(areaCode, font);

        if(tmpCountryCodePixelSize > largestCountryCodePixelSize) {
            largestCountryCodePixelSize	= tmpCountryCodePixelSize;
        }
    }

    //because the format in item of QtFlagsListWidget is pixmap + blank space + countryName + blank space + areaCode + blank space
    int totalPixelsSizeCountryName = pixmapWidthSize + blankSpacePixelSize + largestCountryNamePixelSize + blankSpacePixelSize + largestCountryCodePixelSize + blankSpacePixelSize;
    return totalPixelsSizeCountryName;
}
예제 #7
0
QPixmap QtFlagsListWidget::getCurrentFlagPixmap() {
    QtFlagsManager * qtFlagsManager = new QtFlagsManager();
    QtFlag qtFlag = qtFlagsManager->getFlagByCountryName(getCurrentCountryName(), FLAGS_NAME_LANGUAGE);
    return qtFlag.getPixmap();
}