Skip to content

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

poldi171254
Copy link

@poldi171254 poldi171254 commented May 18, 2025

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

@poldi171254
Copy link
Author

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.
Also, as I mentioned before, I cannot close my previous pull request Network Remote V2.

@jonaski
Copy link
Member

jonaski commented May 27, 2025

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. Also, as I mentioned before, I cannot close my previous pull request Network Remote V2.

I already reviewed in the previous PR #1688, most of the issues are not addressed.

Copy link
Member

@jonaski jonaski left a 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>
Copy link
Member

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.

Copy link
Author

@poldi171254 poldi171254 May 30, 2025

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

Copy link
Member

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

@jonaski
Copy link
Member

jonaski commented May 27, 2025

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.

@jonaski
Copy link
Member

jonaski commented May 27, 2025

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.

@poldi171254
Copy link
Author

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

jonaski and others added 5 commits May 30, 2025 11:16
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
@poldi171254
Copy link
Author

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 I made mistakes when I squashed the commits. Any idea how to fix this?

@poldi171254
Copy link
Author

I've gone through your requests for V2 PR and as far as I can see I've done them all.
I'd like to move forward and suggest that we delete the V2 PR and focus on V3.

@jonaski
Copy link
Member

jonaski commented Jun 5, 2025

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

There already is a clang-format file in this repository as I explained here:
#1688 (review)

If you you are using something else for your development, maybe you can share what that is

@jonaski
Copy link
Member

jonaski commented Jun 5, 2025

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 I made mistakes when I squashed the commits. Any idea how to fix this?

I'm not sure you can fix it with a normal rebase since you have changed commits that were part of master.
I think you need to undo all the commits without deleting the the changes, then commit again and force push:
Do git reset HEAD^ until you reach a clean commit, then commit your changes and rebase with master to get back all the deleted commits.
I suggest to make a copy of the branch in case you accidentally delete something.

@@ -172,6 +172,12 @@ if(UNIX AND NOT APPLE)
endif()
find_package(X11 COMPONENTS X11_xcb)
endif()

find_package(Qt6 REQUIRED COMPONENTS Protobuf)
Copy link
Member

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)
Copy link
Member

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_;
Copy link
Member

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?


NetworkRemoteIncomingMsg::NetworkRemoteIncomingMsg(QObject *parent)
: QObject(parent),
msg_(new nw::remote::Message),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

}

void NetworkRemoteIncomingMsg::SetMsgType() {
msg_string_ = msg_stream_.toStdString();
Copy link
Member

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();
Copy link
Member

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.

Copy link
Author

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 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect filename

Copy link
Author

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;
Copy link
Member

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_;
Copy link
Member

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_;
Copy link
Member

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;
Copy link
Member

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)) {
Copy link
Member

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();
Copy link
Member

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_;
Copy link
Member

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 @@
/*
Copy link
Member

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

poldi171254 and others added 5 commits June 10, 2025 09:56
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants