Beispiel #1
0
void MainWindow::applySettings()
{
	enableLogging(settings::settings()[L"general"][L"log"].asNumber() != 0);
	for (auto tab : m_tabs)
	{
		DestroyWindow(tab);
	}
	m_tabs.clear();
	for (auto table : m_tables)
	{
		delete table;
	}
	m_tables.clear();

	if (settings::settings()[L"general"][L"bottomWindow"].asNumber())
	{
		if (!m_parent)
		{
			auto newWnd = createMainWindow();
			SetParent(m_titleLabel, newWnd);
			SetParent(m_menu, newWnd);
			DestroyWindow(m_wnd);
			m_wnd = newWnd;
			ShowWindow(m_wnd, SW_SHOW);
		}
		if (settings::settings()[L"general"][L"autoStart"])
		{
			registerAutorun();
		}
		else
		{
			unregisterAutorun();
		}
	}
	else
	{
		if (m_parent)
		{
			auto parent = m_parent;
			
			auto newWnd = createMainWindow();
			SetParent(m_titleLabel, newWnd);
			SetParent(m_menu, newWnd);
			DestroyWindow(m_wnd);
			m_wnd = newWnd;
			ShowWindow(m_wnd, SW_SHOW);

			DestroyWindow(parent);
		}
		unregisterAutorun();
	}

	createControls();
	InvalidateRect(m_wnd, nullptr, TRUE);
}
int main(void) {

	Ihandle *dlg;
	int res;
	extern void (*routine_drawPixel) (float x, float y);

	srand((unsigned int) time(0));                  /* Seed to current time value */
	
	routine_drawPixel = clipal_drawPixel;

	list_init(&pointList, free);
	res = util_readFromFile("clip_rectangle.txt");
	printf("Clip Rectangle loaded, return value: %d\n", res);
	
	if (res == -1) {
		printf("File read error\n");\
		getche();
		goto TERMINATE;
	}

	IupOpen(0, 0);
		IupGLCanvasOpen();

		dlg = createMainWindow();
		IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

		IupMainLoop();
	IupClose();
	
	TERMINATE:
	list_destroy(&pointList);
	return 0;
}
Beispiel #3
0
MainWindow::MainWindow(HINSTANCE instance)
:	m_inDialog(false),
	m_parent(nullptr),
	m_instance(instance),
	m_emptyLink(nullptr)
{
	enableLogging(settings::settings()[L"general"][L"log"].asNumber() != 0);

	LOG(L"creating MainWindow");

	registerWindowClass(instance, loadString(instance, IDC_LAUNCHGRID).c_str());

	m_wnd = createMainWindow();

	createFonts();

	LOG(L"creating static controls");
	m_titleLabel = CreateWindow(L"STATIC", loadString(instance, IDS_APP_TITLE).c_str(), WS_CHILD | WS_VISIBLE, 8, 4, 120, 30, m_wnd, nullptr, instance, nullptr);
	SendMessage(m_titleLabel, WM_SETFONT, (WPARAM)m_titleFont, 0);

	m_menu = CreateWindow(L"BUTTON", L"Menu", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, 240 - 8 - 24, 4, 24, 24, m_wnd, nullptr, instance, nullptr);
	SetWindowLong(m_menu, GWL_ID, IDC_MENU);

	createControls();

	LOG(L"showing window");
	ShowWindow(m_wnd, settings::settings()[L"general"][L"bottomWindow"].asNumber() ? SW_SHOWNOACTIVATE : SW_SHOW);
	if (settings::settings()[L"general"][L"bottomWindow"].asNumber())
	{
		LOG(L"moving window to background");
		SetWindowPos(m_wnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
	}
	UpdateWindow(m_wnd);
}
Beispiel #4
0
void FxMain::slotLoginOK()
{
    FX_FUNCTION
    isLoginIn = true;
    createMainWindow();
    #ifndef HAVE_GUI_DEBUG_ENABLED
        delete loginWin;
    #endif
}
Beispiel #5
0
Dialog::Dialog(int port, QWidget *parent)
        : QDialog(parent) {
    fromPort = port;
    createMainWindow();
    connects();
    socket = new QUdpSocket(this);
    socket->bind(fromPort);

    setConnectionData();
}
Beispiel #6
0
void KueueApp::createApp()
{
    bool update = false;
    
    if ( Settings::appVersion() != QApplication::applicationVersion() )
    {
        update = true;
        QDir dir = QDir( QDesktopServices::storageLocation( QDesktopServices::DataLocation ) );
        qDebug() << "Removing" << dir.path() + "/database.sqlite";
        QFile::remove( dir.path() + "/database.sqlite" );
    }
       
    createSystray();
    createDatabase();
    createMainWindow();
        
    mDataThread = &mDataThread->thread();
    connectDataThread();

    if ( update )
    {
        /*UpdateDialog* ud = new UpdateDialog( this );
        
        qDebug() << "[KUEUE] Update detected: " << Settings::appVersion() << "vs." << QApplication::applicationVersion();
        qDebug() << "[KUEUE] Updatedialog? Anything you'd like to share?";
        
        if ( ud->smthToSay() )
        {
            ud->exec();
        }
        
        qDebug() << "[KUEUE] OK, thanks. I'll delete you and rebuild the DB.";
        
        delete ud;*/
        
        Settings::setAppVersion( QApplication::applicationVersion() );
    }
    
    QShortcut* testNotification = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_N ), mWindow );
    QShortcut* newUnityTab = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_U ), mWindow );
    QShortcut* dbrebuild = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_R ), mWindow );
   
    QNetworkReply* r = Network::get( "latestkueue" );
        
    connect( r, SIGNAL( finished() ),
             this, SLOT( updateJobDone() ) );    
    connect( testNotification, SIGNAL( activated() ),
             this, SLOT( sendTestNotification() ) );
    connect( newUnityTab, SIGNAL( activated() ),
             mTabWidget, SLOT( addUnityBrowser() ) );
    connect( dbrebuild, SIGNAL( activated() ),
             this, SLOT( newDB() ) );
}
Beispiel #7
0
void init_ASMount(ASFlagType flags, const char *cmd)
{
	memset( &AppState, 0x00, sizeof(AppState));
	AppState.flags = flags ;
	AppState.tileWidth = DEFAULT_TILE_WIDTH;
	AppState.tileHeight = DEFAULT_TILE_HEIGHT;

	createMainWindow();

	reloadButtons();
	AppState.volumes = create_asbidirlist (ASVolume_destroy);

	g_type_init();
	GVolumeMonitor * monitor  = g_volume_monitor_get();

	g_signal_connect_object (monitor, "mount-added",    G_CALLBACK (mount_added), NULL, 0);
  g_signal_connect_object (monitor, "mount-changed",  G_CALLBACK (mount_changed), NULL, 0);
  g_signal_connect_object (monitor, "mount-removed",  G_CALLBACK (mount_removed), NULL, 0);
  g_signal_connect_object (monitor, "volume-added",   G_CALLBACK (volume_added), NULL, 0);
  g_signal_connect_object (monitor, "volume-changed", G_CALLBACK (volume_changed), NULL, 0);
  g_signal_connect_object (monitor, "volume-removed", G_CALLBACK (volume_removed), NULL, 0);

	GList *tmp;
	GList *list = g_volume_monitor_get_volumes(G_VOLUME_MONITOR(monitor));
	show_activity ("Adding volumes...");
  for (tmp = list; tmp != NULL; tmp = tmp->next) {
		ASVolume *v = ASVolume_newGVolume (tmp->data);
		if (v)
			append_bidirelem (AppState.volumes, v);
		else 
			g_object_unref (tmp->data);
	}
  g_list_free (list);

#if 1
	show_activity ("Adding mounts...");
  list = g_volume_monitor_get_mounts(G_VOLUME_MONITOR(monitor));
  for (tmp = list; tmp != NULL; tmp = tmp->next) {
		ASVolume *v = ASVolume_newGMount (tmp->data);
		if (v)
			append_bidirelem (AppState.volumes, v);
		else 
			g_object_unref (tmp->data);
	}
  g_list_free (list);
#endif
	AppState.volumeMonitor = monitor;	
	
	redecorateVolumes ();	
}	 
Beispiel #8
0
FxMain::FxMain()
{
    FX_FUNCTION
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));

    isLoginIn = false;

    #ifndef HAVE_GUI_DEBUG_ENABLED
        loginWin = new FxLoginWindow(0);
        doSlotConnection();
        loginWin->show();
    #else
        createMainWindow();
    #endif
}
Beispiel #9
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent)
{
  setWindowTitle( "Frameless Window Helper - 3.0.0");

  mFh = new NcFramelessHelper;

  mCbFrameless = new QCheckBox( "Use Frameless Window" );
  mCbWidgetMovable = new QCheckBox( "Enable Move" );
  mCbWidgetResizable = new QCheckBox( "Enable Resize" );
  mCbUseRubberBandOnMove = new QCheckBox( "Use RubberBand on Move" );
  mCbUseRubberBandOnResize = new QCheckBox( "Use RubberBand on Resize" );

  mBtnClose = new QPushButton( "Close" );
  mBtnMainWin = new QPushButton( "MainWindow" );

  QHBoxLayout* hl = new QHBoxLayout;
  hl->addWidget(mBtnMainWin);
  hl->addStretch();
  hl->addWidget(mBtnClose);

  QVBoxLayout* vl = new QVBoxLayout;
  vl->addWidget( mCbFrameless );
  vl->addWidget( mCbWidgetMovable );
  vl->addWidget( mCbWidgetResizable );
  vl->addWidget( mCbUseRubberBandOnMove );
  vl->addWidget( mCbUseRubberBandOnResize );
  vl->addStretch();
  vl->addLayout( hl );

  this->setLayout( vl );

  createMainWindow();

  connect( mBtnMainWin, SIGNAL(clicked()), mWidget, SLOT(show()) );
  connect( mBtnClose, SIGNAL(clicked()), qApp, SLOT(closeAllWindows()) );
  connect( mCbFrameless, SIGNAL(toggled(bool)), this, SLOT(onCbFramelessToggled(bool)) );
  connect( mCbWidgetMovable, SIGNAL(toggled(bool)), this, SLOT(onCbWidgetMovableToggled(bool)) );
  connect( mCbWidgetResizable, SIGNAL(toggled(bool)), this, SLOT(onCbWidgetResizableToggled(bool)) );
  connect( mCbUseRubberBandOnMove, SIGNAL(toggled(bool)), this, SLOT(onCbUseRubberBandOnMoveToggled(bool)) );
  connect( mCbUseRubberBandOnResize, SIGNAL(toggled(bool)), this, SLOT(onCbUseRubberBandOnResizeToggled(bool)) );

  mCbFrameless->setChecked(true);//triggers the slot
}
Beispiel #10
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	MSG msg;

	top_window = GetForegroundWindow();

	trayicon_init(LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON)), APPNAME);
	trayicon_add_item(NULL, &toggleWindowVisible);
	trayicon_add_item("Exit", &exitApplication);

	main_window = createMainWindow(hInstance);
	SetTimer(main_window, 1, 500, NULL);

	is_visible = false;

	while (GetMessage(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (int)msg.wParam;
}
Beispiel #11
0
 int main(int argc, char* argv[])
{
	// Global variables init
	_frameN = 0;
	_savingSet = false;
	_freezed = false;
	_occupiedHeight = 0;
	timeout_ID = 0;
	setOptionsToDefault();
	// Parse option file parameters
	parseOptFile(_options.fileName);
	// Parse command line parameters
	parseParameters(argc, argv);
	// Setting Up Program
	setUp();

	g_print("Starting application..\n");
	
	// This is called in all GTK applications. Arguments are parsed
	// from the command line and are returned to the application.
    gtk_init (&argc, &argv);

	// create a new window
    mainWindow = createMainWindow();
	
	// Non Modal Dialogs
	saveSingleDialog = createSaveSingleDialog();
	saveSetDialog = createSaveSetDialog();
	// Shows all widgets in main Window
    gtk_widget_show_all (mainWindow);
	gtk_window_move(GTK_WINDOW(mainWindow), _options.posX, _options.posY);
	// All GTK applications must have a gtk_main(). Control ends here
	// and waits for an event to occur (like a key press or
	// mouse event).
	gtk_main ();

  return 0;
}
void Starter::onDhtDialogAccepted()
{
    createMainWindow();
}
Starter::Starter(QObject* parent) :
    QObject(parent), mainWindow(nullptr)
{
    createMainWindow();
}
/*!
    Constructor.
*/
NmApplication::NmApplication(int &argc, char *argv[], Hb::ApplicationFlags flags)
: HbApplication(argc,argv,flags),
  mMainWindow(NULL),
  mViewStack(NULL),
  mActiveViewId(NmUiViewNone),
  mUiEngine(NULL),
  mBackAction(NULL),
  mExtensionManager(NULL),
  mMbListModel(NULL),
  mServiceViewId(NmUiViewNone),
  mForegroundService(false),
  mEffects(NULL),
  mAttaManager(NULL),
  mSettingsViewLauncher(NULL),
  mViewReady(false),
  mQueryDialog(NULL),
  mBackButtonPressed(false),
  mApplicationHidden(false),
  mErrorNoteTimer(NULL),
  mActivation(NULL),
  mActivityStorage(NULL)
{
    // Load the translation file.
    QTranslator *translator = new QTranslator(this);
    QString lang = QLocale::system().name();
    QString appName = "mail_";
    QString path = "Z:/resource/qt/translations/";
    translator->load(appName + lang, path);
    installTranslator(translator);
    setApplicationName(hbTrId("txt_mail_title_mail"));
    
    mActivation = new AfActivation(this);
    mActivityStorage = new AfActivityStorage(this);
    
    quint64 accountId = 0;
    QString activateId = this->activateId();
    if (mActivation->reason() == Af::ActivationReasonActivity &&
        activateId.startsWith(NmActivityName) ) {
        QString accountIdString = activateId.mid(NmActivityName.length());
        accountId = accountIdString.toULongLong();
    }
            
    TRAP_IGNORE(mUiEngine = NmUiEngine::instance());
        
    // Create network access manager and cache for application use.
    mNetManager = new NmViewerViewNetManager(*mUiEngine);
    QNetworkDiskCache *cache = new QNetworkDiskCache();
    cache->setCacheDirectory(
        QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
    mNetManager->setCache(cache);
    
    createMainWindow();
    
    // Attachment manager can be shared between viewer and editor.
    // The application class has the ownership.
    mAttaManager = new NmAttachmentManager(*mUiEngine);
    
    mSendServiceInterface =
        new NmSendServiceInterface(NmSendServiceName, NULL, *mUiEngine, this);
    mSendServiceInterface2 =
        new NmSendServiceInterface(emailFullServiceNameSend, NULL, *mUiEngine, this);
    mUriServiceInterface =
        new NmUriServiceInterface(NULL, *mUiEngine, this);
    mMailboxServiceInterface =
        new NmMailboxServiceInterface(NULL, *mUiEngine, this);
    mViewerServiceInterface =
        new NmViewerServiceInterface(NULL, this, *mUiEngine);
    
    if(accountId != 0) {
        QVariant mailbox;
        mailbox.setValue(accountId);
        mMailboxServiceInterface->displayInboxByMailboxId(mailbox);
    }
    
    mEffects = new NmUiEffects(*mMainWindow);
    
    QObject::connect(
            mActivation, SIGNAL(activated(Af::ActivationReason, QString, QVariantHash)), 
            this, SLOT(activityActivated()));
}