BUGFIX: Command-line parameters are no longer required to be in UTF-8

This commit is contained in:
Christophe Dumez
2010-03-04 08:34:45 +00:00
parent 8d55368f6a
commit 4cd9cfdb59
3 changed files with 8 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
- BUGFIX: Fix ratio calculation for directly seeded torrents (Thanks phorane) - BUGFIX: Fix ratio calculation for directly seeded torrents (Thanks phorane)
- BUGFIX: Fix memory leak in RSS parser - BUGFIX: Fix memory leak in RSS parser
- BUGFIX: Only one log window can be opened at a time - BUGFIX: Only one log window can be opened at a time
- BUGFIX: Command-line parameters are no longer required to be in UTF-8
* Web Feb 10 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.5 * Web Feb 10 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.5
- BUGFIX: Fix actions on selected torrents (non-selected torrents could be affected) - BUGFIX: Fix actions on selected torrents (non-selected torrents could be affected)

View File

@@ -396,7 +396,7 @@ void GUI::readParamsOnSocket() {
if(clientConnection) { if(clientConnection) {
QByteArray params = clientConnection->readAll(); QByteArray params = clientConnection->readAll();
if(!params.isEmpty()) { if(!params.isEmpty()) {
processParams(QString::fromUtf8(params.data()).split(QString::fromUtf8("\n"))); processParams(QString::fromLocal8Bit(params.constData()).split("\n"));
qDebug("Received parameters from another instance"); qDebug("Received parameters from another instance");
} }
clientConnection->deleteLater(); clientConnection->deleteLater();

View File

@@ -31,6 +31,7 @@
#include <QLocale> #include <QLocale>
#include <QTranslator> #include <QTranslator>
#include <QFile> #include <QFile>
#include <QPushButton>
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
#include <QApplication> #include <QApplication>
@@ -112,7 +113,7 @@ public:
msgBox.setText(tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.\n\nNo further notices will be issued.")); msgBox.setText(tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.\n\nNo further notices will be issued."));
msgBox.setWindowTitle(tr("Legal notice")); msgBox.setWindowTitle(tr("Legal notice"));
msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole); msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole);
QAbstractButton *agree_button =(QAbstractButton*)msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole); QAbstractButton *agree_button =msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole);
msgBox.exec(); msgBox.exec();
if(msgBox.clickedButton() == agree_button) { if(msgBox.clickedButton() == agree_button) {
// Save the answer // Save the answer
@@ -255,12 +256,12 @@ int main(int argc, char *argv[]){
// Check for executable parameters // Check for executable parameters
if(argc > 1){ if(argc > 1){
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){ if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--version")){
std::cout << "qBittorrent " << VERSION << '\n'; std::cout << "qBittorrent " << VERSION << '\n';
delete app; delete app;
return 0; return 0;
} }
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){ if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--help")){
UsageDisplay::displayUsage(argv[0]); UsageDisplay::displayUsage(argv[0]);
delete app; delete app;
return 0; return 0;
@@ -268,11 +269,11 @@ int main(int argc, char *argv[]){
for(int i=1; i<argc; ++i) { for(int i=1; i<argc; ++i) {
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
if(QString::fromUtf8(argv[i]) == QString::fromUtf8("--no-splash")) { if(QString::fromLocal8Bit(argv[i]) == QString::fromUtf8("--no-splash")) {
no_splash = true; no_splash = true;
} else { } else {
#endif #endif
if(QString::fromUtf8(argv[i]).startsWith("--webui-port=")) { if(QString::fromLocal8Bit(argv[i]).startsWith("--webui-port=")) {
QStringList parts = QString::fromUtf8(argv[i]).split("="); QStringList parts = QString::fromUtf8(argv[i]).split("=");
if(parts.size() == 2) { if(parts.size() == 2) {
bool ok = false; bool ok = false;