mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Developing UppHub
git-svn-id: svn://ultimatepp.org/upp/trunk@15513 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3587c50ab2
commit
799d6dbc0a
9 changed files with 720 additions and 674 deletions
|
|
@ -171,9 +171,21 @@ String DefaultHubFilePath()
|
|||
return ConfigFile("UppHub.path");
|
||||
}
|
||||
|
||||
bool hubdir_resolved;
|
||||
|
||||
void SetHubDir(const String& path)
|
||||
{
|
||||
SaveFile(DefaultHubFilePath(), path);
|
||||
hubdir_resolved = false;
|
||||
}
|
||||
|
||||
String GetHubDir()
|
||||
{
|
||||
String d = GetVar("UPPHUB");
|
||||
static String d;
|
||||
if(hubdir_resolved)
|
||||
return d;
|
||||
hubdir_resolved = true;
|
||||
d = GetVar("UPPHUB");
|
||||
if(d.GetCount() && DirectoryExists(d)) return d;
|
||||
d = LoadFile(DefaultHubFilePath());
|
||||
if(d.GetCount() && DirectoryExists(d)) return d;
|
||||
|
|
@ -182,6 +194,11 @@ String GetHubDir()
|
|||
return d;
|
||||
}
|
||||
|
||||
bool InUppHub(const String& p)
|
||||
{
|
||||
return p.StartsWith(GetHubDir());
|
||||
}
|
||||
|
||||
bool LoadVars(const char *name) {
|
||||
varsname = (name && *name ? name : "default");
|
||||
return MainNest().Load(VarFilePath());
|
||||
|
|
|
|||
|
|
@ -206,7 +206,9 @@ Nest& MainNest();
|
|||
|
||||
String DefaultHubFilePath();
|
||||
|
||||
void SetHubDir(const String& path);
|
||||
String GetHubDir();
|
||||
bool InUppHub(const String& p);
|
||||
|
||||
String VarFilePath();
|
||||
String VarFilePath(String name);
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ void SelectPackageDlg::SyncList(const String& find)
|
|||
const PkInfo& pkg = packages[i];
|
||||
Image icon = pkg.icon;
|
||||
if(IsNull(icon))
|
||||
icon = pkg.main ? IdeImg::MainPackage() : IdeImg::Package();
|
||||
icon = pkg.main ? IdeImg::MainPackage() : pkg.upphub ? IdeImg::HubPackage() : IdeImg::Package();
|
||||
clist.Add(pkg.package, DPI(icon, 16));
|
||||
alist.Add(pkg.package, pkg.nest, pkg.description, icon);
|
||||
alist.SetDisplay(alist.GetCount() - 1, 0, pkg.main ? bpd : pd);
|
||||
|
|
@ -566,12 +566,13 @@ void SelectPackageDlg::ScanFolder(const String& path, ArrayMap<String, PkData>&
|
|||
{
|
||||
for(FindFile ff(AppendFileName(path, "*.*")); ff; ff.Next())
|
||||
if(ff.IsFolder() && !ff.IsHidden()) {
|
||||
dir_exists.Add(ff.GetPath());
|
||||
String p = ff.GetPath();
|
||||
dir_exists.Add(p);
|
||||
bool nw = nd.Find(p) < 0; // Do we have any info loaded about this package?
|
||||
PkData& d = nd.GetAdd(ff.GetPath());
|
||||
PkData& d = nd.GetAdd(p);
|
||||
d.package = prefix + ff.GetName();
|
||||
d.nest = nest;
|
||||
d.upphub = InUppHub(p);
|
||||
if(nw) { // No cached info available about the folder
|
||||
d.ispackage = IsLetter(*d.package) && d.package.Find('.') < 0; // First heuristic guess
|
||||
d.main = d.ispackage && prefix.GetCount() == 0; // Expect it is main
|
||||
|
|
|
|||
|
|
@ -574,8 +574,7 @@ void Ide::SetupFormat() {
|
|||
AddPath(&ide.uscpath);
|
||||
};
|
||||
|
||||
String hub_path = DefaultHubFilePath();
|
||||
ide.upphub <<= LoadFile(hub_path);
|
||||
ide.upphub <<= LoadFile(DefaultHubFilePath());
|
||||
DirSelect(ide.upphub, ide.upphub_sel);
|
||||
|
||||
fnt.defaults << [&] {
|
||||
|
|
@ -592,7 +591,7 @@ void Ide::SetupFormat() {
|
|||
for(;;) {
|
||||
int c = dlg.Run();
|
||||
|
||||
Upp::SaveFile(hub_path, ~ide.uscpath);
|
||||
SetHubDir(~ide.upphub);
|
||||
|
||||
if(IsNull(ide.uscpath))
|
||||
FileDelete(usc_path);
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ struct SelectPackageDlg : public WithSelectPackageLayout<TopWindow> {
|
|||
String nest;
|
||||
Image icon;
|
||||
bool main;
|
||||
bool upphub;
|
||||
|
||||
bool operator<(const PkInfo& b) const { return PackageLess(package, b.package); }
|
||||
|
||||
|
|
|
|||
1332
uppsrc/ide/ide.iml
1332
uppsrc/ide/ide.iml
File diff suppressed because it is too large
Load diff
|
|
@ -464,8 +464,8 @@ void RepoSyncDirs(const Vector<String>& working)
|
|||
RepoSync repo;
|
||||
String repocfg = ConfigFile("repo.cfg");
|
||||
repo.SetMsgs(LoadFile(repocfg));
|
||||
for(int i = 0; i < working.GetCount(); i++)
|
||||
repo.Dir(working[i]);
|
||||
for(String d : working)
|
||||
repo.Dir(InUppHub(d), d);
|
||||
repo.DoSync();
|
||||
SaveFile(repocfg, repo.GetMsgs());
|
||||
if(f)
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void RepoSync::SyncList()
|
|||
o.commit << [=] { SyncCommits(); };
|
||||
o.update = true;
|
||||
actions = ListSvn(path);
|
||||
if(!actions) {
|
||||
if(!actions || w.read_only) {
|
||||
o.commit = false;
|
||||
o.commit.Disable();
|
||||
}
|
||||
|
|
@ -233,10 +233,14 @@ void RepoSync::SyncList()
|
|||
o.push = true;
|
||||
o.pull = true;
|
||||
actions = ListGit(path);
|
||||
if(!actions) {
|
||||
if(!actions || w.read_only) {
|
||||
o.commit = false;
|
||||
o.commit.Disable();
|
||||
}
|
||||
if(w.read_only) {
|
||||
o.push = false;
|
||||
o.push.Disable();
|
||||
}
|
||||
}
|
||||
if(actions) {
|
||||
list.Add(MESSAGE, Null, AttrText("Commit message:").SetFont(StdFont().Bold()));
|
||||
|
|
@ -302,18 +306,19 @@ void RepoSvnDel(const char *path)
|
|||
}
|
||||
}
|
||||
|
||||
void RepoSync::Dir(const char *dir, int kind)
|
||||
void RepoSync::Dir(bool read_only, const char *dir, int kind)
|
||||
{
|
||||
Work& d = work.Add();
|
||||
d.dir = dir;
|
||||
d.kind = kind;
|
||||
d.dir = dir;
|
||||
d.read_only = read_only;
|
||||
}
|
||||
|
||||
void RepoSync::Dir(const char *dir)
|
||||
void RepoSync::Dir(bool read_only, const char *dir)
|
||||
{
|
||||
int kind = GetRepoKind(dir);
|
||||
if(kind)
|
||||
Dir(dir, kind);
|
||||
Dir(read_only, dir, kind);
|
||||
}
|
||||
|
||||
void RepoMoveSvn(const String& path, const String& tp)
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ struct RepoSync : WithRepoSyncLayout<TopWindow> {
|
|||
};
|
||||
|
||||
struct Work {
|
||||
bool read_only;
|
||||
int kind;
|
||||
String dir;
|
||||
};
|
||||
|
|
@ -93,8 +94,10 @@ public:
|
|||
void SetMsgs(const String& s);
|
||||
String GetMsgs();
|
||||
|
||||
void Dir(const char *dir, int kind);
|
||||
void Dir(const char *dir);
|
||||
void Dir(bool read_only, const char *dir, int kind);
|
||||
void Dir(bool read_only, const char *dir);
|
||||
void Dir(const char *dir, int kind) { Dir(false, dir, kind); }
|
||||
void Dir(const char *dir) { Dir(false, dir); }
|
||||
void DoSync();
|
||||
|
||||
RepoSync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue