Skip to content

Commit

Permalink
Initialise members in constructor in mythtv-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Aug 23, 2011
1 parent 5746436 commit 3da907c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
41 changes: 22 additions & 19 deletions mythtv/programs/mythtv-setup/channeleditor.cpp
Expand Up @@ -57,11 +57,14 @@ ChannelWizard::ChannelWizard(int id, int default_sourceid)
/////////////////////////////////////////////////////////

ChannelEditor::ChannelEditor(MythScreenStack *parent)
: MythScreenType(parent, "channeleditor")
: MythScreenType(parent, "channeleditor"),
m_sourceFilter(FILTER_ALL),
m_currentSortMode(QObject::tr("Channel Name")),
m_currentHideMode(false),
m_channelList(NULL), m_sourceList(NULL), m_preview(NULL),
m_channame(NULL), m_channum(NULL), m_callsign(NULL),
m_chanid(NULL), m_sourcename(NULL), m_compoundname(NULL)
{
m_currentSortMode = tr("Channel Name");
m_sourceFilter = FILTER_ALL; // All
m_currentHideMode = false;
}

bool ChannelEditor::Create()
Expand Down Expand Up @@ -383,15 +386,15 @@ void ChannelEditor::setHideMode(bool hide)
void ChannelEditor::del()
{
MythUIButtonListItem *item = m_channelList->GetItemCurrent();

if (!item)
return;

QString message = tr("Delete channel '%1'?").arg(item->GetText("name"));

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true);

if (dialog->Create())
{
dialog->SetData(qVariantFromValue(item));
Expand All @@ -400,7 +403,7 @@ void ChannelEditor::del()
}
else
delete dialog;

}

void ChannelEditor::deleteChannels(void)
Expand All @@ -414,10 +417,10 @@ void ChannelEditor::deleteChannels(void)
(del_all) ? tr("Delete ALL channels?") :
((del_nul) ? tr("Delete all unassigned channels?") :
tr("Delete all channels on %1?").arg(currentLabel));

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true);

if (dialog->Create())
{
dialog->SetReturnEvent(this, "delall");
Expand Down Expand Up @@ -586,7 +589,7 @@ void ChannelEditor::customEvent(QEvent *event)
{
bool del_all = m_sourceFilter == FILTER_ALL;
bool del_nul = m_sourceFilter == FILTER_UNASSIGNED;

MSqlQuery query(MSqlQuery::InitCon());
if (del_all)
{
Expand All @@ -597,17 +600,17 @@ void ChannelEditor::customEvent(QEvent *event)
query.prepare("SELECT sourceid "
"FROM videosource "
"GROUP BY sourceid");

if (!query.exec() || !query.isActive())
{
MythDB::DBError("ChannelEditor Delete Channels", query);
return;
}

QString tmp = "";
while (query.next())
tmp += "'" + query.value(0).toString() + "',";

if (tmp.isEmpty())
{
query.prepare("TRUNCATE TABLE channel");
Expand All @@ -625,10 +628,10 @@ void ChannelEditor::customEvent(QEvent *event)
"WHERE sourceid = :SOURCEID");
query.bindValue(":SOURCEID", m_sourceFilter);
}

if (!query.exec())
MythDB::DBError("ChannelEditor Delete Channels", query);

fillList();
}
else if (resultid == "iconimportopt")
Expand All @@ -638,7 +641,7 @@ void ChannelEditor::customEvent(QEvent *event)
ImportIconsWizard *iconwizard;

QString channelname = dce->GetData().toString();

switch (buttonnum)
{
case 0 : // Import all icons
Expand All @@ -663,5 +666,5 @@ void ChannelEditor::customEvent(QEvent *event)
else
delete iconwizard;
}
}
}
}
13 changes: 7 additions & 6 deletions mythtv/programs/mythtv-setup/importicons.cpp
Expand Up @@ -28,7 +28,8 @@ ImportIconsWizard::ImportIconsWizard(MythScreenStack *parent, bool fRefresh,
m_url("http://services.mythtv.org/channel-icon/"), m_progressDialog(NULL),
m_iconsList(NULL), m_manualEdit(NULL),
m_nameText(NULL), m_manualButton(NULL),
m_skipButton(NULL), m_statusText(NULL)
m_skipButton(NULL), m_statusText(NULL),
m_preview(NULL), m_previewtitle(NULL)
{
m_strChannelname.detach();
LOG(VB_GENERAL, LOG_INFO,
Expand Down Expand Up @@ -60,7 +61,7 @@ bool ImportIconsWizard::Create()
if (!initialLoad(m_strChannelname))
return false;


bool foundtheme = false;

// Load the theme for this screen
Expand Down Expand Up @@ -100,7 +101,7 @@ bool ImportIconsWizard::Create()
SLOT(menuSelection(MythUIButtonListItem *)));
connect(m_iconsList, SIGNAL(itemSelected(MythUIButtonListItem *)),
SLOT(itemChanged(MythUIButtonListItem *)));

BuildFocusList();

enableControls(STATE_NORMAL);
Expand Down Expand Up @@ -547,7 +548,7 @@ bool ImportIconsWizard::checkAndDownload(const QString& url, const QString& loca
QFileInfo file(m_strChannelDir+filename);

bool fRet;
// Since DNS for lyngsat-logos.com times out, set a 20s timeout
// Since DNS for lyngsat-logos.com times out, set a 20s timeout
if (!file.exists())
fRet = HttpComms::getHttpFile(file.absoluteFilePath(),iconUrl,20000);
else
Expand Down Expand Up @@ -703,9 +704,9 @@ bool ImportIconsWizard::search(const QString& strParam)
iconfile = m_tmpDir.absoluteFilePath(iconfile);
QString iconname = entry.strName;
bool haveIcon = true;
// Since DNS for lyngsat-logos.com times out, set a 20s timeout
// Since DNS for lyngsat-logos.com times out, set a 20s timeout
if (!QFile(iconfile).exists())
haveIcon = HttpComms::getHttpFile(iconfile, entry.strLogo,
haveIcon = HttpComms::getHttpFile(iconfile, entry.strLogo,
20000);

if (haveIcon)
Expand Down

0 comments on commit 3da907c

Please sign in to comment.