[PC-BSD Commits] r124 - pcbsd/trunk/kcmPBSystem
svn at pcbsd.org
svn at pcbsd.org
Thu Mar 8 11:33:41 PST 2007
Author: tim
Date: 2007-03-08 20:33:40 +0100 (Thu, 08 Mar 2007)
New Revision: 124
Modified:
pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h
pcbsd/trunk/kcmPBSystem/fastestcvsup.ui
pcbsd/trunk/kcmPBSystem/fastestcvsup.ui.h
Log:
Completed fastest_cvsup implementation. Users may now choose between scanning all servers, or any other combination they choose (by country).
Modified: pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h
===================================================================
--- pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h 2007-03-08 18:20:23 UTC (rev 123)
+++ pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h 2007-03-08 19:33:40 UTC (rev 124)
@@ -85,7 +85,7 @@
void CVSUpProgress::setCvsupServer( QString *server )
{
int question = KMessageBox::questionYesNo(this, tr("PC-BSD has your fastest server to be:\n") + *server + tr("\n\nWould you like to use this server in future?"), tr("Confirm server selection"));
- if (question)
+ if (question == KMessageBox::Yes)
{
writeServer(*server);
progressLabel->setText(tr("Selected CVSup server: ") + getServer());
Modified: pcbsd/trunk/kcmPBSystem/fastestcvsup.ui
===================================================================
--- pcbsd/trunk/kcmPBSystem/fastestcvsup.ui 2007-03-08 18:20:23 UTC (rev 123)
+++ pcbsd/trunk/kcmPBSystem/fastestcvsup.ui 2007-03-08 19:33:40 UTC (rev 124)
@@ -9,11 +9,11 @@
<x>0</x>
<y>0</y>
<width>517</width>
- <height>459</height>
+ <height>458</height>
</rect>
</property>
<property name="caption">
- <string>Change CVSUP server</string>
+ <string>Change CVSup server</string>
</property>
<property name="modal">
<bool>true</bool>
@@ -242,6 +242,12 @@
<receiver>FastestCvsup</receiver>
<slot>cancel()</slot>
</connection>
+ <connection>
+ <sender>allCheck</sender>
+ <signal>clicked()</signal>
+ <receiver>FastestCvsup</receiver>
+ <slot>allToggled()</slot>
+ </connection>
</connections>
<includes>
<include location="global" impldecl="in declaration">klocale.h</include>
@@ -251,6 +257,7 @@
</includes>
<variables>
<variable access="private">QProcess *process;</variable>
+ <variable access="private">QMap<QString, QString> serverMap;</variable>
</variables>
<signals>
<signal>found(QString *fastest);</signal>
@@ -259,6 +266,7 @@
<slot>startPressed()</slot>
<slot>readOutput()</slot>
<slot access="private">cancel()</slot>
+ <slot access="private">allToggled()</slot>
</slots>
<functions>
<function access="private">init()</function>
Modified: pcbsd/trunk/kcmPBSystem/fastestcvsup.ui.h
===================================================================
--- pcbsd/trunk/kcmPBSystem/fastestcvsup.ui.h 2007-03-08 18:20:23 UTC (rev 123)
+++ pcbsd/trunk/kcmPBSystem/fastestcvsup.ui.h 2007-03-08 19:33:40 UTC (rev 124)
@@ -14,11 +14,35 @@
void FastestCvsup::init()
{
- KLocale locale = KLocale(KLocale::defaultLanguage());
+ QStringList servers;
+ serverMap = QMap<QString, QString>();
+ QFile file("/PCBSD/Scripts/System/fastest_cvsup");
+ if (file.open(IO_ReadOnly))
+ {
+ QTextStream stream(&file);
+ QString line;
+ bool scanning = false;
+ while (! stream.atEnd())
+ {
+ line = stream.readLine();
+ if (line.contains("my %FREEBSD_SERVERS =")) { scanning = true; }
+ else if (scanning && (line.contains(");"))) { scanning = false; }
+ else if (scanning)
+ {
+ QString serverCode = line.section("'", 1, 1);
+ QString serverName = line.section("# ", 1, 1);
+ qDebug(serverCode + "=" + serverName);
+ servers += serverName;
+ serverMap[serverName] = serverCode;
+ }
+ }
+ }
+ file.close();
+
hostsSelector->availableListBox()->setSelectionMode(QListBox::Extended);
hostsSelector->selectedListBox()->setSelectionMode(QListBox::Extended);
- hostsSelector->availableListBox()->insertStringList(locale.allCountriesTwoAlpha());
+ hostsSelector->availableListBox()->insertStringList(servers);
}
@@ -30,7 +54,19 @@
process->addArgument("/PCBSD/Scripts/System/fastest_cvsup");
process->addArgument("-m");
process->addArgument("-c");
- process->addArgument("uk");
+ if (allCheck->isChecked()) { process->addArgument("all"); }
+ else
+ {
+ QListBox *selected = hostsSelector->selectedListBox();
+ QString hostString;
+ for (uint i=0; i<selected->count(); i++)
+ {
+ if (i > 0) { hostString += ","; }
+ hostString += serverMap[selected->text(i)];
+ }
+ qDebug("Host string: " + hostString);
+ process->addArgument(hostString);
+ }
connect(process, SIGNAL(readyReadStdout()), this, SLOT(readOutput()));
@@ -64,3 +100,10 @@
process->kill();
close();
}
+
+
+void FastestCvsup::allToggled()
+{
+ if (allCheck->isChecked()) { hostsSelector->setEnabled(false); }
+ else { hostsSelector->setEnabled(true); }
+}
More information about the Commits
mailing list