Merge pull request #8424 from howard-stearns/discovery-cleanup

Discovery cleanup
This commit is contained in:
Howard Stearns 2016-08-12 14:10:39 -07:00 committed by GitHub
commit b88ef3cf6d
3 changed files with 22 additions and 15 deletions

View file

@ -197,7 +197,8 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
QJsonObject userStoryObject;
QJsonObject detailsObject;
detailsObject.insert("image_url", imageUrl);
userStoryObject.insert("details", detailsObject);
QString pickledDetails = QJsonDocument(detailsObject).toJson();
userStoryObject.insert("details", pickledDetails);
userStoryObject.insert("thumbnail_url", thumbnailUrl);
userStoryObject.insert("place_name", placeName);
userStoryObject.insert("path", currentPath);

View file

@ -35,16 +35,18 @@
}
.snapsection{
width:95% !important;
padding-right:0px;
width:95% !important;
padding-right:0px;
}
div#sharing {
margin-top:50px;
}
div.clear { clear: both; }
</style>
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
<script>
var paths = [], idCounter = 0;
var paths = [], idCounter = 0, useCheckboxes;
function addImage(data) {
var div = document.createElement("DIV"),
input = document.createElement("INPUT"),
@ -54,15 +56,18 @@
function toggle() { data.share = input.checked; }
img.src = data.localPath;
div.appendChild(img);
// Our stylesheet(?) requires input.id to match label.for. Otherwise input doesn't display the check state.
label.setAttribute('for', id); // cannot do label.for =
input.id = id;
input.type = "checkbox";
input.checked = data.share = true;
input.addEventListener('change', toggle);
div.class = "property checkbox";
div.appendChild(input);
div.appendChild(label);
data.share = true;
if (useCheckboxes) { // I'd rather use css, but the included stylesheet is quite particular.
// Our stylesheet(?) requires input.id to match label.for. Otherwise input doesn't display the check state.
label.setAttribute('for', id); // cannot do label.for =
input.id = id;
input.type = "checkbox";
input.checked = true;
input.addEventListener('change', toggle);
div.class = "property checkbox";
div.appendChild(input);
div.appendChild(label);
}
document.getElementById("snapshot-images").appendChild(div);
paths.push(data);
@ -91,6 +96,7 @@
handleShareButtons(shareMsg);
// rest are image paths which we add
useCheckboxes = message.length > 1;
message.forEach(addImage);
});
EventBridge.emitWebEvent('ready');

View file

@ -21,7 +21,7 @@ var button = toolBar.addButton({
});
function confirmShare(data) {
var dialog = new OverlayWebWindow('Snapshot', Script.resolvePath("html/ShareSnapshot.html"), 800, 300);
var dialog = new OverlayWebWindow('Snapshot', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
function onMessage(message) {
if (message == 'ready') { // The window can now receive data from us.
dialog.emitScriptEvent(data); // Send it.