mirror of
https://github.com/zhigang1992/transshift.git
synced 2026-04-28 20:55:21 +08:00
Added switch control to RPCServerConfig to show/hide server free space. StatusListController has been modified to reflect this changes.
This commit is contained in:
@@ -274,6 +274,17 @@
|
||||
name = "RPC Server Config Controller";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2C6757441B530B52005C9EDC /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C039F391B52D33C00233534 /* StatusCategory.h */,
|
||||
2C039F3A1B52D33C00233534 /* StatusCategory.m */,
|
||||
2C039F3C1B52D3DD00233534 /* StatusCategories.h */,
|
||||
2C039F3D1B52D3DD00233534 /* StatusCategories.m */,
|
||||
);
|
||||
name = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2C6D18B71B3B4706002666C6 /* Server list controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -396,14 +407,11 @@
|
||||
2CF91D0E1B3C8B000093637A /* Status list controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C6757441B530B52005C9EDC /* Model */,
|
||||
2CF91D0F1B3C8B3B0093637A /* StatusListController.h */,
|
||||
2CF91D101B3C8B3B0093637A /* StatusListController.m */,
|
||||
2CFC267C1B44580E0070CC1C /* StatusListCell.h */,
|
||||
2CFC267D1B44580E0070CC1C /* StatusListCell.m */,
|
||||
2C039F391B52D33C00233534 /* StatusCategory.h */,
|
||||
2C039F3A1B52D33C00233534 /* StatusCategory.m */,
|
||||
2C039F3C1B52D3DD00233534 /* StatusCategories.h */,
|
||||
2C039F3D1B52D3DD00233534 /* StatusCategories.m */,
|
||||
);
|
||||
name = "Status list controller";
|
||||
sourceTree = "<group>";
|
||||
|
||||
23
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/Contents.json
vendored
Normal file
23
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "iconFreeSpace36x36_@36x36-5.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "iconFreeSpace36x36_@72x72-6.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "iconFreeSpace36x36_@108x108-7.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@108x108-7.png
vendored
Normal file
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@108x108-7.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@36x36-5.png
vendored
Normal file
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@36x36-5.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 897 B |
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@72x72-6.png
vendored
Normal file
BIN
TransmissionRPCClient/Images.xcassets/iconFreeSpace36x36.imageset/iconFreeSpace36x36_@72x72-6.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -56,7 +56,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>116</string>
|
||||
<string>129</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIBackgroundModes</key>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define RPC_DEFAULT_USE_SSL NO
|
||||
#define RPC_DEFAULT_NAME @"?"
|
||||
#define RPC_DEFAULT_HOST @"?"
|
||||
#define RPC_DEFAULT_SHOWFREESPACE YES
|
||||
|
||||
@interface RPCServerConfig : NSObject <NSCoding>
|
||||
|
||||
@@ -24,6 +25,7 @@
|
||||
@property(nonatomic) NSString *userName; // http basic auth user name
|
||||
@property(nonatomic) NSString *userPassword; // http basic auth password
|
||||
@property(nonatomic) BOOL useSSL; // use https
|
||||
@property(nonatomic) BOOL showFreeSpace; // update free space on server info
|
||||
@property(nonatomic) int refreshTimeout; // refresh time in seconds
|
||||
@property(nonatomic) int requestTimeout; // request timeout to server in seconds
|
||||
@property(nonatomic,readonly) NSString* urlString; // return short descriptions of class
|
||||
|
||||
@@ -13,6 +13,7 @@ static NSString *CODER_HOST = @"host";
|
||||
static NSString *CODER_USE_SSL = @"ssl";
|
||||
static NSString *CODER_REFRESH_TIMEOUT = @"time";
|
||||
static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
static NSString *CODER_SHOW_FREESPACE = @"showFreeSpace";
|
||||
|
||||
@implementation RPCServerConfig
|
||||
|
||||
@@ -29,6 +30,7 @@ static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
_rpcPath = RPC_DEFAULT_PATH;
|
||||
_refreshTimeout = RPC_DEFAULT_REFRESH_TIME;
|
||||
_requestTimeout = RPC_DEFAULT_REQUEST_TIMEOUT;
|
||||
_showFreeSpace = RPC_DEFAULT_SHOWFREESPACE;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -69,6 +71,7 @@ static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
_useSSL = [aDecoder decodeBoolForKey:CODER_USE_SSL];
|
||||
_refreshTimeout = [aDecoder decodeIntForKey:CODER_REFRESH_TIMEOUT];
|
||||
_requestTimeout = [aDecoder decodeIntForKey:CODER_REQUEST_TIMEOUT];
|
||||
_showFreeSpace = [aDecoder decodeBoolForKey:CODER_SHOW_FREESPACE];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -85,6 +88,7 @@ static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
[coder encodeInt:self.refreshTimeout forKey: CODER_REFRESH_TIMEOUT];
|
||||
[coder encodeInt:self.requestTimeout forKey:CODER_REQUEST_TIMEOUT];
|
||||
[coder encodeBool:self.useSSL forKey:CODER_USE_SSL];
|
||||
[coder encodeBool:self.showFreeSpace forKey:CODER_SHOW_FREESPACE];
|
||||
}
|
||||
|
||||
- (NSDictionary *)plist
|
||||
@@ -98,7 +102,8 @@ static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
CODER_USER_NAME : _userName,
|
||||
CODER_USER_PASSWORD : _userPassword,
|
||||
CODER_REFRESH_TIMEOUT : @(_refreshTimeout),
|
||||
CODER_REQUEST_TIMEOUT : @(_refreshTimeout)
|
||||
CODER_REQUEST_TIMEOUT : @(_refreshTimeout),
|
||||
CODER_SHOW_FREESPACE : @(_showFreeSpace)
|
||||
};
|
||||
|
||||
return pList;
|
||||
@@ -118,6 +123,7 @@ static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
|
||||
_userPassword = plist[CODER_USER_PASSWORD];
|
||||
_refreshTimeout = [(NSNumber*)plist[CODER_REFRESH_TIMEOUT] intValue];
|
||||
_requestTimeout = [(NSNumber*)plist[CODER_REQUEST_TIMEOUT] intValue];
|
||||
_showFreeSpace = [plist[CODER_SHOW_FREESPACE] boolValue];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -57,6 +57,11 @@
|
||||
@property (weak, nonatomic) IBOutlet UILabel *labelRequestTimeoutNumber;
|
||||
@property (weak, nonatomic) IBOutlet UIStepper *stepperRequestTimeout;
|
||||
|
||||
// MISC
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *switchShowFreeSpace;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *iconShowFreeSpace;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -78,7 +83,8 @@
|
||||
self.iconUserPassword,
|
||||
self.iconUseSSL,
|
||||
self.iconRefreshTimeout,
|
||||
self.iconRequestTimeout ];
|
||||
self.iconRequestTimeout,
|
||||
self.iconShowFreeSpace ];
|
||||
|
||||
|
||||
for (UIImageView *iv in arr)
|
||||
@@ -115,6 +121,8 @@
|
||||
self.stepperRequestTimeout.value = self.config.requestTimeout;
|
||||
[self requestTimeoutValueChagned:self.stepperRequestTimeout];
|
||||
[self refreshTimoutValueChanged:self.stepperRefreshTimeout];
|
||||
|
||||
self.switchShowFreeSpace.on = self.config.showFreeSpace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +249,8 @@
|
||||
self.config.refreshTimeout = (int)self.stepperRefreshTimeout.value;
|
||||
self.config.requestTimeout = (int)self.stepperRequestTimeout.value;
|
||||
|
||||
self.config.showFreeSpace = self.switchShowFreeSpace.on;
|
||||
|
||||
self.errorMessage = nil;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
{
|
||||
// select first row
|
||||
// and do it manualy
|
||||
NSIndexPath *path = [NSIndexPath indexPathForRow:0 inSection:0];
|
||||
// NSIndexPath *path = [NSIndexPath indexPathForRow:0 inSection:0];
|
||||
// make first row selected
|
||||
//[self.tableView selectRowAtIndexPath:path animated:YES scrollPosition:UITableViewScrollPositionNone];
|
||||
|
||||
@@ -344,16 +344,16 @@
|
||||
else if( nav.topViewController == _fileListController )
|
||||
[_connector getAllFilesForTorrentWithId:_fileListController.torrentId];
|
||||
|
||||
else if( _sessionInfo )
|
||||
{
|
||||
//if( _sessionInfo )
|
||||
// update free space
|
||||
[_connector getFreeSpaceWithDownloadDir:_sessionInfo.downloadDir];
|
||||
}
|
||||
// [_connector getFreeSpaceWithDownloadDir:_sessionInfo.downloadDir];
|
||||
}
|
||||
|
||||
- (void)gotFreeSpaceString:(NSString *)freeSpace
|
||||
{
|
||||
//NSLog(@"gotFreeSpace");
|
||||
NSString *str = [NSString stringWithFormat:@"Free space: %@", freeSpace];
|
||||
|
||||
//self.footerInfoMessage = str;
|
||||
[self showFreeSpaceInfoWithString:str];
|
||||
|
||||
@@ -449,8 +449,7 @@
|
||||
[self.tableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
|
||||
[self.tableView endUpdates];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
arr = [_items updateForInsertWithInfos: torrents];
|
||||
if( arr.count > 0 )
|
||||
@@ -530,11 +529,13 @@
|
||||
torrents.totalDownloadRateString];
|
||||
|
||||
|
||||
|
||||
[self showHeaderDLRate:torrents.totalDownloadRateString ULRate:torrents.totalUploadRateString];
|
||||
|
||||
if( !self.splitViewController )
|
||||
_torrentController.headerInfoMessage = str;
|
||||
|
||||
if( _config.showFreeSpace && _sessionInfo && self.navigationController.visibleViewController == self )
|
||||
[_connector getFreeSpaceWithDownloadDir:_sessionInfo.downloadDir];
|
||||
}
|
||||
|
||||
- (void)setCount:(int)count forCellWithTitle:(NSString*)cellTitle
|
||||
@@ -713,7 +714,7 @@
|
||||
{
|
||||
// getting session information for the first time
|
||||
// get free space (fix)
|
||||
if( !_sessionInfo )
|
||||
if( !_sessionInfo && _config.showFreeSpace )
|
||||
[_connector getFreeSpaceWithDownloadDir:info.downloadDir];
|
||||
|
||||
_sessionInfo = info;
|
||||
|
||||
@@ -404,6 +404,43 @@
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Misc" id="sgr-nD-tEg">
|
||||
<cells>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="Vp4-dw-QmF">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Vp4-dw-QmF" id="Kwh-Yj-dIO">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="iconFreeSpace36x36" translatesAutoresizingMaskIntoConstraints="NO" id="k9n-5e-6SX">
|
||||
<rect key="frame" x="8" y="4" width="36" height="36"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="36" id="MNf-qk-b17"/>
|
||||
<constraint firstAttribute="height" constant="36" id="xwx-nz-kiY"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Show free space" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="56X-ZI-KZz">
|
||||
<rect key="frame" x="52" y="13" width="483" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="87Q-A2-dBz">
|
||||
<rect key="frame" x="543" y="6" width="51" height="31"/>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="87Q-A2-dBz" firstAttribute="leading" secondItem="56X-ZI-KZz" secondAttribute="trailing" constant="8" symbolic="YES" id="0Ki-J1-ASE"/>
|
||||
<constraint firstAttribute="centerY" secondItem="87Q-A2-dBz" secondAttribute="centerY" id="9uZ-QS-7uh"/>
|
||||
<constraint firstItem="k9n-5e-6SX" firstAttribute="leading" secondItem="Kwh-Yj-dIO" secondAttribute="leadingMargin" id="Cck-1y-zlC"/>
|
||||
<constraint firstItem="56X-ZI-KZz" firstAttribute="leading" secondItem="k9n-5e-6SX" secondAttribute="trailing" constant="8" symbolic="YES" id="QXA-DD-Ihb"/>
|
||||
<constraint firstAttribute="centerY" secondItem="k9n-5e-6SX" secondAttribute="centerY" id="SYM-ZI-zdH"/>
|
||||
<constraint firstItem="87Q-A2-dBz" firstAttribute="trailing" secondItem="Kwh-Yj-dIO" secondAttribute="trailingMargin" id="iUD-ys-PvK"/>
|
||||
<constraint firstAttribute="centerY" secondItem="56X-ZI-KZz" secondAttribute="centerY" id="oHP-ci-Thw"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="dhR-eQ-deP" id="qcp-Tx-ace"/>
|
||||
@@ -417,6 +454,7 @@
|
||||
<outlet property="iconRefreshTimeout" destination="op5-UB-VF2" id="CF9-rt-jvj"/>
|
||||
<outlet property="iconRequestTimeout" destination="Uno-6S-uDJ" id="JSq-W5-52u"/>
|
||||
<outlet property="iconServerName" destination="4YT-aG-pDY" id="S37-2y-Stp"/>
|
||||
<outlet property="iconShowFreeSpace" destination="k9n-5e-6SX" id="Qb6-sO-XEY"/>
|
||||
<outlet property="iconUseSSL" destination="0Hn-6c-5jT" id="Qm2-rQ-L9w"/>
|
||||
<outlet property="iconUserName" destination="bMk-9J-pZC" id="s0l-hn-6o4"/>
|
||||
<outlet property="iconUserPassword" destination="hk5-Et-nzv" id="0cR-dZ-Cgu"/>
|
||||
@@ -433,6 +471,7 @@
|
||||
<outlet property="labelUserPassword" destination="kea-W2-FXd" id="54U-gg-MTj"/>
|
||||
<outlet property="stepperRefreshTimeout" destination="fuW-g8-PbR" id="Wdd-du-YYp"/>
|
||||
<outlet property="stepperRequestTimeout" destination="dnP-eN-o3r" id="cTy-LV-s2l"/>
|
||||
<outlet property="switchShowFreeSpace" destination="87Q-A2-dBz" id="mn6-6F-0pS"/>
|
||||
<outlet property="switchUseSSL" destination="2YI-40-Bj6" id="KiQ-LQ-pa7"/>
|
||||
<outlet property="textHost" destination="smZ-GO-STl" id="1ov-4r-Fnd"/>
|
||||
<outlet property="textPort" destination="FPd-0s-og7" id="Kl4-A2-zHv"/>
|
||||
@@ -2526,6 +2565,7 @@
|
||||
<image name="iconComputer" width="37" height="37"/>
|
||||
<image name="iconFile" width="36" height="36"/>
|
||||
<image name="iconFolderClosed" width="36" height="36"/>
|
||||
<image name="iconFreeSpace36x36" width="36" height="36"/>
|
||||
<image name="iconKey" width="37" height="37"/>
|
||||
<image name="iconLock" width="37" height="37"/>
|
||||
<image name="iconMan" width="37" height="37"/>
|
||||
|
||||
Reference in New Issue
Block a user