diff --git a/Changelog b/Changelog index f38bdc66e..ca67fb395 100644 --- a/Changelog +++ b/Changelog @@ -48,6 +48,7 @@ - BUGFIX: Update torrent progress when its content changed (filtered files) - BUGFIX: Improved the way menu icons are installed to avoid problems on some systems - BUGFIX: Improved incremental download + - BUGFIX: Improved unicode support - COSMETIC: Redesigned torrent properties a little - COSMETIC: Redesigned options a little - COSMETIC: Display more logs messages concerning features diff --git a/TODO b/TODO index e0bdf6d97..8c0474aa6 100644 --- a/TODO +++ b/TODO @@ -88,5 +88,6 @@ beta4->beta5 changelog: - BUGFIX: Improved incremental download - BUGFIX: Fixed preview from seeding list - BUGFIX: Fixed Alt+3 & Ctrl+F keyboard shortcuts for third tab +- BUGFIX: Improved unicode support - I18N: Updated Italian, Polish, Portuguese, Brazilian and Spanish translations - COSMETIC: Changed the way progress bars are rendered diff --git a/src/GUI.cpp b/src/GUI.cpp index 66acf072b..6a449a422 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1248,7 +1248,7 @@ void GUI::configureSession(bool deleteOptions) { BTSession->setListeningPortsRange(options->getPorts()); new_listenPort = BTSession->getListenPort(); if(new_listenPort != old_listenPort) { - setInfoBar(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( QString(misc::toString(new_listenPort).c_str()))); + setInfoBar(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort))); } // Apply max connec limit (-1 if disabled) BTSession->setMaxConnections(options->getMaxConnec()); diff --git a/src/createtorrent_imp.cpp b/src/createtorrent_imp.cpp index 5b7f912c1..dccd5a646 100644 --- a/src/createtorrent_imp.cpp +++ b/src/createtorrent_imp.cpp @@ -54,10 +54,10 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){ } void createtorrent::on_browse_destination_clicked(){ - QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), QDir::homePath(), tr("Torrent Files")+" (*.torrent)"); + QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), QDir::homePath(), tr("Torrent Files")+QString::fromUtf8(" (*.torrent)")); if(!destination.isEmpty()){ - if(!destination.endsWith(".torrent")) - destination += ".torrent"; + if(!destination.endsWith(QString::fromUtf8(".torrent"))) + destination += QString::fromUtf8(".torrent"); txt_destination->setText(destination); } } @@ -204,7 +204,7 @@ void createtorrent::on_createButton_clicked(){ } catch (std::exception& e){ std::cerr << e.what() << "\n"; - QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(QString(e.what()))); + QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(QString::fromUtf8(e.what()))); hide(); return; } diff --git a/src/main.cpp b/src/main.cpp index c905cccbb..aaa80cdd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,26 +46,26 @@ void useStyle(QApplication *app, QString style){ std::cout << "* Style: Using " << style.toStdString() << " style\n"; - if(style == "Cleanlooks"){ + if(style == QString::fromUtf8("Cleanlooks")){ app->setStyle(new QCleanlooksStyle()); return; } - if(style == "Motif"){ + if(style == QString::fromUtf8("Motif")){ app->setStyle(new QMotifStyle()); return; } - if(style == "CDE"){ + if(style == QString::fromUtf8("CDE")){ app->setStyle(new QCDEStyle()); return; } #ifdef Q_WS_MAC - if(style == "MacOS"){ + if(style == QString::fromUtf8("MacOS")){ app->setStyle(new QMacStyle()); return; } #endif #ifdef Q_WS_WIN - if(style == "WinXP"){ + if(style == QString::fromUtf8("WinXP")){ app->setStyle(new QWindowsXPStyle()); return; } @@ -78,11 +78,11 @@ int main(int argc, char *argv[]){ QFile file; QString locale; if(argc > 1){ - if(QString(argv[1])=="--version"){ + if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){ std::cout << "qBittorrent " << VERSION << '\n'; return 0; } - if(QString(argv[1])=="--help"){ + if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){ std::cout << "Usage: \n"; std::cout << '\t' << argv[0] << " --version : displays program version\n"; std::cout << '\t' << argv[0] << " --help : displays this help message\n"; @@ -103,8 +103,8 @@ int main(int argc, char *argv[]){ if(argc > 1){ QStringList params; for(int i=1;ishow(); // Open options file to read locale - locale = settings.value("Options/Language/Locale", QString()).toString(); + locale = settings.value(QString::fromUtf8("Options/Language/Locale"), QString()).toString(); QTranslator translator; if(locale.isEmpty()){ locale = QLocale::system().name(); - settings.setValue("Options/Language/Locale", locale); + settings.setValue(QString::fromUtf8("Options/Language/Locale"), locale); } - if(translator.load(QString(":/lang/qbittorrent_") + locale)){ + if(translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){ qDebug("%s locale recognized, using translation.", (const char*)locale.toUtf8()); }else{ qDebug("%s locale unrecognized, using default (en_GB).", (const char*)locale.toUtf8()); } app.installTranslator(&translator); - app.setApplicationName("qBittorrent"); + app.setApplicationName(QString::fromUtf8("qBittorrent")); app.setQuitOnLastWindowClosed(false); // Read torrents given on command line QStringList torrentCmdLine = app.arguments(); diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 75eced5fb..a347fc499 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -1029,8 +1029,8 @@ void options_imp::processFilterFile(QString filePath){ address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); // add it to list - QStringList item(QString(start.to_string().c_str())); - item.append(QString(last.to_string().c_str())); + QStringList item(QString::fromUtf8(start.to_string().c_str())); + item.append(QString::fromUtf8(last.to_string().c_str())); if(!i){ item.append(QString::fromUtf8("Manual")); }else{ @@ -1048,8 +1048,8 @@ void options_imp::processFilterFile(QString filePath){ address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data()); // add it to list - QStringList item(QString(start.to_string().c_str())); - item.append(QString(last.to_string().c_str())); + QStringList item(QString::fromUtf8(start.to_string().c_str())); + item.append(QString::fromUtf8(last.to_string().c_str())); if(!i){ item.append(QString::fromUtf8("Manual")); }else{ diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index 863a29a06..5bb2d7bbc 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -303,7 +303,7 @@ void properties::loadTrackers(){ trackersURLS->clear(); unsigned int nbTrackers = trackers.size(); for(unsigned int i=0; iaddItem(QString(trackers[i].url.c_str())); + trackersURLS->addItem(misc::toQString(trackers[i].url)); } QString tracker = h.current_tracker().trimmed(); if(!tracker.isEmpty()){ @@ -449,7 +449,7 @@ void properties::lowerSelectedTracker(){ foreach(item, selectedItems){ QString url = item->text(); for(i=0; i omitted: %s", (const char*)root.tagName().toUtf8()); + else if(root.tagName() != QString::fromUtf8("rss")){ + qDebug("the file is not a rss stream, omitted: %s", root.tagName().toUtf8().data()); return -1; } QDomNode rss = root.firstChild(); diff --git a/src/rss_imp.cpp b/src/rss_imp.cpp index 8f78f00ad..f913a529a 100644 --- a/src/rss_imp.cpp +++ b/src/rss_imp.cpp @@ -134,10 +134,10 @@ RssStream* stream; foreach(stream, feeds){ QTreeWidgetItem* item = new QTreeWidgetItem(listStreams); - item->setData(0, Qt::DisplayRole, stream->getAliasOrUrl()+ QString(" (0)")); - item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); + item->setData(0, Qt::DisplayRole, stream->getAliasOrUrl()+ QString::fromUtf8(" (0)")); + item->setData(0,Qt::DecorationRole, QVariant(QIcon(QString::fromUtf8(":/Icons/loading.png")))); item->setData(1, Qt::DisplayRole, stream->getUrl()); - item->setToolTip(0, QString("")+tr("Description:")+QString(" ")+stream->getDescription()+QString("
")+tr("url:")+QString(" ")+stream->getUrl()+QString("
")+tr("Last refresh:")+QString(" ")+stream->getLastRefreshElapsedString()); + item->setToolTip(0, QString::fromUtf8("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+stream->getLastRefreshElapsedString()); } } @@ -157,10 +157,10 @@ return; } QTreeWidgetItem* item = new QTreeWidgetItem(listStreams); - item->setText(0, stream->getAliasOrUrl() + QString(" (0)")); + item->setText(0, stream->getAliasOrUrl() + QString::fromUtf8(" (0)")); item->setText(1, stream->getUrl()); item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); - item->setToolTip(0, QString("")+tr("Description:")+QString(" ")+stream->getDescription()+QString("
")+tr("url:")+QString(" ")+stream->getUrl()+QString("
")+tr("Last refresh:")+QString(" ")+stream->getLastRefreshElapsedString()); + item->setToolTip(0, QString::fromUtf8("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+stream->getLastRefreshElapsedString()); if(listStreams->topLevelItemCount() == 1) selectFirstFeed(); rssmanager->refresh(newUrl); @@ -174,7 +174,7 @@ for(unsigned int i=0; itopLevelItem(i); RssStream* stream = rssmanager->getFeed(item->data(1, Qt::DisplayRole).toString()); - item->setToolTip(0, QString("")+tr("Description:")+QString(" ")+stream->getDescription()+QString("
")+tr("url:")+QString(" ")+stream->getUrl()+QString("
")+tr("Last refresh:")+QString(" ")+stream->getLastRefreshElapsedString()); + item->setToolTip(0, QString::fromUtf8("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+stream->getLastRefreshElapsedString()); } } @@ -232,15 +232,15 @@ void RSSImp::updateFeedNbNews(QString url){ QTreeWidgetItem *item = getTreeItemFromUrl(url); RssStream *stream = rssmanager->getFeed(url); - item->setText(0, stream->getAliasOrUrl() + QString(" (") + QString::number(stream->getNbUnRead(), 10)+ String(")")); + item->setText(0, stream->getAliasOrUrl() + QString::fromUtf8(" (") + QString::number(stream->getNbUnRead(), 10)+ String(")")); } void RSSImp::updateFeedInfos(QString url, QString aliasOrUrl, unsigned int nbUnread){ QTreeWidgetItem *item = getTreeItemFromUrl(url); RssStream *stream = rssmanager->getFeed(url); - item->setText(0, aliasOrUrl + QString(" (") + QString::number(nbUnread, 10)+ String(")")); + item->setText(0, aliasOrUrl + QString::fromUtf8(" (") + QString::number(nbUnread, 10)+ String(")")); item->setData(0,Qt::DecorationRole, QVariant(QIcon(stream->getIconPath()))); - item->setToolTip(0, QString("")+tr("Description:")+QString(" ")+stream->getDescription()+QString("
")+tr("url:")+QString(" ")+stream->getUrl()+QString("
")+tr("Last refresh:")+QString(" ")+stream->getLastRefreshElapsedString()); + item->setToolTip(0, QString::fromUtf8("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+stream->getLastRefreshElapsedString()); // If the feed is selected, update the displayed news if(selectedFeedUrl == url){ refreshNewsList(getTreeItemFromUrl(url), 0); diff --git a/src/searchEngine.cpp b/src/searchEngine.cpp index 6050aafd0..56eeec067 100644 --- a/src/searchEngine.cpp +++ b/src/searchEngine.cpp @@ -204,7 +204,7 @@ void SearchEngine::saveColWidthSearchList() const{ QSettings settings("qBittorrent", "qBittorrent"); QStringList width_list; for(int i=0; icolumnCount(); ++i){ - width_list << QString(misc::toString(resultsBrowser->columnWidth(i)).c_str()); + width_list << misc::toQString(resultsBrowser->columnWidth(i)); } settings.setValue("SearchListColsWidth", width_list.join(" ")); qDebug("Search list columns width saved"); @@ -359,7 +359,7 @@ void SearchEngine::readSearchOutput(){ foreach(line, lines_list){ appendSearchResult(QString(line)); } - results_lbl->setText(tr("Results")+" ("+QString(misc::toString(nb_search_results).c_str())+"):"); + results_lbl->setText(tr("Results")+QString::fromUtf8(" (")+misc::toQString(nb_search_results)+QString::fromUtf8("):")); } // Returns version of nova.py search engine @@ -409,7 +409,7 @@ QByteArray SearchEngine::getNovaChangelog(QString novaPath, float my_version) co QString end_version = "# Version: "; char tmp[5]; snprintf(tmp, 5, "%.2f", my_version); - end_version+=QString(tmp); + end_version+=QString::fromUtf8(tmp); if(line.startsWith((const char*)end_version.toUtf8())) break; if(in_changelog){ line.remove(0,1); @@ -516,7 +516,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ } } } - results_lbl->setText(tr("Results", "i.e: Search results")+" ("+QString(misc::toString(nb_search_results).c_str())+"):"); + results_lbl->setText(tr("Results", "i.e: Search results")+QString::fromUtf8(" (")+misc::toQString(nb_search_results)+QString::fromUtf8("):")); search_button->setEnabled(true); stop_search_button->setEnabled(false); }