wip on grouping by file
This commit is contained in:
@@ -90,6 +90,7 @@ class MainFrameController {
|
|||||||
params["search-terms"] = search
|
params["search-terms"] = search
|
||||||
params["uuid"] = uuid.toString()
|
params["uuid"] = uuid.toString()
|
||||||
params["core"] = core
|
params["core"] = core
|
||||||
|
params["settings"] = view.settings
|
||||||
def group = mvcGroup.createMVCGroup("SearchTab", uuid.toString(), params)
|
def group = mvcGroup.createMVCGroup("SearchTab", uuid.toString(), params)
|
||||||
model.results[uuid.toString()] = group
|
model.results[uuid.toString()] = group
|
||||||
|
|
||||||
|
@@ -155,6 +155,8 @@ class OptionsController {
|
|||||||
uiSettings.autoFontSize = model.automaticFontSize
|
uiSettings.autoFontSize = model.automaticFontSize
|
||||||
uiSettings.fontSize = Integer.parseInt(view.fontSizeField.text)
|
uiSettings.fontSize = Integer.parseInt(view.fontSizeField.text)
|
||||||
|
|
||||||
|
uiSettings.groupByFile = model.groupByFile
|
||||||
|
|
||||||
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
||||||
model.clearCancelledDownloads = clearCancelledDownloads
|
model.clearCancelledDownloads = clearCancelledDownloads
|
||||||
uiSettings.clearCancelledDownloads = clearCancelledDownloads
|
uiSettings.clearCancelledDownloads = clearCancelledDownloads
|
||||||
@@ -242,6 +244,16 @@ class OptionsController {
|
|||||||
model.closeDecisionMade = true
|
model.closeDecisionMade = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ControllerAction
|
||||||
|
void groupByFile() {
|
||||||
|
model.groupByFile = true
|
||||||
|
}
|
||||||
|
|
||||||
|
@ControllerAction
|
||||||
|
void groupBySender() {
|
||||||
|
model.groupByFile = false
|
||||||
|
}
|
||||||
|
|
||||||
@ControllerAction
|
@ControllerAction
|
||||||
void clearHistory() {
|
void clearHistory() {
|
||||||
uiSettings.searchHistory.clear()
|
uiSettings.searchHistory.clear()
|
||||||
|
@@ -42,6 +42,7 @@ class OptionsModel {
|
|||||||
@Observable boolean excludeLocalResult
|
@Observable boolean excludeLocalResult
|
||||||
@Observable boolean showSearchHashes
|
@Observable boolean showSearchHashes
|
||||||
@Observable boolean clearUploads
|
@Observable boolean clearUploads
|
||||||
|
@Observable boolean groupByFile
|
||||||
@Observable boolean exitOnClose
|
@Observable boolean exitOnClose
|
||||||
@Observable boolean closeDecisionMade
|
@Observable boolean closeDecisionMade
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ class OptionsModel {
|
|||||||
clearUploads = uiSettings.clearUploads
|
clearUploads = uiSettings.clearUploads
|
||||||
exitOnClose = uiSettings.exitOnClose
|
exitOnClose = uiSettings.exitOnClose
|
||||||
storeSearchHistory = uiSettings.storeSearchHistory
|
storeSearchHistory = uiSettings.storeSearchHistory
|
||||||
|
groupByFile = uiSettings.groupByFile
|
||||||
|
|
||||||
if (core.router != null) {
|
if (core.router != null) {
|
||||||
inBw = String.valueOf(settings.inBw)
|
inBw = String.valueOf(settings.inBw)
|
||||||
|
@@ -76,9 +76,14 @@ class SearchTabModel {
|
|||||||
sourcesBucket.put(e.infohash, sourceBucket)
|
sourcesBucket.put(e.infohash, sourceBucket)
|
||||||
}
|
}
|
||||||
sourceBucket.addAll(e.sources)
|
sourceBucket.addAll(e.sources)
|
||||||
|
|
||||||
|
results2.clear()
|
||||||
|
results2.addAll(hashBucket.keySet())
|
||||||
|
|
||||||
JTable table = builder.getVariable("senders-table")
|
JTable table = builder.getVariable("senders-table")
|
||||||
table.model.fireTableDataChanged()
|
table.model.fireTableDataChanged()
|
||||||
|
table = builder.getVariable("results-table2")
|
||||||
|
table.model.fireTableDataChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -200,10 +200,16 @@ class OptionsView {
|
|||||||
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||||
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
|
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Remember search history", constraints: gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
label(text : "By default, group search results by", constraints : gbc(gridx :0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||||
|
panel(constraints : gbc(gridx : 1, gridy : 0, anchor : GridBagConstraints.LINE_END)) {
|
||||||
|
buttonGroup(id : "groupBy")
|
||||||
|
radioButton(text : "Sender", selected : bind {!model.groupByFile}, buttonGroup : groupBy, groupBySenderAction)
|
||||||
|
radioButton(text : "File", selected : bind {model.groupByFile}, buttonGroup : groupBy, groupByFileAction)
|
||||||
|
}
|
||||||
|
label(text : "Remember search history", constraints: gbc(gridx: 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
storeSearchHistoryCheckbox = checkBox(selected : bind {model.storeSearchHistory},
|
storeSearchHistoryCheckbox = checkBox(selected : bind {model.storeSearchHistory},
|
||||||
constraints : gbc(gridx : 1, gridy:0, anchor : GridBagConstraints.LINE_END))
|
constraints : gbc(gridx : 1, gridy:1, anchor : GridBagConstraints.LINE_END))
|
||||||
button(text : "Clear history", constraints : gbc(gridx : 1, gridy : 1, anchor : GridBagConstraints.LINE_END), clearHistoryAction)
|
button(text : "Clear history", constraints : gbc(gridx : 1, gridy : 2, anchor : GridBagConstraints.LINE_END), clearHistoryAction)
|
||||||
|
|
||||||
}
|
}
|
||||||
panel (border : titledBorder(title : "Other Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
panel (border : titledBorder(title : "Other Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||||
|
@@ -39,6 +39,8 @@ class SearchTabView {
|
|||||||
FactoryBuilderSupport builder
|
FactoryBuilderSupport builder
|
||||||
@MVCMember @Nonnull
|
@MVCMember @Nonnull
|
||||||
SearchTabModel model
|
SearchTabModel model
|
||||||
|
|
||||||
|
UISettings settings
|
||||||
|
|
||||||
def pane
|
def pane
|
||||||
def parent
|
def parent
|
||||||
@@ -175,6 +177,7 @@ class SearchTabView {
|
|||||||
tableModel(list : model.senders2) {
|
tableModel(list : model.senders2) {
|
||||||
closureColumn(header : "Sender", preferredWidth : 350, type : String, read : {it.sender.getHumanReadableName()})
|
closureColumn(header : "Sender", preferredWidth : 350, type : String, read : {it.sender.getHumanReadableName()})
|
||||||
closureColumn(header : "Browse", preferredWidth : 20, type : Boolean, read : {it.browse})
|
closureColumn(header : "Browse", preferredWidth : 20, type : Boolean, read : {it.browse})
|
||||||
|
closureColumn(header : "Comment", preferredWidth : 20, type : Boolean, read : {it.comment != null})
|
||||||
closureColumn(header : "Certificates", preferredWidth : 20, type: Integer, read : {it.certificates})
|
closureColumn(header : "Certificates", preferredWidth : 20, type: Integer, read : {it.certificates})
|
||||||
closureColumn(header : "Trust", preferredWidth : 50, type : String, read : {
|
closureColumn(header : "Trust", preferredWidth : 50, type : String, read : {
|
||||||
model.core.trustService.getLevel(it.sender.destination).toString()
|
model.core.trustService.getLevel(it.sender.destination).toString()
|
||||||
@@ -202,8 +205,8 @@ class SearchTabView {
|
|||||||
panel (constraints : BorderLayout.SOUTH) {
|
panel (constraints : BorderLayout.SOUTH) {
|
||||||
label(text : "Group by")
|
label(text : "Group by")
|
||||||
buttonGroup(id : "groupBy")
|
buttonGroup(id : "groupBy")
|
||||||
radioButton(text : "Sender", selected : true, buttonGroup : groupBy, actionPerformed: showSenderGrouping)
|
radioButton(text : "Sender", selected : bind {!model.groupedByFile}, buttonGroup : groupBy, actionPerformed: showSenderGrouping)
|
||||||
radioButton(text : "File", selected : false, buttonGroup : groupBy, actionPerformed: showFileGrouping)
|
radioButton(text : "File", selected : bind {model.groupedByFile}, buttonGroup : groupBy, actionPerformed: showFileGrouping)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,6 +347,14 @@ class SearchTabView {
|
|||||||
sendersTable2.model.fireTableDataChanged()
|
sendersTable2.model.fireTableDataChanged()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
resultsTable2.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (e.getClickCount() > 1 && e.button == MouseEvent.BUTTON1)
|
||||||
|
mvcGroup.controller.download()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// TODO: add download right-click action
|
// TODO: add download right-click action
|
||||||
|
|
||||||
// senders table 2
|
// senders table 2
|
||||||
@@ -358,15 +369,19 @@ class SearchTabView {
|
|||||||
model.browseActionEnabled = false
|
model.browseActionEnabled = false
|
||||||
model.viewCertificatesActionEnabled = false
|
model.viewCertificatesActionEnabled = false
|
||||||
model.trustButtonsEnabled = false
|
model.trustButtonsEnabled = false
|
||||||
|
model.viewCommentActionEnabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
model.browseActionEnabled = model.senders2[row].browse
|
model.browseActionEnabled = model.senders2[row].browse
|
||||||
model.trustButtonsEnabled = true
|
model.trustButtonsEnabled = true
|
||||||
|
model.viewCommentActionEnabled = model.senders2[row].comment != null
|
||||||
model.viewCertificatesActionEnabled = model.senders2[row].certificates > 0
|
model.viewCertificatesActionEnabled = model.senders2[row].certificates > 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (settings.groupByFile)
|
||||||
showSenderGrouping.call()
|
showFileGrouping.call()
|
||||||
|
else
|
||||||
|
showSenderGrouping.call()
|
||||||
}
|
}
|
||||||
|
|
||||||
def closeTab = {
|
def closeTab = {
|
||||||
|
@@ -18,6 +18,7 @@ class UISettings {
|
|||||||
boolean exitOnClose
|
boolean exitOnClose
|
||||||
boolean clearUploads
|
boolean clearUploads
|
||||||
boolean storeSearchHistory
|
boolean storeSearchHistory
|
||||||
|
boolean groupByFile
|
||||||
Set<String> searchHistory
|
Set<String> searchHistory
|
||||||
Set<String> openTabs
|
Set<String> openTabs
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ class UISettings {
|
|||||||
exitOnClose = Boolean.parseBoolean(props.getProperty("exitOnClose","false"))
|
exitOnClose = Boolean.parseBoolean(props.getProperty("exitOnClose","false"))
|
||||||
clearUploads = Boolean.parseBoolean(props.getProperty("clearUploads","false"))
|
clearUploads = Boolean.parseBoolean(props.getProperty("clearUploads","false"))
|
||||||
storeSearchHistory = Boolean.parseBoolean(props.getProperty("storeSearchHistory","true"))
|
storeSearchHistory = Boolean.parseBoolean(props.getProperty("storeSearchHistory","true"))
|
||||||
|
groupByFile = Boolean.parseBoolean(props.getProperty("groupByFile","false"))
|
||||||
|
|
||||||
searchHistory = DataUtil.readEncodedSet(props, "searchHistory")
|
searchHistory = DataUtil.readEncodedSet(props, "searchHistory")
|
||||||
openTabs = DataUtil.readEncodedSet(props, "openTabs")
|
openTabs = DataUtil.readEncodedSet(props, "openTabs")
|
||||||
@@ -56,6 +58,7 @@ class UISettings {
|
|||||||
props.setProperty("exitOnClose", String.valueOf(exitOnClose))
|
props.setProperty("exitOnClose", String.valueOf(exitOnClose))
|
||||||
props.setProperty("clearUploads", String.valueOf(clearUploads))
|
props.setProperty("clearUploads", String.valueOf(clearUploads))
|
||||||
props.setProperty("storeSearchHistory", String.valueOf(storeSearchHistory))
|
props.setProperty("storeSearchHistory", String.valueOf(storeSearchHistory))
|
||||||
|
props.setProperty("groupByFile", String.valueOf(groupByFile))
|
||||||
if (font != null)
|
if (font != null)
|
||||||
props.setProperty("font", font)
|
props.setProperty("font", font)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user