Skip to content

Commit

Permalink
Merge pull request #568 from olivierchatry/develop
Browse files Browse the repository at this point in the history
make picotorrent dpi aware on windows
  • Loading branch information
olivierchatry committed May 4, 2018
2 parents 17beb6c + 81575d5 commit effbda7
Show file tree
Hide file tree
Showing 11 changed files with 416 additions and 317 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)


# Generate buildinfo file
configure_file("${CMAKE_SOURCE_DIR}/src/picotorrent/buildinfo.cpp.in" "${CMAKE_SOURCE_DIR}/src/picotorrent/buildinfo.cpp" @ONLY)

Expand Down Expand Up @@ -137,6 +138,7 @@ add_executable(
src/picotorrent/preferencesdlg
src/picotorrent/proxypage
src/picotorrent/resources.rc
src/picotorrent/scaler
src/picotorrent/sessionloader
src/picotorrent/sessionsettings
src/picotorrent/sessionstate
Expand Down Expand Up @@ -177,3 +179,13 @@ target_link_libraries(
debug libboost_system-vc141-mt-gd-${BOOST_ARCH}-1_66
optimized libboost_system-vc141-mt-${BOOST_ARCH}-1_66
)


IF (MSVC)
ADD_CUSTOM_COMMAND(
TARGET PicoTorrent
POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}/manifest/dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:PicoTorrent>\"\;\#1 -outputresource:\"$<TARGET_FILE:PicoTorrent>\"\;\#1
COMMENT "Adding display aware manifest..."
)
ENDIF(MSVC)
8 changes: 8 additions & 0 deletions manifest/dpiaware.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
</windowsSettings>
</application>
</assembly>
11 changes: 7 additions & 4 deletions src/picotorrent/addtorrentdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "translator.hpp"
#include "utils.hpp"

#include "scaler.hpp"

#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/torrent_info.hpp>
#include <wx/dataview.h>
Expand All @@ -14,6 +16,7 @@

#include <shellapi.h>


namespace lt = libtorrent;
using pt::AddTorrentDialog;

Expand All @@ -32,7 +35,7 @@ wxEND_EVENT_TABLE()
AddTorrentDialog::AddTorrentDialog(wxWindow* parent,
std::shared_ptr<pt::Translator> translator,
std::vector<lt::add_torrent_params>& params)
: wxDialog(parent, wxID_ANY, i18n(translator, "add_torrent_s"), wxDefaultPosition, wxSize(400, 540), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
: wxDialog(parent, wxID_ANY, i18n(translator, "add_torrent_s"), wxDefaultPosition, wxSize(SX(400), SY(540)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
m_params(params),
m_trans(translator),
m_filesViewModel(new FileStorageViewModel(translator))
Expand Down Expand Up @@ -81,21 +84,21 @@ AddTorrentDialog::AddTorrentDialog(wxWindow* parent,
i18n(m_trans, "name"),
FileStorageViewModel::Columns::Name,
wxDATAVIEW_CELL_INERT,
220,
SX(220),
wxALIGN_LEFT);

m_filesView->AppendTextColumn(
i18n(m_trans, "size"),
FileStorageViewModel::Columns::Size,
wxDATAVIEW_CELL_INERT,
80,
SX(80),
wxALIGN_RIGHT);

auto prioCol = m_filesView->AppendTextColumn(
i18n(m_trans, "priority"),
FileStorageViewModel::Columns::Priority,
wxDATAVIEW_CELL_INERT,
80,
SX(80),
wxALIGN_RIGHT);

nameCol->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
Expand Down
9 changes: 5 additions & 4 deletions src/picotorrent/filespage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "filestorageviewmodel.hpp"
#include "string.hpp"
#include "translator.hpp"
#include "scaler.hpp"

#include <libtorrent/torrent_info.hpp>
#include <libtorrent/torrent_status.hpp>
Expand Down Expand Up @@ -36,27 +37,27 @@ FilesPage::FilesPage(wxWindow* parent, wxWindowID id, std::shared_ptr<pt::Transl
i18n(tran, "name"),
FileStorageViewModel::Columns::Name,
wxDATAVIEW_CELL_INERT,
220,
SX(220),
wxALIGN_LEFT);

m_filesView->AppendTextColumn(
i18n(tran, "size"),
FileStorageViewModel::Columns::Size,
wxDATAVIEW_CELL_INERT,
80,
SX(80),
wxALIGN_RIGHT);

m_filesView->AppendProgressColumn(
i18n(tran, "progress"),
FileStorageViewModel::Columns::Progress,
wxDATAVIEW_CELL_INERT,
80);
SX(80));

m_filesView->AppendTextColumn(
i18n(tran, "priority"),
FileStorageViewModel::Columns::Priority,
wxDATAVIEW_CELL_INERT,
80,
SX(80),
wxALIGN_RIGHT);

// Ugly hack to prevent the last "real" column from stretching.
Expand Down
13 changes: 7 additions & 6 deletions src/picotorrent/peerspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "peersviewmodel.hpp"
#include "translator.hpp"
#include "scaler.hpp"

#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_status.hpp>
Expand All @@ -15,12 +16,12 @@ PeersPage::PeersPage(wxWindow* parent, wxWindowID id, std::shared_ptr<pt::Transl
m_peersView(new wxDataViewCtrl(this, wxID_ANY)),
m_viewModel(new PeersViewModel())
{
m_peersView->AppendTextColumn(i18n(tr, "ip"), PeersViewModel::Columns::IP, wxDATAVIEW_CELL_INERT, 110);
m_peersView->AppendTextColumn(i18n(tr, "client"), PeersViewModel::Columns::Client, wxDATAVIEW_CELL_INERT, 140);
m_peersView->AppendTextColumn(i18n(tr, "flags"), PeersViewModel::Columns::Flags, wxDATAVIEW_CELL_INERT, 80);
m_peersView->AppendTextColumn(i18n(tr, "dl"), PeersViewModel::Columns::DownloadRate, wxDATAVIEW_CELL_INERT, 80, wxALIGN_RIGHT);
m_peersView->AppendTextColumn(i18n(tr, "ul"), PeersViewModel::Columns::UploadRate, wxDATAVIEW_CELL_INERT, 80, wxALIGN_RIGHT);
m_peersView->AppendProgressColumn(i18n(tr, "progress"), PeersViewModel::Columns::Progress, wxDATAVIEW_CELL_INERT, 100);
m_peersView->AppendTextColumn(i18n(tr, "ip"), PeersViewModel::Columns::IP, wxDATAVIEW_CELL_INERT, SX(110));
m_peersView->AppendTextColumn(i18n(tr, "client"), PeersViewModel::Columns::Client, wxDATAVIEW_CELL_INERT, SX(140));
m_peersView->AppendTextColumn(i18n(tr, "flags"), PeersViewModel::Columns::Flags, wxDATAVIEW_CELL_INERT, SX(80));
m_peersView->AppendTextColumn(i18n(tr, "dl"), PeersViewModel::Columns::DownloadRate, wxDATAVIEW_CELL_INERT, SX(80), wxALIGN_RIGHT);
m_peersView->AppendTextColumn(i18n(tr, "ul"), PeersViewModel::Columns::UploadRate, wxDATAVIEW_CELL_INERT, SX(80), wxALIGN_RIGHT);
m_peersView->AppendProgressColumn(i18n(tr, "progress"), PeersViewModel::Columns::Progress, wxDATAVIEW_CELL_INERT, SX(100));

// Ugly hack to prevent the last "real" column from stretching.
m_peersView->AppendColumn(new wxDataViewColumn(wxEmptyString, new wxDataViewTextRenderer(), -1, 0));
Expand Down

0 comments on commit effbda7

Please sign in to comment.