mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-15 21:22:40 +00:00
Show the hosts in alphabetical order rather than in an undefined order
This commit is contained in:
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic) PairState pairState;
|
@property (nonatomic) PairState pairState;
|
||||||
@property (nonatomic) NSString * activeAddress;
|
@property (nonatomic) NSString * activeAddress;
|
||||||
|
|
||||||
|
- (NSComparisonResult)compareName:(Host *)other;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -14,4 +14,8 @@
|
|||||||
@synthesize online;
|
@synthesize online;
|
||||||
@synthesize activeAddress;
|
@synthesize activeAddress;
|
||||||
|
|
||||||
|
- (NSComparisonResult)compareName:(Host *)other {
|
||||||
|
return [self.name caseInsensitiveCompare:other.name];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -640,7 +640,9 @@ static NSMutableSet* hostList;
|
|||||||
UIComputerView* compView;
|
UIComputerView* compView;
|
||||||
float prevEdge = -1;
|
float prevEdge = -1;
|
||||||
@synchronized (hostList) {
|
@synchronized (hostList) {
|
||||||
for (Host* comp in hostList) {
|
// Sort the host list in alphabetical order
|
||||||
|
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
|
||||||
|
for (Host* comp in sortedHostList) {
|
||||||
compView = [[UIComputerView alloc] initWithComputer:comp andCallback:self];
|
compView = [[UIComputerView alloc] initWithComputer:comp andCallback:self];
|
||||||
compView.center = CGPointMake([self getCompViewX:compView addComp:addComp prevEdge:prevEdge], hostScrollView.frame.size.height / 2);
|
compView.center = CGPointMake([self getCompViewX:compView addComp:addComp prevEdge:prevEdge], hostScrollView.frame.size.height / 2);
|
||||||
prevEdge = compView.frame.origin.x + compView.frame.size.width;
|
prevEdge = compView.frame.origin.x + compView.frame.size.width;
|
||||||
|
|||||||
Reference in New Issue
Block a user