Skip to content

Commit

Permalink
1226 hashtag options (stevencohn#1327)
Browse files Browse the repository at this point in the history
* touch

* stevencohn#1226
Added hashtag rescan options
  • Loading branch information
stevencohn committed Mar 17, 2024
1 parent bd4ce8a commit ef43bab
Show file tree
Hide file tree
Showing 29 changed files with 422 additions and 231 deletions.
319 changes: 174 additions & 145 deletions OneMore/Commands/Settings/HashtagSheet .Designer.cs

Large diffs are not rendered by default.

49 changes: 34 additions & 15 deletions OneMore/Commands/Settings/HashtagSheet .cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace River.OneMoreAddIn.Settings

internal partial class HashtagSheet : SheetBase
{
private readonly HashtagScheduler scheduler;


public HashtagSheet(SettingsProvider provider) : base(provider)
{
Expand All @@ -32,7 +34,8 @@ public HashtagSheet(SettingsProvider provider) : base(provider)
"styleLabel",
"styleBox",
"filterBox",
"rebuildBox",
"scheduleLink",
"warningBox",
"disabledBox"
});
}
Expand Down Expand Up @@ -83,22 +86,42 @@ public HashtagSheet(SettingsProvider provider) : base(provider)
delayBox.Visible = false;
msLabel.Visible = false;
}

scheduler = new HashtagScheduler();
}


private void ConfirmRebuild(object sender, System.EventArgs e)
private async void ScheduleRebuild(object sender, LinkLabelLinkClickedEventArgs e)
{
if (rebuildBox.Checked)
using var dialog =
scheduler.State == ScanningState.None ||
scheduler.State == ScanningState.Ready
? new ScheduleScanDialog()
: new ScheduleScanDialog(scheduler.StartTime);

if (scheduler.State != ScanningState.None &&
scheduler.State != ScanningState.Ready)
{
dialog.SetIntroText(string.Format(
Resx.HashtagSheet_prescheduled,
scheduler.StartTime.ToString("ddd, MMMM d, yyyy h:mm tt"))
);
}
else
{
var result = UI.MoreMessageBox.ShowQuestion(this,
"This will delete your hashtag database and create a new one.\n" +
"That requires OneNote to restart and then can take quite some time.\n\n" +
"Are you sure you want to rebuild the database?");
dialog.SetIntroText(Resx.HashtagSheet_scanNotebooks);
}

if (result != DialogResult.Yes)
{
rebuildBox.Checked = false;
}
//
// FULL?
//

var result = dialog.ShowDialog(this);
if (result == DialogResult.OK)
{
scheduler.StartTime = dialog.StartTime;
scheduler.State = ScanningState.PendingScan;
await scheduler.Activate();
}
}

Expand All @@ -118,10 +141,6 @@ public override bool CollectSettings()
? settings.Add("unfiltered", true) || updated
: settings.Remove("unfiltered") || updated;

updated = rebuildBox.Checked
? settings.Add("rebuild", true) || updated
: settings.Remove("rebuild") || updated;

updated = disabledBox.Checked
? settings.Add("disabled", true) || updated
: settings.Remove("disabled") || updated;
Expand Down
2 changes: 1 addition & 1 deletion OneMore/Commands/Tagging/HashtagScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private async Task<bool> ScanPage(
provider.WritePageInfo(
scanner.MoreID, pageID, titleID, notebookID, sectionID, path, title);

logger.WriteLine($"updating tags on page {path}/{title}");
logger.WriteLine($"updated tags found on page {path}/{title}");
return true;
}

Expand Down
14 changes: 13 additions & 1 deletion OneMore/Commands/Tagging/HashtagScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ public async Task Activate()
}

var exe = Path.Combine(dir, $"{TrayName}.exe");
if (!File.Exists(exe))
{
logger.WriteLine($"could not find {exe}");
return;
}

logger.WriteLine($"starting {exe} @{schedule.StartTime.ToZuluString()}");

var proc = Process.Start(new ProcessStartInfo
Expand Down Expand Up @@ -165,7 +171,13 @@ public void ClearSchedule()
public void Refresh()
{
var update = ReadSchedule(false);
if (update is not null)
if (update is null)
{
schedule.State = HashtagProvider.DatabaseExists()
? ScanningState.Ready
: ScanningState.None;
}
else
{
schedule.State = update.State;
schedule.StartTime = update.StartTime;
Expand Down
4 changes: 2 additions & 2 deletions OneMore/Commands/Tagging/HashtagService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private async Task StartupLoop()

private async Task<bool> WaitForReady()
{
if ((scheduler.State != ScanningState.None ||
scheduler.State != ScanningState.Ready) &&
if (scheduler.State != ScanningState.None &&
scheduler.State != ScanningState.Ready &&
!scheduler.Active)
{
await scheduler.Activate();
Expand Down
4 changes: 2 additions & 2 deletions OneMore/Commands/Tagging/ScheduleScanDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 31 additions & 4 deletions OneMore/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions OneMore/Properties/Resources.ar-SA.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,15 @@
<value>تخصيص الخيارات المتقدمة لخدمة Hashtag Scanner</value>
<comment>label</comment>
</data>
<data name="HashtagSheet_rebuildBox.Text" xml:space="preserve">
<value>إعادة بناء قاعدة بيانات الهاشتاج عند إعادة التشغيل</value>
<comment>checkbox</comment>
<data name="HashtagSheet_prescheduled" xml:space="preserve">
<value>تمت جدولة عملية الفحص لـ {0}. استخدم الخيارات أدناه لتغيير هذا أو اضغط على إلغاء للاحتفاظ بالجدول الحالي.</value>
</data>
<data name="HashtagSheet_scanNotebooks" xml:space="preserve">
<value>قم بجدولة فحص متزايد لدفاتر الملاحظات المضافة حديثًا</value>
</data>
<data name="HashtagSheet_scheduleLink.Text" xml:space="preserve">
<value>جدولة إعادة بناء كتالوج الهاشتاج الخاص بك</value>
<comment>link label</comment>
</data>
<data name="HashtagSheet_styleBox.Text" xml:space="preserve">
<value>لا أحد
Expand All @@ -1350,6 +1356,10 @@
<value>علامات التصنيف</value>
<comment>sheet title</comment>
</data>
<data name="HashtagSheet_warningLabel.Text" xml:space="preserve">
<value>يجب استخدام هذا بعد إضافة أو إزالة دفتر واحد أو أكثر من دفاتر الملاحظات. يوصى بجدولة إعادة البناء بعد ساعات ، مثل منتصف الليل.</value>
<comment>multiline label</comment>
</data>
<data name="HighlightFormulaCommand_NoFormulas" xml:space="preserve">
<value>لا توجد صيغ في هذه الصفحة</value>
<comment>highlight command message</comment>
Expand Down Expand Up @@ -4049,7 +4059,7 @@ ISO-code then comma then language name</comment>
<comment>dialog title</comment>
</data>
<data name="ScheduleScanDialog_warningLabel.Text" xml:space="preserve">
<value>قد تظهر Onenote بطيئة أثناء المسح. إذا تم إغلاق OneNote ، فلا يمكن فتحه حتى يكتمل المسح.</value>
<value>قد يبدو OneNote بطيئًا أثناء المسح الضوئي. إذا تم إغلاق OneNote أثناء الفحص، فلا يمكن فتحه حتى يكتمل الفحص.</value>
<comment>multiline label</comment>
</data>
<data name="ScopeSelector_notebookButton.Text" xml:space="preserve">
Expand Down
18 changes: 14 additions & 4 deletions OneMore/Properties/Resources.de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1330,9 +1330,15 @@ Diese Abteilung</value>
<value>Passen Sie erweiterte Optionen für den Hashtag-Scanner-Dienst an</value>
<comment>label</comment>
</data>
<data name="HashtagSheet_rebuildBox.Text" xml:space="preserve">
<value>Erstellen Sie die Hashtag-Datenbank beim Neustart neu</value>
<comment>checkbox</comment>
<data name="HashtagSheet_prescheduled" xml:space="preserve">
<value>Für {0} ist ein Scan geplant. Verwenden Sie die folgenden Optionen, um dies zu ändern, oder klicken Sie auf „Abbrechen“, um den aktuellen Zeitplan beizubehalten.</value>
</data>
<data name="HashtagSheet_scanNotebooks" xml:space="preserve">
<value>Planen Sie einen inkrementellen Scan Ihrer neu hinzugefügten Notizbücher</value>
</data>
<data name="HashtagSheet_scheduleLink.Text" xml:space="preserve">
<value>Planen Sie einen Wiederaufbau Ihres Hashtag -Katalogs</value>
<comment>link label</comment>
</data>
<data name="HashtagSheet_styleBox.Text" xml:space="preserve">
<value>Keiner
Expand All @@ -1348,6 +1354,10 @@ Gelber Hintergrund</value>
<value>Hashtags</value>
<comment>sheet title</comment>
</data>
<data name="HashtagSheet_warningLabel.Text" xml:space="preserve">
<value>Dies sollte verwendet werden, nachdem ein oder mehrere Notizbücher hinzugefügt oder entfernt werden. Es wird empfohlen, den Wiederaufbau von Nachbästen wie Mitternacht zu planen.</value>
<comment>multiline label</comment>
</data>
<data name="HighlightFormulaCommand_NoFormulas" xml:space="preserve">
<value>Auf dieser Seite wurden keine Formeln gefunden</value>
<comment>highlight command message</comment>
Expand Down Expand Up @@ -4042,7 +4052,7 @@ Nach der letzten Gruppe</value>
<comment>dialog title</comment>
</data>
<data name="ScheduleScanDialog_warningLabel.Text" xml:space="preserve">
<value>OneNote kann beim Scannen träge erscheinen. Wenn OneNote geschlossen ist, kann sie erst geöffnet werden, wenn der Scan abgeschlossen ist.</value>
<value>OneNote erscheint beim Scannen möglicherweise träge. Wenn OneNote während des Scans geschlossen ist, kann es erst geöffnet werden, wenn der Scan abgeschlossen ist.</value>
<comment>multiline label</comment>
</data>
<data name="ScopeSelector_notebookButton.Text" xml:space="preserve">
Expand Down
18 changes: 14 additions & 4 deletions OneMore/Properties/Resources.es-ES.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,15 @@ Esta sección</value>
<value>Personalice las opciones avanzadas para el servicio Hashtag Scanner</value>
<comment>label</comment>
</data>
<data name="HashtagSheet_rebuildBox.Text" xml:space="preserve">
<value>Reconstruya la base de datos de hashtag al reiniciar</value>
<comment>checkbox</comment>
<data name="HashtagSheet_prescheduled" xml:space="preserve">
<value>Hay un análisis programado para {0}. Utilice las opciones siguientes para cambiar esto o presione Cancelar para mantener el horario actual.</value>
</data>
<data name="HashtagSheet_scanNotebooks" xml:space="preserve">
<value>Programe un análisis incremental de sus cuadernos recién agregados</value>
</data>
<data name="HashtagSheet_scheduleLink.Text" xml:space="preserve">
<value>Programe una reconstrucción de su catálogo de hashtag</value>
<comment>link label</comment>
</data>
<data name="HashtagSheet_styleBox.Text" xml:space="preserve">
<value>Ninguno
Expand All @@ -1350,6 +1356,10 @@ Fondo amarillo</value>
<value>Etiquetas</value>
<comment>sheet title</comment>
</data>
<data name="HashtagSheet_warningLabel.Text" xml:space="preserve">
<value>Esto debe usarse después de agregar o eliminar uno o más cuadernos. Se recomienda programar las reconstrucciones fuera del horario de atención, como la medianoche.</value>
<comment>multiline label</comment>
</data>
<data name="HighlightFormulaCommand_NoFormulas" xml:space="preserve">
<value>No se encontraron fórmulas en esta página</value>
<comment>highlight command message</comment>
Expand Down Expand Up @@ -4049,7 +4059,7 @@ Después del último grupo</value>
<comment>dialog title</comment>
</data>
<data name="ScheduleScanDialog_warningLabel.Text" xml:space="preserve">
<value>OneNote puede parecer lento mientras escanea. Si OneNote está cerrado, no se puede abrir hasta que se complete el escaneo.</value>
<value>OneNote puede parecer lento mientras escanea. Si OneNote se cierra durante el análisis, no se podrá abrir hasta que se complete el análisis.</value>
<comment>multiline label</comment>
</data>
<data name="ScopeSelector_notebookButton.Text" xml:space="preserve">
Expand Down
18 changes: 14 additions & 4 deletions OneMore/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,15 @@ Cette section</value>
<value>Personnaliser les options avancées du service Hashtag Scanner</value>
<comment>label</comment>
</data>
<data name="HashtagSheet_rebuildBox.Text" xml:space="preserve">
<value>Reconstruire la base de données de hashtag au redémarrage</value>
<comment>checkbox</comment>
<data name="HashtagSheet_prescheduled" xml:space="preserve">
<value>Une analyse est prévue pour {0}. Utilisez les options ci-dessous pour modifier cela ou appuyez sur Annuler pour conserver le programme actuel.</value>
</data>
<data name="HashtagSheet_scanNotebooks" xml:space="preserve">
<value>Planifiez une analyse incrémentielle de vos blocs-notes nouvellement ajoutés</value>
</data>
<data name="HashtagSheet_scheduleLink.Text" xml:space="preserve">
<value>Planifiez une reconstruction de votre catalogue de hashtag</value>
<comment>link label</comment>
</data>
<data name="HashtagSheet_styleBox.Text" xml:space="preserve">
<value>Aucun
Expand All @@ -1350,6 +1356,10 @@ Fond jaune</value>
<value>Hashtags</value>
<comment>sheet title</comment>
</data>
<data name="HashtagSheet_warningLabel.Text" xml:space="preserve">
<value>Ceci doit être utilisé après avoir ajouté ou supprimé un ou plusieurs cahiers. Il est recommandé de planifier des reconstructions après les heures d'ouverture, comme minuit.</value>
<comment>multiline label</comment>
</data>
<data name="HighlightFormulaCommand_NoFormulas" xml:space="preserve">
<value>Aucune formule trouvée sur cette page</value>
<comment>highlight command message</comment>
Expand Down Expand Up @@ -4047,7 +4057,7 @@ Après le dernier groupe</value>
<comment>dialog title</comment>
</data>
<data name="ScheduleScanDialog_warningLabel.Text" xml:space="preserve">
<value>OneNote peut sembler lent pendant la numérisation. Si OneNote est fermé, il ne peut pas être ouvert avant la fin du scan.</value>
<value>OneNote peut sembler lent lors de la numérisation. Si OneNote est fermé pendant l’analyse, il ne peut pas être ouvert tant que l’analyse n’est pas terminée.</value>
<comment>multiline label</comment>
</data>
<data name="ScopeSelector_notebookButton.Text" xml:space="preserve">
Expand Down
18 changes: 14 additions & 4 deletions OneMore/Properties/Resources.he-IL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1341,9 +1341,15 @@ Total Row Font
<value>התאם אישית אפשרויות מתקדמות עבור שירות הסורק של Hashtag</value>
<comment>label</comment>
</data>
<data name="HashtagSheet_rebuildBox.Text" xml:space="preserve">
<value>בנה מחדש את מסד הנתונים של ההאשטאג עם הפעלה מחדש</value>
<comment>checkbox</comment>
<data name="HashtagSheet_prescheduled" xml:space="preserve">
<value>סריקה מתוכננת ל-{0}. השתמש באפשרויות למטה כדי לשנות זאת או לחץ על ביטול כדי לשמור על לוח הזמנים הנוכחי.</value>
</data>
<data name="HashtagSheet_scanNotebooks" xml:space="preserve">
<value>תזמן סריקה מצטברת של המחברות החדשות שנוספו</value>
</data>
<data name="HashtagSheet_scheduleLink.Text" xml:space="preserve">
<value>קבעו את הבנייה מחדש של קטלוג ה- hashtag שלכם</value>
<comment>link label</comment>
</data>
<data name="HashtagSheet_styleBox.Text" xml:space="preserve">
<value>אף אחד
Expand All @@ -1359,6 +1365,10 @@ Total Row Font
<value>Hashtags</value>
<comment>sheet title</comment>
</data>
<data name="HashtagSheet_warningLabel.Text" xml:space="preserve">
<value>יש להשתמש בזה לאחר הוספת או הסרת מחברת אחת או יותר. מומלץ לתאם מחדש את הבנייה מחדש לאחר שעות העבודה, כמו חצות.</value>
<comment>multiline label</comment>
</data>
<data name="HighlightFormulaCommand_NoFormulas" xml:space="preserve">
<value>לא נמצאו נוסחאות בדף זה</value>
<comment>highlight command message</comment>
Expand Down Expand Up @@ -4060,7 +4070,7 @@ ISO-code then comma then language name</comment>
<comment>dialog title</comment>
</data>
<data name="ScheduleScanDialog_warningLabel.Text" xml:space="preserve">
<value>OneNote עשוי להיראות איטי בזמן הסריקה. אם OneNote סגור, לא ניתן לפתוח אותו עד לסיום הסריקה.</value>
<value>OneNote עשוי להיראות איטי במהלך הסריקה. אם OneNote סגור במהלך הסריקה, לא ניתן לפתוח אותו עד לסיום הסריקה.</value>
<comment>multiline label</comment>
</data>
<data name="ScopeSelector_notebookButton.Text" xml:space="preserve">
Expand Down
Loading

0 comments on commit ef43bab

Please sign in to comment.