void MagpieFileImportPopup::showEvent(QShowEvent *)
{
	if (m_info == 0)
		return;

	int frameCount = m_info->getFrameCount();
	m_fromField->setRange(1, frameCount);
	m_fromField->setValue(1);
	m_toField->setRange(1, frameCount);
	m_toField->setValue(frameCount);

	int i;
	QList<QString> actsIdentifier = m_info->getActsIdentifier();
	for (i = 0; i < m_actFields.size(); i++) {
		IntLineEdit *field = m_actFields.at(i).second;
		QLabel *label = m_actFields.at(i).first;
		if (i >= actsIdentifier.size()) {
			field->hide();
			label->hide();
			continue;
		}
		QString act = actsIdentifier.at(i);
		field->setProperty("act", QVariant(act));
		field->show();
		label->setText(act);
		label->show();
	}
	QString oldLevelPath = m_levelField->getPath();
	TFilePath oldFilePath(oldLevelPath.toStdWString());
	TFilePath perntDir = oldFilePath.getParentDir();
	m_levelField->setPath(QString::fromStdWString(perntDir.getWideString()));
}
void TailFileLogHandler::log(const qi::log::LogLevel verb,
                             const qi::os::timeval   date,
                             const char              *category,
                             const char              *msg,
                             const char              *file,
                             const char              *fct,
                             const int               line)
{
    if (verb > qi::log::verbosity() || _private->_file == NULL)
    {
        return;
    }
    else
    {
        fseek(_private->_file, 0, SEEK_END);

        std::string logline = qi::detail::logline(date, category, msg, file, fct, line);
        _private->_writeSize += fprintf(_private->_file, "%s %s", logLevelToString(verb), logline.c_str());
        fflush(_private->_file);
    }

    if (_private->_writeSize > FILESIZEMAX)
    {
        fclose(_private->_file);
        boost::filesystem::path filePath(_private->_fileName);
        boost::filesystem::path oldFilePath(_private->_fileName + ".old");

        boost::filesystem::copy_file(filePath,
                                     oldFilePath,
                                     boost::filesystem::copy_option::overwrite_if_exists);

        FILE* file = qi::os::fopen(filePath.make_preferred().string().c_str(), "w+");

        _private->_file = file;
        _private->_writeSize = 0;
    }
}