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 ); } }
/* * 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")); } }
/* //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; }
QPixmap QtFlagsListWidget::getCurrentFlagPixmap() { QtFlagsManager * qtFlagsManager = new QtFlagsManager(); QtFlag qtFlag = qtFlagsManager->getFlagByCountryName(getCurrentCountryName(), FLAGS_NAME_LANGUAGE); return qtFlag.getPixmap(); }