linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02912
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2383: Process file lists only when they first come into view
------------------------------------------------------------
revno: 2383
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2011-01-09 16:38:35 +0100
message:
Process file lists only when they first come into view
modified:
changelog.txt
win32/DirectoryListingFrame.cpp
win32/DirectoryListingFrame.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2011-01-09 14:54:10 +0000
+++ changelog.txt 2011-01-09 15:38:35 +0000
@@ -66,6 +66,7 @@
* More consistent behavior in file lists for back / forward / up, and some buttons (poy)
* Rework file and folder icons, add one for incomplete dirs (poy)
* Save and restore the selected tab when re-opening (poy)
+* Process file lists only when they first come into view (poy)
-- 0.770 2010-07-05 --
* [L#550300] Catch more potential file corruptions (thanks bigmuscle)
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2011-01-09 14:54:10 +0000
+++ win32/DirectoryListingFrame.cpp 2011-01-09 15:38:35 +0000
@@ -82,28 +82,31 @@
}
}
-void DirectoryListingFrame::openWindow(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, bool activate) {
+void DirectoryListingFrame::openWindow(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, Activation activate) {
UserIter prev = lists.find(aUser);
if(prev == lists.end()) {
- openWindow_(parent, aFile, aDir, aUser, aSpeed, activate && !BOOLSETTING(POPUNDER_FILELIST));
+ openWindow_(parent, aFile, aDir, aUser, aSpeed, activate);
} else {
- activate &= prev->second->isActive() || !BOOLSETTING(POPUNDER_FILELIST);
+ activate = prev->second->isActive() ? FORCE_ACTIVE : FOLLOW_SETTING;
prev->second->close();
parent->callAsync(std::bind(&DirectoryListingFrame::openWindow_, parent, aFile, aDir, aUser, aSpeed, activate));
}
}
-void DirectoryListingFrame::openWindow_(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, bool activate) {
+void DirectoryListingFrame::openWindow_(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, Activation activate) {
DirectoryListingFrame* frame = new DirectoryListingFrame(parent, aUser, aSpeed);
- frame->loadFile(aFile, aDir);
+ frame->path = Text::fromT(aFile);
- if(activate)
+ if(activate == FORCE_ACTIVE || (activate == FOLLOW_SETTING && !BOOLSETTING(POPUNDER_FILELIST))) {
+ frame->loadFile(aDir);
frame->activate();
- else
+ } else {
frame->setDirty(SettingsManager::BOLD_FL);
+ frame->onActivate([frame, aDir](bool b) { if(b) frame->loadFile(aDir); });
+ }
}
-void DirectoryListingFrame::openOwnList(TabViewPtr parent, bool activate) {
+void DirectoryListingFrame::openOwnList(TabViewPtr parent, Activation activate) {
openWindow(parent, Text::toT(ShareManager::getInstance()->getOwnListFile()), Util::emptyStringT,
HintedUser(ClientManager::getInstance()->getMe(), Util::emptyString), 0, activate);
}
@@ -128,7 +131,7 @@
StringMap::const_iterator hub = params.find("Hub");
StringMap::const_iterator speed = params.find("Speed");
if(path != params.end() && speed != params.end()) {
- bool activate = parseActivateParam(params);
+ Activation activate = parseActivateParam(params) ? FORCE_ACTIVE : FORCE_INACTIVE;
if(path->second.empty()) {
openOwnList(parent, activate);
} else if(File::getSize(path->second) != -1) {
@@ -183,6 +186,7 @@
usingDirMenu(false),
historyIndex(0),
treeRoot(NULL),
+ loaded(false),
updating(false),
searching(false)
{
@@ -331,10 +335,13 @@
lists.erase(dl->getUser());
}
-void DirectoryListingFrame::loadFile(const tstring& name, const tstring& dir) {
+void DirectoryListingFrame::loadFile(const tstring& dir) {
+ if(loaded)
+ return;
+ loaded = true;
+
try {
- dl->loadFile(Text::fromT(name));
- path = Text::fromT(name);
+ dl->loadFile(path);
addRecent();
ADLSearchManager::getInstance()->matchListing(*dl);
refreshTree(dir);
=== modified file 'win32/DirectoryListingFrame.h'
--- win32/DirectoryListingFrame.h 2011-01-09 14:54:10 +0000
+++ win32/DirectoryListingFrame.h 2011-01-09 15:38:35 +0000
@@ -64,12 +64,17 @@
static const string id;
const string& getId() const;
- static void openWindow(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, bool activate = true);
+ enum Activation {
+ FOLLOW_SETTING,
+ FORCE_ACTIVE,
+ FORCE_INACTIVE
+ };
+ static void openWindow(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, Activation activate = FOLLOW_SETTING);
private:
- static void openWindow_(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, bool activate);
+ static void openWindow_(TabViewPtr parent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed, Activation activate);
public:
static void openWindow(TabViewPtr parent, const HintedUser& aUser, const string& txt, int64_t aSpeed);
- static void openOwnList(TabViewPtr parent, bool activate = true);
+ static void openOwnList(TabViewPtr parent, Activation activate = FOLLOW_SETTING);
static void closeAll();
const StringMap getWindowParams() const;
@@ -185,11 +190,12 @@
string size;
+ bool loaded;
bool updating;
bool searching;
static TStringList lastSearches;
-
+
StringMap ucLineParams;
typedef unordered_map<UserPtr, DirectoryListingFrame*, User::Hash> UserMap;
@@ -250,7 +256,7 @@
void clearList();
void updateTitle();
- void loadFile(const tstring& name, const tstring& dir);
+ void loadFile(const tstring& dir);
void loadXML(const string& txt);
void refreshTree(const tstring& root);