Example #1
0
void BasicHDT::loadFromSeveralHDT(const char **fileNames, size_t numFiles, string baseUri, ProgressListener *listener)
{
	try {
		// Make sure that URI starts and ends with <>
		if(baseUri.at(0)!='<')
			baseUri = '<'+baseUri;
		if(baseUri.at(baseUri.length()-1)!='>')
			baseUri.append(">");

		IntermediateListener iListener(listener);

		iListener.setRange(0,50);
		loadDictionaryFromHDTs(fileNames, numFiles, baseUri.c_str(), &iListener);

		iListener.setRange(50,99);
		loadTriplesFromHDTs(fileNames, numFiles, baseUri.c_str(), &iListener);

		fillHeader(baseUri);

	}catch (const char *e) {
		cout << "Catch exception load: " << e << endl;
		deleteComponents();
		createComponents();
		throw e;
	} catch (char *e) {
		cout << "Catch exception load: " << e << endl;
		deleteComponents();
		createComponents();
		throw e;
	}
}
Example #2
0
HistoryMessage::HistoryMessage(
	not_null<History*> history,
	const MTPDmessageService &data)
: HistoryItem(
		history,
		data.vid.v,
		mtpCastFlags(data.vflags.v),
		data.vdate.v,
		data.has_from_id() ? data.vfrom_id.v : UserId(0)) {
	CreateConfig config;

	if (data.has_reply_to_msg_id()) config.replyTo = data.vreply_to_msg_id.v;

	createComponents(config);

	switch (data.vaction.type()) {
	case mtpc_messageActionPhoneCall: {
		_media = std::make_unique<Data::MediaCall>(
			this,
			data.vaction.c_messageActionPhoneCall());
	} break;

	default: Unexpected("Service message action type in HistoryMessage.");
	}

	setText(TextWithEntities {});
}
void FKSimpleCore::initComponents(){
    createComponents();
    installComponents();
    installComponentFactories();
    emit realmComponentChanged();
    emit serverComponentChanged();
    emit clientComponentChanged();
}
// ----------------------------------------------------------------------------
// CbsUiTopicView::init
// ----------------------------------------------------------------------------
void CbsUiTopicView::init(MCbs &server, CbsUiViewManager &viewManager)
{
    LOG(NORMAL,"CBSUI: CbsUiTopicView::init IN");
    mViewManager = &viewManager;
    mServer = &server;
    createComponents();
    LOG(NORMAL,"CBSUI: CbsUiTopicView::init OUT");
}
Example #5
0
void BasicHDT::loadFromHDT(std::istream & input, ProgressListener *listener)
{
    try {
	ControlInformation controlInformation;
	IntermediateListener iListener(listener);

	// Load Global ControlInformation.
	controlInformation.load(input);
	std::string hdtFormat = controlInformation.getFormat();
	if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
		throw "This software cannot open this version of HDT File.";
	}

	// Load header
	iListener.setRange(0,5);
	controlInformation.load(input);
	delete header;
	header = HDTFactory::readHeader(controlInformation);
	header->load(input, controlInformation, &iListener);

	//Load Dictionary.
	iListener.setRange(5, 60);
	controlInformation.load(input);
	delete dictionary;
	dictionary = HDTFactory::readDictionary(controlInformation);
	dictionary->load(input, controlInformation, &iListener);

	// Load Triples
	iListener.setRange(60,100);
	controlInformation.load(input);
	delete triples;
	triples = HDTFactory::readTriples(controlInformation);
	triples->load(input, controlInformation, &iListener);
    } catch (const char *ex) {
        cout << "Exception loading HDT: " << ex;
        deleteComponents();
        createComponents();
        throw ex;
    } catch (char *ex) {
    	cout << "Exception loading HDT: " << ex;
    	deleteComponents();
        createComponents();
        throw ex;
    }
}
Example #6
0
HistoryMessage::HistoryMessage(
	not_null<History*> history,
	const MTPDmessage &data)
: HistoryItem(
		history,
		data.vid.v,
		data.vflags.v,
		data.vdate.v,
		data.has_from_id() ? data.vfrom_id.v : UserId(0)) {
	CreateConfig config;

	if (data.has_fwd_from() && data.vfwd_from.type() == mtpc_messageFwdHeader) {
		auto &f = data.vfwd_from.c_messageFwdHeader();
		config.originalDate = f.vdate.v;
		if (f.has_from_id() || f.has_channel_id()) {
			config.senderOriginal = f.has_channel_id()
				? peerFromChannel(f.vchannel_id)
				: peerFromUser(f.vfrom_id);
			if (f.has_channel_post()) config.originalId = f.vchannel_post.v;
			if (f.has_post_author()) config.authorOriginal = qs(f.vpost_author);
			if (f.has_saved_from_peer() && f.has_saved_from_msg_id()) {
				config.savedFromPeer = peerFromMTP(f.vsaved_from_peer);
				config.savedFromMsgId = f.vsaved_from_msg_id.v;
			}
		}
	}
	if (data.has_reply_to_msg_id()) config.replyTo = data.vreply_to_msg_id.v;
	if (data.has_via_bot_id()) config.viaBotId = data.vvia_bot_id.v;
	if (data.has_views()) config.viewsCount = data.vviews.v;
	if (data.has_reply_markup()) config.mtpMarkup = &data.vreply_markup;
	if (data.has_edit_date()) config.editDate = data.vedit_date.v;
	if (data.has_post_author()) config.author = qs(data.vpost_author);

	createComponents(config);

	if (data.has_media()) {
		setMedia(data.vmedia);
	}

	auto text = TextUtilities::Clean(qs(data.vmessage));
	auto entities = data.has_entities()
		? TextUtilities::EntitiesFromMTP(data.ventities.v)
		: EntitiesInText();
	setText({ text, entities });

	if (data.has_grouped_id()) {
		setGroupId(MessageGroupId::FromRaw(data.vgrouped_id.v));
	}
}
Example #7
0
void HistoryMessage::createComponentsHelper(
		MTPDmessage::Flags flags,
		MsgId replyTo,
		UserId viaBotId,
		const QString &postAuthor,
		const MTPReplyMarkup &markup) {
	CreateConfig config;

	if (flags & MTPDmessage::Flag::f_via_bot_id) config.viaBotId = viaBotId;
	if (flags & MTPDmessage::Flag::f_reply_to_msg_id) config.replyTo = replyTo;
	if (flags & MTPDmessage::Flag::f_reply_markup) config.mtpMarkup = &markup;
	if (flags & MTPDmessage::Flag::f_post_author) config.author = postAuthor;
	if (isPost()) config.viewsCount = 1;

	createComponents(config);
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);    

    // Setup members
    document = new Model(this);

    // Create the components
    createComponents();

    // Signals
    QObject::connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    QObject::connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    showMaximized();
}
Example #9
0
int CApplication::run(int argc, const char argv[])
{
   if (false == initialize())
   {
      std::cerr << "initialize() failed." << std::endl;
      return EXIT_FAILURE;
   }

   if (false == createComponents(argc, argv))
   {
      std::cerr << "createComponents() failed." << std::endl;
      return EXIT_FAILURE;
   }

   runMainLoop();

   return EXIT_SUCCESS;
}
Example #10
0
appMain::appMain( int argc, char** argv )
 : _argc(argc),
   _argv(argv),
   winMe(NULL),
   blMutexer(false),
   bInitFFplay(false),
   bMediaLoaded(false),
   bMediaReached(false),
   bPaused(false),
   bFlushingReady(false),
   framecount(0),
   frameskip(0),
   info_frame(0),
   prev_keytime(0),
   wait_ms(0),
   vid_state(NULL),
   audio_proc(NULL),
   userURL(NULL)
{
    createComponents();

    audio_proc = new AudioProc();
    if ( audio_proc != NULL )
    {
        audio_proc->reqcb( this );
    }

    if ( ffplaymod_init( argc, argv ) == 0 )
    {
        bInitFFplay = true;
    }

    // Check "RTSP" server address ...
    for( int cnt=1; cnt<argc; cnt++ )
    {
        char* strp = strstr( argv[cnt], "rtsp://" );
        if ( strp != NULL )
        {
            userURL = strp;
        }
    }

    wait_ms = 1;
}
ShutterToolMainWindow::ShutterToolMainWindow(QWidget *parent)
	: QWidget(parent)
{
	setAttribute(Qt::WA_ShowWithoutActivating);

	model_ = 0;
	mainLayout_ = 0;

	appStatusLabel_ = 0;
	enableAutomaticShuttersOpenButton_ = 0;
	enableAutomaticShuttersOpenButton_ = 0;

	shuttersStatusLabel_ = 0;
	openShuttersButton_ = 0;
	closeShuttersButton_ = 0;

	createComponents();
	defaultSettings();
	makeConnections();
}
Example #12
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    resize(400, 300);
    setWindowTitle("QSum");
    setWindowIcon(icon("calc"));
    clipboard = qApp->clipboard();

    createBars();
    createActions();
    createComponents();

    connect(&sumlib, SIGNAL(started()), this,
            SLOT(calcStarted()));
    connect(&sumlib, SIGNAL(hashChanged()), this,
            SLOT(updateStatus()));
    connect(&sumlib, SIGNAL(finished()), this,
            SLOT(setFinalResult()));

    QMetaObject::connectSlotsByName(this);
}
Example #13
0
HistoryMessage::HistoryMessage(
	not_null<History*> history,
	MsgId id,
	MTPDmessage::Flags flags,
	TimeId date,
	UserId from,
	const QString &postAuthor,
	not_null<HistoryMessage*> original)
: HistoryItem(
		history,
		id,
		NewForwardedFlags(history->peer, from, original) | flags,
		date,
		from) {
	CreateConfig config;

	if (original->Has<HistoryMessageForwarded>() || !original->history()->peer->isSelf()) {
		// Server doesn't add "fwd_from" to non-forwarded messages from chat with yourself.
		config.originalDate = original->dateOriginal();
		auto senderOriginal = original->senderOriginal();
		config.senderOriginal = senderOriginal->id;
		config.authorOriginal = original->authorOriginal();
		if (senderOriginal->isChannel()) {
			config.originalId = original->idOriginal();
		}
	}
	if (history->peer->isSelf()) {
		//
		// iOS app sends you to the original post if we forward a forward from channel.
		// But server returns not the original post but the forward in saved_from_...
		//
		//if (config.originalId) {
		//	config.savedFromPeer = config.senderOriginal;
		//	config.savedFromMsgId = config.originalId;
		//} else {
			config.savedFromPeer = original->history()->peer->id;
			config.savedFromMsgId = original->id;
		//}
	}
	if (flags & MTPDmessage::Flag::f_post_author) {
		config.author = postAuthor;
	}
	auto fwdViaBot = original->viaBot();
	if (fwdViaBot) config.viaBotId = peerToUser(fwdViaBot->id);
	int fwdViewsCount = original->viewsCount();
	if (fwdViewsCount > 0) {
		config.viewsCount = fwdViewsCount;
	} else if (isPost()) {
		config.viewsCount = 1;
	}

	// Copy inline keyboard when forwarding messages with a game.
	auto mediaOriginal = original->media();
	if (mediaOriginal && mediaOriginal->game()) {
		config.inlineMarkup = original->inlineReplyMarkup();
	}

	createComponents(config);

	auto ignoreMedia = [&] {
		if (mediaOriginal && mediaOriginal->webpage()) {
			if (const auto channel = history->peer->asChannel()) {
				if (channel->restricted(ChannelRestriction::f_embed_links)) {
					return true;
				}
			}
		}
		return false;
	};
	if (mediaOriginal && !ignoreMedia()) {
		_media = mediaOriginal->clone(this);
	}
	setText(original->originalText());
}
Example #14
0
BasicHDT::BasicHDT(HDTSpecification &spec) : mappedHDT(NULL), mappedIndex(NULL) {
	this->spec = spec;
	createComponents();
}
Example #15
0
BasicHDT::BasicHDT() : mappedHDT(NULL), mappedIndex(NULL) {
	createComponents();
}
// ----------------------------------------------------------------------------
// CbsUiTopicListView::init
// ----------------------------------------------------------------------------
void CbsUiTopicListView::init(MCbs &server, 
               CbsUiViewManager &viewManager)
{
    LOG(NORMAL,"CBSUI: CbsUiTopicListView::init IN");
    mViewManager = &viewManager;
    LOG(NORMAL,"CBSUI: CbsUiTopicListView::init 1");
    mServer = &server;
    LOG(NORMAL,"CBSUI: CbsUiTopicListView::init 2");
    // First get pointers to UI components
    createComponents();

    // Update reception status to UI
    TBool status; //Symbian variable..
    mServer->GetReceptionStatus(status);
    if (status) {
       LOG(NORMAL,"CBSUI: CbsUiTopicListView::init reception ON");
       mReceptionButton->setText(hbTrId("txt_cbs_deactivate"));
    } else {
       LOG(NORMAL,"CBSUI: CbsUiTopicListView::init reception OFF");
       mReceptionButton->setText(hbTrId("txt_cbs_activate"));
    }

    // Update Topic index and Topics   
    reloadTopicIndex();
    reloadTopics();

    // Symbian code, leave etc to be handled.
    // QT_TRAP_THROWING( mMonitor = CCbsUiTopicListMonitor::NewL( *mServer ) );
    // mMonitor->AddObserverL( this );
    // Longpress in topic list, this is needed always
    bool ret(false);

    // conntect topic index list widget operation
    ret = connect(mTopicIndexWidget, 
                SIGNAL(longPressed(HbListWidgetItem *, QPointF)),
            this, SLOT(showTopicIndexMenu(HbListWidgetItem *, QPointF)));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init connect \
            TopicIndex long press %d", ret); 

    ret = connect(mTopicIndexWidget, SIGNAL(activated(HbListWidgetItem *)), 
            this, SLOT(showTopicSelectionView(HbListWidgetItem *)));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init connect \
            TopicIndex short press %d", ret);

    // conntect topics list widget operation
    ret = connect(mTopicsWidget,
            SIGNAL(longPressed(HbListWidgetItem*, QPointF)), 
            this, SLOT(showTopicsMenu(HbListWidgetItem *, QPointF)));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init connect\
             Topics long press %d", ret); 

    ret = connect(mTopicsWidget, SIGNAL(activated(HbListWidgetItem *)), 
            this, SLOT(showTopicView(HbListWidgetItem *)));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init connect \
            topics short press %d", ret);

    // connect reception action
    ret = connect(mReceptionButton, SIGNAL(triggered(bool)), 
            this, SLOT(toggleReception()));  
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init connect reception %d", ret);

    // Open
    mOpenAction = qobject_cast<HbAction *>(
    mViewManager->xmlLoader()->findObject(T_OPEN));
    ret = connect(mOpenAction, SIGNAL(triggered()),
            this, SLOT(showTopicView()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init open %d", ret)

    // Subscribe
    mSubscibeAction = qobject_cast<HbAction *>(
    mViewManager->xmlLoader()->findObject(T_SUBSCRIBE));
    ret = connect(mSubscibeAction, SIGNAL(triggered()),
            this, SLOT(toggleSubscription()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init subscribe %d", ret)

    // UnSubscribe
    mUnSubscibeAction = qobject_cast<HbAction *>(
    mViewManager->xmlLoader()->findObject(T_UNSUBSCRIBE));
    ret = connect(mUnSubscibeAction, SIGNAL(triggered()),
            this, SLOT(toggleSubscription()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init subscribe %d", ret)    

    // Hotmark
    mHotmarkAction = qobject_cast<HbAction *>(
    mViewManager->xmlLoader()->findObject(T_HOTMARK));
    ret = connect(mHotmarkAction, SIGNAL(triggered()),
                 this, SLOT(toggleHotmark()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init hotmark %d", ret)

    // UnHotmark
    mUnHotmarkAction = qobject_cast<HbAction *>(
    mViewManager->xmlLoader()->findObject(T_UNHOTMARK));
    ret = connect(mUnHotmarkAction, SIGNAL(triggered()),
              this, SLOT(toggleHotmark()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init hotmark %d", ret)

    // Edit
    mEditAction = qobject_cast<HbAction *>(
            mViewManager->xmlLoader()->findObject(T_EDIT));
    ret = connect(mEditAction, SIGNAL(triggered()) , 
            this, SLOT(editTopic()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init edit %d", ret)

    // Delete
    mDeleteAction =  qobject_cast<HbAction *>(
            mViewManager->xmlLoader()->findObject(T_DELETE));
    ret = connect(mDeleteAction, SIGNAL(triggered()),
                  this, SLOT(deleteTopic()));
    LOG2(NORMAL,"CBSUI: CbsUiTopicListView::init delete %d", ret)

    LOG(NORMAL,"CBSUI: CbsUiTopicListView::init OUT");   
}