Hello,
this patch, while very rough, should make bat on windows at least usable
(but still slow).
Ciao,
Riccardo
Index: src/qt-console/medialist/medialist.cpp
===================================================================
--- src/qt-console/medialist/medialist.cpp (revision 7993)
+++ src/qt-console/medialist/medialist.cpp (working copy)
@@ -421,12 +421,14 @@
*/
void MediaList::writeExpandedSettings()
{
- QSettings settings(m_console->m_dir->name(), "bat");
- settings.beginGroup("MediaListTreeExpanded");
- int childcount = m_topItem->childCount();
- for (int cnt=0; cnt<childcount; cnt++) {
- QTreeWidgetItem *poolitem = m_topItem->child(cnt);
- settings.setValue(poolitem->text(0), poolitem->isExpanded());
+ if (m_topItem) {
+ QSettings settings(m_console->m_dir->name(), "bat");
+ settings.beginGroup("MediaListTreeExpanded");
+ int childcount = m_topItem->childCount();
+ for (int cnt=0; cnt<childcount; cnt++) {
+ QTreeWidgetItem *poolitem = m_topItem->child(cnt);
+ settings.setValue(poolitem->text(0), poolitem->isExpanded());
+ }
+ settings.endGroup();
}
- settings.endGroup();
}
Index: src/qt-console/jobs/jobs.cpp
===================================================================
--- src/qt-console/jobs/jobs.cpp (revision 7993)
+++ src/qt-console/jobs/jobs.cpp (working copy)
@@ -145,7 +145,7 @@
void Jobs::tableItemChanged(QTableWidgetItem *currentwidgetitem,
QTableWidgetItem *previouswidgetitem )
{
/* m_checkcurwidget checks to see if this is during a refresh, which will
segfault */
- if (m_checkcurwidget) {
+ if (m_checkcurwidget && currentwidgetitem) {
/* The Previous item */
if (previouswidgetitem) { /* avoid a segfault if first time */
foreach(QAction* jobAction, tableWidget->actions()) {
Index: src/qt-console/console/console.cpp
===================================================================
--- src/qt-console/console/console.cpp (revision 7993)
+++ src/qt-console/console/console.cpp (working copy)
@@ -43,7 +43,10 @@
static int tls_pem_callback(char *buf, int size, const void *userdata);
-Console::Console(QStackedWidget *parent)
+Console::Console(QStackedWidget *parent):
+m_notifier(NULL),
+m_api_set(false),
+m_messages_pending(false)
{
QFont font;
m_parent = parent;
@@ -230,11 +233,14 @@
mainWin->set_status(_("Initializing ..."));
+#ifndef HAVE_WIN32
/* Set up input notifier */
m_notifier = new QSocketNotifier(m_sock->m_fd, QSocketNotifier::Read, 0);
QObject::connect(m_notifier, SIGNAL(activated(int)), this,
SLOT(read_dir(int)));
+#endif
write(".api 1");
+ m_api_set = true;
displayToPrompt();
beginNewCommand();
@@ -619,14 +625,9 @@
{
int stat;
#ifdef HAVE_WIN32
- bool isEnabled = m_notifier->isEnabled();
- if (isEnabled) {
- m_notifier->setEnabled(false);
- }
+ bool wasEnabled = notify(false);
stat = m_sock->recv();
- if (isEnabled) {
- m_notifier->setEnabled(true);
- }
+ notify(wasEnabled);
#else
stat = m_sock->recv();
#endif
@@ -646,7 +647,7 @@
break;
}
app->processEvents();
- if (m_api_set && m_messages_pending && m_notifier->isEnabled()) {
+ if (m_api_set && m_messages_pending && is_notify_enabled()) {
write_dir(".messages");
m_messages_pending = false;
}
@@ -663,7 +664,7 @@
}
switch (m_sock->msglen) {
case BNET_MSGS_PENDING :
- if (m_notifier->isEnabled()) {
+ if (is_notify_enabled()) {
if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n");
write_dir(".messages");
displayToPrompt();
@@ -758,9 +759,11 @@
QBrush redBrush(Qt::red);
QTreeWidgetItem *item = mainWin->getFromHash(this);
item->setForeground(0, redBrush);
- m_notifier->setEnabled(false);
- delete m_notifier;
- m_notifier = NULL;
+ if (m_notifier) {
+ m_notifier->setEnabled(false);
+ delete m_notifier;
+ m_notifier = NULL;
+ }
mainWin->set_status(_("Director disconnected."));
QApplication::restoreOverrideCursor();
stat = BNET_HARDEOF;
@@ -789,11 +792,24 @@
* from the Directory, so we set notify to off.
* m_console->notifiy(false);
*/
-void Console::notify(bool enable)
+bool Console::notify(bool enable)
{
- m_notifier->setEnabled(enable);
+ bool prev_enabled = false;
+ if (m_notifier) {
+ prev_enabled = m_notifier->isEnabled();
+ m_notifier->setEnabled(enable);
+ }
+ return prev_enabled;
}
+bool Console::is_notify_enabled() const
+{
+ bool enabled = false;
+ if (m_notifier)
+ enabled = m_notifier->isEnabled();
+ return enabled;
+}
+
void Console::setDirectorTreeItem(QTreeWidgetItem *item)
{
m_directorTreeItem = item;
Index: src/qt-console/console/console.h
===================================================================
--- src/qt-console/console/console.h (revision 7993)
+++ src/qt-console/console/console.h (working copy)
@@ -91,7 +91,8 @@
void writeSettings();
void readSettings();
char *msg();
- void notify(bool enable);
+ bool notify(bool enable); // enables/disables socket notification - returns
the previous state
+ bool is_notify_enabled() const;
QStringList get_list(char *cmd);
bool get_job_defaults(struct job_defaults &);
void terminate();
Index: src/qt-console/util/fmtwidgetitem.cpp
===================================================================
--- src/qt-console/util/fmtwidgetitem.cpp (revision 7993)
+++ src/qt-console/util/fmtwidgetitem.cpp (working copy)
@@ -78,6 +78,7 @@
if (qw) {
qw->setUpdatesEnabled(true);
QApplication::restoreOverrideCursor();
+ qw->update();
}
}
Index: src/lib/jcr.c
===================================================================
--- src/lib/jcr.c (revision 7993)
+++ src/lib/jcr.c (working copy)
@@ -1012,8 +1012,13 @@
fprintf(fp, "JCR=%p JobId=%i name=%s JobStatus=%c\n",
jcr, jcr->JobId, jcr->Job, jcr->JobStatus);
+#ifdef HAVE_WIN32
+ fprintf(fp, "\tuse_count=%i\n",
+ jcr->use_count());
+#else
fprintf(fp, "\tuse_count=%i threadid=0x%x\n",
jcr->use_count(), (int)jcr->my_thread_id);
+#endif
fprintf(fp, "\tJobType=%c JobLevel=%c\n",
jcr->get_JobType(), jcr->get_JobLevel());
bstrftime(buf1, sizeof(buf1), jcr->sched_time);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel