mirror of https://github.com/zlatinb/muwire
show reindex preview
parent
a8d9354bf8
commit
c45ad1b88c
|
@ -21,4 +21,14 @@ class LibrarySyncController {
|
||||||
model.cancelScan()
|
model.cancelScan()
|
||||||
view.scanCancelled()
|
view.scanCancelled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ControllerAction
|
||||||
|
void cancel() {
|
||||||
|
view.previewCancelled()
|
||||||
|
}
|
||||||
|
|
||||||
|
@ControllerAction
|
||||||
|
void reindex() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -772,6 +772,14 @@ EXPORT_CONNECTIONS_SUCCESS={0} connections exporte to {1}
|
||||||
LIBRARY_SCAN_TITLE=Scanning Library
|
LIBRARY_SCAN_TITLE=Scanning Library
|
||||||
LIBRARY_SCAN_BODY=Scanning library for files that may be out of sync
|
LIBRARY_SCAN_BODY=Scanning library for files that may be out of sync
|
||||||
LIBRARY_SCAN_NO_STALE=There are no files out of sync
|
LIBRARY_SCAN_NO_STALE=There are no files out of sync
|
||||||
|
LIBRARY_SCAN_PREVIEW_TITLE=Out of sync files found
|
||||||
|
LIBRARY_SCAN_PREVIEW_FILES_BODY=The following shared files may be out of sync
|
||||||
|
LIBRARY_SCAN_PREVIEW_COLUMN_FILE=File
|
||||||
|
LIBRARY_SCAN_PREVIEW_COLUMN_SHARED=Shared
|
||||||
|
LIBRARY_SCAN_PREVIEW_COLUMN_MODIFIED=Modified
|
||||||
|
LIBRARY_SCAN_PREVIEW_COLLECTIONS_BODY=The following collections may be affected
|
||||||
|
LIBRARY_SCAN_PREVIEW_REINDEX=Re-Index
|
||||||
|
|
||||||
## Tooltips
|
## Tooltips
|
||||||
|
|
||||||
TOOLTIP_FILE_FEED_DISABLED=Your file feed is disabled
|
TOOLTIP_FILE_FEED_DISABLED=Your file feed is disabled
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muwire.gui
|
package com.muwire.gui
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets
|
||||||
import griffon.core.GriffonApplication
|
import griffon.core.GriffonApplication
|
||||||
import griffon.core.artifact.GriffonView
|
import griffon.core.artifact.GriffonView
|
||||||
import griffon.inject.MVCMember
|
import griffon.inject.MVCMember
|
||||||
|
@ -12,7 +13,10 @@ import javax.swing.JFrame
|
||||||
import javax.swing.JOptionPane
|
import javax.swing.JOptionPane
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
import javax.swing.JProgressBar
|
import javax.swing.JProgressBar
|
||||||
|
import javax.swing.JTable
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
|
import java.awt.Dimension
|
||||||
|
|
||||||
import static com.muwire.gui.Translator.trans
|
import static com.muwire.gui.Translator.trans
|
||||||
|
|
||||||
@ArtifactProviderFor(GriffonView)
|
@ArtifactProviderFor(GriffonView)
|
||||||
|
@ -28,16 +32,20 @@ class LibrarySyncView {
|
||||||
LibrarySyncController controller
|
LibrarySyncController controller
|
||||||
|
|
||||||
private JFrame mainFrame
|
private JFrame mainFrame
|
||||||
|
private int rowHeight
|
||||||
|
|
||||||
JDialog scanDialog
|
private JDialog scanDialog
|
||||||
JDialog previewDialog
|
private JDialog previewDialog
|
||||||
JDialog reindexDialog
|
private JDialog reindexDialog
|
||||||
|
|
||||||
|
private JDialog nextDialog
|
||||||
|
|
||||||
private JProgressBar scanProgressBar
|
private JProgressBar scanProgressBar
|
||||||
JProgressBar reindexProgressBar
|
JProgressBar reindexProgressBar
|
||||||
|
|
||||||
void initUI() {
|
void initUI() {
|
||||||
mainFrame = (JFrame) application.windowManager.findWindow("main-frame")
|
mainFrame = (JFrame) application.windowManager.findWindow("main-frame")
|
||||||
|
rowHeight = (int)application.context.get("row-height")
|
||||||
|
|
||||||
scanDialog = new JDialog(mainFrame, trans("LIBRARY_SCAN_TITLE"), true)
|
scanDialog = new JDialog(mainFrame, trans("LIBRARY_SCAN_TITLE"), true)
|
||||||
|
|
||||||
|
@ -62,7 +70,9 @@ class LibrarySyncView {
|
||||||
|
|
||||||
void mvcGroupInit(Map<String, String> args) {
|
void mvcGroupInit(Map<String, String> args) {
|
||||||
model.startScan()
|
model.startScan()
|
||||||
scanDialog.setVisible(true)
|
nextDialog = scanDialog
|
||||||
|
while(nextDialog != null)
|
||||||
|
nextDialog.setVisible(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateScanProgressBar(int percent) {
|
void updateScanProgressBar(int percent) {
|
||||||
|
@ -70,16 +80,81 @@ class LibrarySyncView {
|
||||||
}
|
}
|
||||||
|
|
||||||
void scanCancelled() {
|
void scanCancelled() {
|
||||||
|
nextDialog = null
|
||||||
scanDialog.setVisible(false)
|
scanDialog.setVisible(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
void scanFinished() {
|
void scanFinished() {
|
||||||
|
|
||||||
if (model.staleFiles.isEmpty()) {
|
|
||||||
JOptionPane.showMessageDialog(scanDialog, trans("LIBRARY_SCAN_NO_STALE"),
|
|
||||||
trans("LIBRARY_SCAN_NO_STALE"), JOptionPane.INFORMATION_MESSAGE)
|
|
||||||
scanDialog.setVisible(false)
|
scanDialog.setVisible(false)
|
||||||
|
|
||||||
|
if (model.staleFiles.isEmpty()) {
|
||||||
|
JOptionPane.showMessageDialog(mainFrame, trans("LIBRARY_SCAN_NO_STALE"),
|
||||||
|
trans("LIBRARY_SCAN_NO_STALE"), JOptionPane.INFORMATION_MESSAGE)
|
||||||
|
nextDialog = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previewDialog = new JDialog(mainFrame, trans("LIBRARY_SCAN_PREVIEW_TITLE"), true)
|
||||||
|
nextDialog = previewDialog
|
||||||
|
|
||||||
|
JTable staleFilesTable
|
||||||
|
JPanel previewPanel = builder.panel {
|
||||||
|
borderLayout()
|
||||||
|
panel(constraints: BorderLayout.CENTER) {
|
||||||
|
int rows = model.staleCollections.isEmpty() ? 1 : 2
|
||||||
|
gridLayout(rows: rows, cols: 1)
|
||||||
|
panel {
|
||||||
|
borderLayout()
|
||||||
|
panel (constraints: BorderLayout.NORTH) {
|
||||||
|
label(text: trans("LIBRARY_SCAN_PREVIEW_FILES_BODY"))
|
||||||
|
}
|
||||||
|
scrollPane(constraints: BorderLayout.CENTER) {
|
||||||
|
staleFilesTable = table(autoCreateRowSorter: true, rowHeight: rowHeight) {
|
||||||
|
tableModel(list: model.staleFiles) {
|
||||||
|
closureColumn(header : trans("LIBRARY_SCAN_PREVIEW_COLUMN_FILE"),
|
||||||
|
type: String, read: {it.getCachedPath()})
|
||||||
|
closureColumn(header : trans("LIBRARY_SCAN_PREVIEW_COLUMN_SHARED"),
|
||||||
|
type: Long, read: {it.getSharedTime()})
|
||||||
|
closureColumn(header: trans("LIBRARY_SCAN_PREVIEW_COLUMN_MODIFIED"),
|
||||||
|
type: Long, read: {it.getFile().lastModified()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rows > 1) {
|
||||||
|
panel {
|
||||||
|
borderLayout()
|
||||||
|
panel(constraints: BorderLayout.NORTH) {
|
||||||
|
label(text: trans("LIBRARY_SCAN_PREVIEW_COLLECTIONS_BODY"))
|
||||||
|
}
|
||||||
|
scrollPane(constraints: BorderLayout.CENTER) {
|
||||||
|
list(items: model.staleCollections.collect {it.getName()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panel(constraints: BorderLayout.SOUTH) {
|
||||||
|
button(text: trans("LIBRARY_SCAN_PREVIEW_REINDEX"), reindexAction)
|
||||||
|
button(text: trans("CANCEL"), cancelAction)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TableUtil.dateColumn(staleFilesTable, 1)
|
||||||
|
TableUtil.dateColumn(staleFilesTable, 2)
|
||||||
|
staleFilesTable.setDefaultRenderer(Long.class, new DateRenderer())
|
||||||
|
|
||||||
|
Dimension dimension = mainFrame.getSize()
|
||||||
|
previewDialog.with {
|
||||||
|
getContentPane().add(previewPanel)
|
||||||
|
setSize((int)(dimension.getWidth() - 100), (int)(dimension.getHeight() - 100))
|
||||||
|
setLocationRelativeTo(mainFrame)
|
||||||
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void previewCancelled() {
|
||||||
|
nextDialog = null
|
||||||
|
previewDialog.setVisible(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue