Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2014-11-23 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:51 +0300
commitf08f4dcc3c02464c17753b3feafcfe5243b9e236 (patch)
treeb0e1b15bc5368d92dff422e8ec0818564a2b00b8 /CPP/7zip/UI/FileManager/AppState.h
parent83f8ddcc5b2161e1e3c49666265257fca8aeb12c (diff)
9.349.34
Diffstat (limited to 'CPP/7zip/UI/FileManager/AppState.h')
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/FileManager/AppState.h41
1 files changed, 11 insertions, 30 deletions
diff --git a/CPP/7zip/UI/FileManager/AppState.h b/CPP/7zip/UI/FileManager/AppState.h
index 374cf04f..cc887150 100755..100644
--- a/CPP/7zip/UI/FileManager/AppState.h
+++ b/CPP/7zip/UI/FileManager/AppState.h
@@ -3,34 +3,23 @@
#ifndef __APP_STATE_H
#define __APP_STATE_H
-#include "Windows/Synchronization.h"
+#include "../../../Windows/Synchronization.h"
#include "ViewSettings.h"
-void inline AddUniqueStringToHead(UStringVector &list,
- const UString &string)
-{
- for(int i = 0; i < list.Size();)
- if (string.CompareNoCase(list[i]) == 0)
- list.Delete(i);
- else
- i++;
- list.Insert(0, string);
-}
-
class CFastFolders
{
NWindows::NSynchronization::CCriticalSection _criticalSection;
public:
UStringVector Strings;
- void SetString(int index, const UString &string)
+ void SetString(unsigned index, const UString &s)
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- while(Strings.Size() <= index)
- Strings.Add(UString());
- Strings[index] = string;
+ while (Strings.Size() <= index)
+ Strings.AddNew();
+ Strings[index] = s;
}
- UString GetString(int index)
+ UString GetString(unsigned index)
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
if (index >= Strings.Size())
@@ -53,12 +42,8 @@ class CFolderHistory
{
NWindows::NSynchronization::CCriticalSection _criticalSection;
UStringVector Strings;
- void Normalize()
- {
- const int kMaxSize = 100;
- if (Strings.Size() > kMaxSize)
- Strings.Delete(kMaxSize, Strings.Size() - kMaxSize);
- }
+
+ void Normalize();
public:
@@ -68,13 +53,8 @@ public:
foldersHistory = Strings;
}
- void AddString(const UString &string)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- AddUniqueStringToHead(Strings, string);
- Normalize();
- }
-
+ void AddString(const UString &s);
+
void RemoveAll()
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
@@ -99,6 +79,7 @@ struct CAppState
{
CFastFolders FastFolders;
CFolderHistory FolderHistory;
+
void Save()
{
FastFolders.Save();