diff --git a/examples/network/doc/images/torrent-example.png b/examples/network/doc/images/torrent-example.png index 1032716e046..485bc7f7195 100644 Binary files a/examples/network/doc/images/torrent-example.png and b/examples/network/doc/images/torrent-example.png differ diff --git a/examples/network/torrent/CMakeLists.txt b/examples/network/torrent/CMakeLists.txt index 3a02f5def18..6b1ca6d98bf 100644 --- a/examples/network/torrent/CMakeLists.txt +++ b/examples/network/torrent/CMakeLists.txt @@ -44,14 +44,15 @@ target_link_libraries(torrent PRIVATE # Resources: set(icons_resource_files - "icons/1downarrow.png" - "icons/1uparrow.png" - "icons/bottom.png" - "icons/exit.png" - "icons/peertopeer.png" - "icons/player_pause.png" - "icons/player_play.png" - "icons/player_stop.png" + "icons/1downarrow.svg" + "icons/1uparrow.svg" + "icons/bottom.svg" + "icons/exit.svg" + "icons/peertopeer.svg" + "icons/player_pause.svg" + "icons/player_play.svg" + "icons/player_stop.svg" + "icons/about.svg" ) qt_add_resources(torrent "icons" diff --git a/examples/network/torrent/icons.qrc b/examples/network/torrent/icons.qrc index 9541ef76002..5606275d92f 100644 --- a/examples/network/torrent/icons.qrc +++ b/examples/network/torrent/icons.qrc @@ -1,12 +1,13 @@ - - - icons/peertopeer.png - icons/1uparrow.png - icons/1downarrow.png - icons/bottom.png - icons/player_pause.png - icons/player_play.png - icons/player_stop.png - icons/exit.png - + + + icons/peertopeer.svg + icons/1uparrow.svg + icons/1downarrow.svg + icons/bottom.svg + icons/player_pause.svg + icons/player_play.svg + icons/player_stop.svg + icons/exit.svg + icons/about.svg + diff --git a/examples/network/torrent/icons/1downarrow.png b/examples/network/torrent/icons/1downarrow.png deleted file mode 100644 index 08403b82ba1..00000000000 Binary files a/examples/network/torrent/icons/1downarrow.png and /dev/null differ diff --git a/examples/network/torrent/icons/1downarrow.svg b/examples/network/torrent/icons/1downarrow.svg new file mode 100644 index 00000000000..fc43085f59e --- /dev/null +++ b/examples/network/torrent/icons/1downarrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/examples/network/torrent/icons/1uparrow.png b/examples/network/torrent/icons/1uparrow.png deleted file mode 100644 index f044811787f..00000000000 Binary files a/examples/network/torrent/icons/1uparrow.png and /dev/null differ diff --git a/examples/network/torrent/icons/1uparrow.svg b/examples/network/torrent/icons/1uparrow.svg new file mode 100644 index 00000000000..aaed7896178 --- /dev/null +++ b/examples/network/torrent/icons/1uparrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/examples/network/torrent/icons/about.svg b/examples/network/torrent/icons/about.svg new file mode 100644 index 00000000000..2772c4fa31e --- /dev/null +++ b/examples/network/torrent/icons/about.svg @@ -0,0 +1,4 @@ + + + + diff --git a/examples/network/torrent/icons/bottom.png b/examples/network/torrent/icons/bottom.png deleted file mode 100644 index fe66b5d028a..00000000000 Binary files a/examples/network/torrent/icons/bottom.png and /dev/null differ diff --git a/examples/network/torrent/icons/bottom.svg b/examples/network/torrent/icons/bottom.svg new file mode 100644 index 00000000000..44395cde252 --- /dev/null +++ b/examples/network/torrent/icons/bottom.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/examples/network/torrent/icons/edit_add.png b/examples/network/torrent/icons/edit_add.png deleted file mode 100644 index 85b022e7a4f..00000000000 Binary files a/examples/network/torrent/icons/edit_add.png and /dev/null differ diff --git a/examples/network/torrent/icons/edit_add.svg b/examples/network/torrent/icons/edit_add.svg new file mode 100644 index 00000000000..ec817193f5e --- /dev/null +++ b/examples/network/torrent/icons/edit_add.svg @@ -0,0 +1,4 @@ + + + + diff --git a/examples/network/torrent/icons/edit_remove.png b/examples/network/torrent/icons/edit_remove.png deleted file mode 100644 index 93361f52252..00000000000 Binary files a/examples/network/torrent/icons/edit_remove.png and /dev/null differ diff --git a/examples/network/torrent/icons/edit_remove.svg b/examples/network/torrent/icons/edit_remove.svg new file mode 100644 index 00000000000..ec18b7da645 --- /dev/null +++ b/examples/network/torrent/icons/edit_remove.svg @@ -0,0 +1,3 @@ + + + diff --git a/examples/network/torrent/icons/exit.png b/examples/network/torrent/icons/exit.png deleted file mode 100644 index 2f7ff43a71e..00000000000 Binary files a/examples/network/torrent/icons/exit.png and /dev/null differ diff --git a/examples/network/torrent/icons/exit.svg b/examples/network/torrent/icons/exit.svg new file mode 100644 index 00000000000..94f5245c529 --- /dev/null +++ b/examples/network/torrent/icons/exit.svg @@ -0,0 +1,4 @@ + + + + diff --git a/examples/network/torrent/icons/peertopeer.png b/examples/network/torrent/icons/peertopeer.png deleted file mode 100644 index f4856dcec5d..00000000000 Binary files a/examples/network/torrent/icons/peertopeer.png and /dev/null differ diff --git a/examples/network/torrent/icons/peertopeer.svg b/examples/network/torrent/icons/peertopeer.svg new file mode 100644 index 00000000000..9498804cb89 --- /dev/null +++ b/examples/network/torrent/icons/peertopeer.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/network/torrent/icons/player_pause.png b/examples/network/torrent/icons/player_pause.png deleted file mode 100644 index 8c9bcc45561..00000000000 Binary files a/examples/network/torrent/icons/player_pause.png and /dev/null differ diff --git a/examples/network/torrent/icons/player_pause.svg b/examples/network/torrent/icons/player_pause.svg new file mode 100644 index 00000000000..6499480ea47 --- /dev/null +++ b/examples/network/torrent/icons/player_pause.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/examples/network/torrent/icons/player_play.png b/examples/network/torrent/icons/player_play.png deleted file mode 100644 index 70daa339be9..00000000000 Binary files a/examples/network/torrent/icons/player_play.png and /dev/null differ diff --git a/examples/network/torrent/icons/player_play.svg b/examples/network/torrent/icons/player_play.svg new file mode 100644 index 00000000000..a8cce6f4223 --- /dev/null +++ b/examples/network/torrent/icons/player_play.svg @@ -0,0 +1,3 @@ + + + diff --git a/examples/network/torrent/icons/player_stop.png b/examples/network/torrent/icons/player_stop.png deleted file mode 100644 index ce6585ae84e..00000000000 Binary files a/examples/network/torrent/icons/player_stop.png and /dev/null differ diff --git a/examples/network/torrent/icons/player_stop.svg b/examples/network/torrent/icons/player_stop.svg new file mode 100644 index 00000000000..e220f5a790a --- /dev/null +++ b/examples/network/torrent/icons/player_stop.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/network/torrent/icons/stop.png b/examples/network/torrent/icons/stop.png deleted file mode 100644 index 52e593ab214..00000000000 Binary files a/examples/network/torrent/icons/stop.png and /dev/null differ diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index 2b5d0a8757b..9bda5bb05e2 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -80,19 +80,19 @@ MainWindow::MainWindow(QWidget *parent) setCentralWidget(torrentView); // Set header resize modes and initial section sizes - QFontMetrics fm = fontMetrics(); + const QFontMetrics fm = torrentView->fontMetrics(); QHeaderView *header = torrentView->header(); header->resizeSection(0, fm.horizontalAdvance("typical-name-for-a-torrent.torrent")); - header->resizeSection(1, fm.horizontalAdvance(headers.at(1) + " ")); - header->resizeSection(2, fm.horizontalAdvance(headers.at(2) + " ")); - header->resizeSection(3, qMax(fm.horizontalAdvance(headers.at(3) + " "), fm.horizontalAdvance(" 1234.0 KB/s "))); - header->resizeSection(4, qMax(fm.horizontalAdvance(headers.at(4) + " "), fm.horizontalAdvance(" 1234.0 KB/s "))); - header->resizeSection(5, qMax(fm.horizontalAdvance(headers.at(5) + " "), fm.horizontalAdvance(tr("Downloading") + " "))); + header->resizeSection(1, fm.horizontalAdvance(headers.at(1) + " ")); + header->resizeSection(2, fm.horizontalAdvance(headers.at(2) + " ")); + header->resizeSection(3, qMax(fm.horizontalAdvance(headers.at(3) + " "), fm.horizontalAdvance(" 1234.0 KB/s "))); + header->resizeSection(4, qMax(fm.horizontalAdvance(headers.at(4) + " "), fm.horizontalAdvance(" 1234.0 KB/s "))); + header->resizeSection(5, qMax(fm.horizontalAdvance(headers.at(5) + " "), fm.horizontalAdvance(tr("Downloading") + " "))); // Create common actions - QAction *newTorrentAction = new QAction(QIcon(":/icons/bottom.png"), tr("Add &new torrent"), this); - pauseTorrentAction = new QAction(QIcon(":/icons/player_pause.png"), tr("&Pause torrent"), this); - removeTorrentAction = new QAction(QIcon(":/icons/player_stop.png"), tr("&Remove torrent"), this); + QAction *newTorrentAction = new QAction(QIcon(":/icons/bottom.svg"), tr("Add &new torrent"), this); + pauseTorrentAction = new QAction(QIcon(":/icons/player_pause.svg"), tr("&Pause torrent"), this); + removeTorrentAction = new QAction(QIcon(":/icons/player_stop.svg"), tr("&Remove torrent"), this); // File menu QMenu *fileMenu = menuBar()->addMenu(tr("&File")); @@ -100,12 +100,12 @@ MainWindow::MainWindow(QWidget *parent) fileMenu->addAction(pauseTorrentAction); fileMenu->addAction(removeTorrentAction); fileMenu->addSeparator(); - fileMenu->addAction(QIcon(":/icons/exit.png"), tr("E&xit"), this, &MainWindow::close); + fileMenu->addAction(QIcon(":/icons/exit.svg"), tr("E&xit"), this, &MainWindow::close); // Help menu QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); - helpMenu->addAction(tr("&About"), this, &MainWindow::about); - helpMenu->addAction(tr("About &Qt"), qApp, QApplication::aboutQt); + helpMenu->addAction(QIcon(":/icons/about.svg"), tr("&About"), this, &MainWindow::about); + helpMenu->addAction(QIcon(":/icons/about.svg"), tr("About &Qt"), qApp, QApplication::aboutQt); // Top toolbar QToolBar *topBar = new QToolBar(tr("Tools")); @@ -115,8 +115,8 @@ MainWindow::MainWindow(QWidget *parent) topBar->addAction(removeTorrentAction); topBar->addAction(pauseTorrentAction); topBar->addSeparator(); - downActionTool = topBar->addAction(QIcon(tr(":/icons/1downarrow.png")), tr("Move down")); - upActionTool = topBar->addAction(QIcon(tr(":/icons/1uparrow.png")), tr("Move up")); + downActionTool = topBar->addAction(QIcon(tr(":/icons/1downarrow.svg")), tr("Move down")); + upActionTool = topBar->addAction(QIcon(tr(":/icons/1uparrow.svg")), tr("Move up")); // Bottom toolbar QToolBar *bottomBar = new QToolBar(tr("Rate control")); @@ -462,10 +462,10 @@ void MainWindow::setActionsEnabled() pauseTorrentAction->setEnabled(item && pauseEnabled); if (client && client->state() == TorrentClient::Paused) { - pauseTorrentAction->setIcon(QIcon(":/icons/player_play.png")); + pauseTorrentAction->setIcon(QIcon(":/icons/player_play.svg")); pauseTorrentAction->setText(tr("Resume torrent")); } else { - pauseTorrentAction->setIcon(QIcon(":/icons/player_pause.png")); + pauseTorrentAction->setIcon(QIcon(":/icons/player_pause.svg")); pauseTorrentAction->setText(tr("Pause torrent")); } @@ -575,7 +575,10 @@ void MainWindow::setDownloadLimit(int value) void MainWindow::about() { QLabel *icon = new QLabel; - icon->setPixmap(QPixmap(":/icons/peertopeer.png")); + QImage img(":/icons/peertopeer.svg"); + QPixmap pm; + pm.convertFromImage(img); + icon->setPixmap(pm); QLabel *text = new QLabel; text->setWordWrap(true);