Skip to content

Commit

Permalink
Refs #3842. Adds basic support for Schedules Direct to trunk.
Browse files Browse the repository at this point in the history
This has fixed all the issues reported in the last few days; but problems may remain, please post any problem reports to the #3842 ticket.

The frontend channel editor does not work with Schedules Direct yet.

You will need to recompile your plugins, as the binary revision has changed.

Multiple MythTV lineups per Schedules Direct or Labs lineup is now supported. However, in order to do this you must always run mythfilldatabase with the "--remove-new-channels" option after you set up your channels. A future commit will add some more smarts so that you do not need to do this. Please see the #3842 ticket for more details.



git-svn-id: http://svn.mythtv.org/svn/trunk@14232 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
daniel-kristjansson committed Aug 20, 2007
1 parent 3dc93ec commit 30123f0
Show file tree
Hide file tree
Showing 13 changed files with 475 additions and 85 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythcontext.h
Expand Up @@ -209,7 +209,7 @@ class MPUBLIC MythPrivRequest

/// Update this whenever the plug-in API changes.
/// Including changes in the libmythtv class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.20.20070717-1"
#define MYTH_BINARY_VERSION "0.21.20070820-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
10 changes: 9 additions & 1 deletion mythtv/libs/libmyth/settings.cpp
Expand Up @@ -639,7 +639,8 @@ QWidget* LineEditSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
connect(edit, SIGNAL(changeHelpText(QString)), cg,
SIGNAL(changeHelpText(QString)));

edit->setRW(rw);
setRW(rw);
SetPasswordEcho(password_echo);

return widget;
}
Expand All @@ -664,6 +665,13 @@ void LineEditSetting::setVisible(bool b)
}
}

void LineEditSetting::SetPasswordEcho(bool b)
{
password_echo = b;
if (edit)
edit->setEchoMode(b ? QLineEdit::Password : QLineEdit::Normal);
}

QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
const char* widgetName) {
QHBox* widget;
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmyth/settings.h
Expand Up @@ -200,7 +200,7 @@ class MPUBLIC LineEditSetting: public Setting
{
protected:
LineEditSetting(Storage *_storage, bool readwrite = true) :
Setting(_storage), edit(NULL), rw(readwrite) { }
Setting(_storage), edit(NULL), rw(readwrite), password_echo(false) { }

public:
virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
Expand All @@ -217,10 +217,12 @@ class MPUBLIC LineEditSetting: public Setting

virtual void setEnabled(bool b);
virtual void setVisible(bool b);
virtual void SetPasswordEcho(bool b);

private:
MythLineEdit* edit;
bool rw;
bool password_echo;
};

// TODO: set things up so that setting the value as a string emits
Expand Down
105 changes: 105 additions & 0 deletions mythtv/libs/libmyth/util.cpp
Expand Up @@ -32,6 +32,7 @@ using namespace std;
#include <qpainter.h>
#include <qpixmap.h>
#include <qfont.h>
#include <qfile.h>

// Myth headers
#include "mythconfig.h"
Expand Down Expand Up @@ -603,3 +604,107 @@ bool telnet(const QString &host, int port)

return false;
}

/** \fn Copy(QFile&,QFile&,uint)
* \brief Copies src file to dst file.
*
* If the dst file is open, it must be open for writing.
* If the src file is open, if must be open for reading.
*
* The files will be in the same open or close state after
* this function runs as they were prior to this function being called.
*
* This function does not care if the files are actual files.
* For compatibility with pipes and socket streams the file location
* will not be reset to 0 at the end of this function. If the function
* is succesful the file pointers will be at the end of the copied
* data.
*
* \param dst Destination QFile
* \param src Source QFile
* \param block_size Optional block size in bytes, must be at least 1024,
* otherwise the default of 16 KB will be used.
* \return bytes copied on success, -1 on failure.
*/
long long copy(QFile &dst, QFile &src, uint block_size)
{
uint buflen = (block_size < 1024) ? (16 * 1024) : block_size;
char *buf = new char[buflen];
bool odst = false, osrc = false;

if (!buf)
return -1LL;

if (!dst.isWritable() && !dst.isOpen())
odst = dst.open(IO_Raw|IO_WriteOnly|IO_Truncate);

if (!src.isReadable() && !src.isOpen())
osrc = src.open(IO_Raw|IO_ReadOnly);

bool ok = dst.isWritable() && src.isReadable();
long long total_bytes = 0LL;
while (ok)
{
long long rlen, wlen, off = 0;
rlen = src.readBlock(buf, buflen);
if (rlen<0)
{
ok = false;
break;
}
if (rlen==0)
break;

total_bytes += (long long) rlen;

while ((rlen-off>0) && ok)
{
wlen = dst.writeBlock(buf + off, rlen - off);
if (wlen>=0)
off+= wlen;
if (wlen<0)
ok = false;
}
}
delete[] buf;

if (odst)
dst.close();

if (osrc)
src.close();

return (ok) ? total_bytes : -1LL;
}

QString createTempFile(QString name_template, bool dir)
{
const char *tmp = name_template.ascii();
char *ctemplate = strdup(tmp);
int ret = -1;

if (dir)
{
ret = (mkdtemp(ctemplate)) ? 0 : -1;
}
else
{
ret = mkstemp(ctemplate);
}

QString tmpFileName(ctemplate);
free(ctemplate);

if (ret == -1)
{
VERBOSE(VB_IMPORTANT, QString("createTempFile(%1), Error ")
.arg(name_template) + ENO);
return name_template;
}

if (!dir && (ret >= 0))
close(ret);

return tmpFileName;
}

5 changes: 5 additions & 0 deletions mythtv/libs/libmyth/util.h
Expand Up @@ -16,6 +16,7 @@ class QPixmap;
class QImage;
class QPainter;
class QFont;
class QFile;

class MPUBLIC MythTimer
{
Expand Down Expand Up @@ -73,4 +74,8 @@ MPUBLIC bool hasUtf8(const char *str);
MPUBLIC bool ping(const QString &host, int timeout);
MPUBLIC bool telnet(const QString &host, int port);

MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXX",
bool dir = false);

#endif // UTIL_H_

0 comments on commit 30123f0

Please sign in to comment.