-
-
Notifications
You must be signed in to change notification settings - Fork 227
Network Remote V3 #1747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Network Remote V3 #1747
Conversation
I'd appreciate of you could find the time for a review so I can maybe focus on working on some other areas of Strawberry. |
I already reviewed in the previous PR #1688, most of the issues are not addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the issues are not addressed, there is also still lot's of formatting issues, it's not consistent.
I also made some additional comments.
@@ -132,7 +132,7 @@ | |||
<item> | |||
<spacer name="spacer_alsaplugin"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
<enum>Qt::Orientation::Horizontal</enum> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes shouldn't be part of the PR since it's unrelated to the network remote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but not sure how it got there as I did not make any changes or how to resolve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You pulled this in with a merge, this is unnecessary noise in a PR, don't mark it resolved when it clearly isn't
I don't understand why your merging in a bunch of unrelated commits here, there is no commit here explaining what's being done here. |
Commit 8e158ad looks strange, it's a mix my changes and your changes, the text in the commit title is from a different commit, while the commit message body is a mix of different comments. |
I think one of the recurring issues seems to be the format of the code. I'm using Qt Creator If you are using CLangFormat settings maybe you can share your .clang_format file If you you are using something else for your development, maybe you can share what that is |
You need to restart Strawberry for this setting to take affect
Renamed classes to be less ambiguous Save before clientmanager changes This works after major change in clientmanager Cleaned up formatting Still works I have fixed most of the code issues apart from the one I commented on where I wasn't sure what was meant or how to resolve the issue. I reformatted all my code and used Qt stringliterals where applicable Cmake now uses Qt Protobuf I removed Application where I could. Still needed where I need acces to the player. All objects should now be freed. I have hardcoded the CMAKE_INSTALL_RPATH as RPATH seems to be a requirement when using Ninja as the cmake generator. Ubuntu currently comes with 6.4.2, but the QtCreator is on 6.8 I'm pulling in the library from the Creator Not sure what you meant by "I think we should use signals/slots to reload settings (like most other places) instead of the singleton" Not sure what the Copyright header should look like. Do I put my name on this? I have not made the Network remote optional yet as I wanted to get the code sorted out first I still have have one outstanding issue on Ubuntu [1276/1276 11.5/sec] Linking CXX executable strawberry /usr/bin/ld: warning: libicui18n.so.73, needed by /home/llist/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6.8.2, may conflict with libicui18n.so.74 /usr/bin/ld: warning: libicuuc.so.73, needed by /home/llist/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6.8.2, may conflict with libicuuc.so.74 Changes requested by maintainer Added Copyright Passing Player instead of Application as an argument Clean code as per maintainers request Using Player rather than Application class to get song data Code cleanup Removed RPATH related entries form cmake file Fixed code as per maintainers reuqest Removed all non essential refererences to a Application from the code Inserted Copyright Stage 1 of making Network Remote optional
af9306e
to
f9b5b00
Compare
I think I made mistakes when I squashed the commits. Any idea how to fix this? |
I've gone through your requests for V2 PR and as far as I can see I've done them all. |
There already is a clang-format file in this repository as I explained here:
|
I'm not sure you can fix it with a normal rebase since you have changed commits that were part of master. |
@@ -172,6 +172,12 @@ if(UNIX AND NOT APPLE) | |||
endif() | |||
find_package(X11 COMPONENTS X11_xcb) | |||
endif() | |||
|
|||
find_package(Qt6 REQUIRED COMPONENTS Protobuf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already explained before, this should be combined with existing find_package.
target_link_libraries(strawberry PUBLIC strawberry_lib) | ||
if(HAVE_NETWORKREMOTE) | ||
add_subdirectory(src/networkremote) | ||
target_link_libraries(strawberry_lib PRIVATE Qt6::Protobuf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine with the existing target_link_libraries
|
||
private: | ||
const SharedPtr<Player> player_; | ||
QList<NetworkRemoteClient*> clients_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can QSharedPointer be used for clients?
src/networkremote/incomingmsg.cpp
Outdated
|
||
NetworkRemoteIncomingMsg::NetworkRemoteIncomingMsg(QObject *parent) | ||
: QObject(parent), | ||
msg_(new nw::remote::Message), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
src/networkremote/incomingmsg.cpp
Outdated
} | ||
|
||
void NetworkRemoteIncomingMsg::SetMsgType() { | ||
msg_string_ = msg_stream_.toStdString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Qt Protobuf
void NetworkRemoteClientManager::StateChanged() { | ||
QTcpSocket *socket = qobject_cast<QTcpSocket*>(sender()); | ||
if (!socket) return; | ||
qLog(Debug) << socket->state(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These log messages need to be improved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be more specific?
@@ -0,0 +1,47 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with it?
#include "core/application.h" | ||
#include "core/logging.h" | ||
|
||
NetworkRemote* NetworkRemote::sInstance_ = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove singleton
bool enabled_; | ||
bool local_only_; | ||
int remote_port_; | ||
QHostAddress ipAddr_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use snake case for variable names
int remote_port_; | ||
QHostAddress ipAddr_; | ||
NetworkRemoteTcpServer *server_; | ||
static NetworkRemote *sInstance_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
for (const QHostAddress &address : std::as_const(hostList)) { | ||
if (address.protocol() == QAbstractSocket::IPv4Protocol && address.isLoopback() == false && !found) { | ||
qInfo( "Warning: The code only picks the first IPv4 address"); | ||
found = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indent
void NetworkRemoteSettings::SetIpAdress() { | ||
bool found = false; | ||
const QList<QHostAddress> hostList = QNetworkInterface::allAddresses(); | ||
for (const QHostAddress &address : std::as_const(hostList)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need std::as_const
since you already declare hostList
const
|
||
void NetworkRemoteSettings::SetIpAdress() { | ||
bool found = false; | ||
const QList<QHostAddress> hostList = QNetworkInterface::allAddresses(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use snake case for variable names
void SetPort(int); | ||
|
||
private: | ||
Settings s_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to keep s_ a class member, declare setting where you use it.
@@ -0,0 +1,46 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect filename, filename should match lowercase class name
…le changes This should all be ok now
You need to restart Strawberry for this setting to take affect
I now have a working version with option network remote code. I still need to check the maintainers latest comments.
I have now made the Network Remote optional and cleaned up the code as per request.
This replaces V2 pull request.
I tried to close my previous pull request, but can't find a way of doinng this