Esempio n. 1
3
MainWindow::MainWindow()
{
    outputLog = new QTextEdit(this);
    outputLog->setReadOnly(true);
    outputLog->append("MTG log \n-------\n");



    //to be created a central widget
    //setCentralWidget(new QWidget());
    setCentralWidget(outputLog);
    setWindowIcon(QIcon(":/images/MTG.png"));
    //creating the menu titles
    fileMenu = menuBar()->addMenu(tr("&File"));
    //editMenu = menuBar()->addMenu(tr("&Edit"));
    analyzerMenu = menuBar()->addMenu(tr("Analyzer"));
    DMmenu = menuBar()->addMenu(tr("DataManager"));
    MMmenu = menuBar()->addMenu(tr("MaskManager"));
    viewMenu = menuBar()->addMenu(tr("&View"));
    menuBar()->addSeparator();
    helpMenu = menuBar()->addMenu(tr("&Help"));

    // creating stuff
    //warning: take care of the order you call these functions
    createDockWindows();
    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    QFile file(":/styles.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);

    setWindowTitle(tr("Matrix Tool GUI"));
    setIconSize(QSize(35,35));

    desktop = qApp->desktop();

    connect(desktop, SIGNAL(resized(int)), this, SLOT(centerMainWindowGeometry()));

    //connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), this, SLOT(raisePlotDock()));
    connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), plotWidget, SLOT(histoMatrix(QPair<matrixData*, QString>)));

    //connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)), this, SLOT(raiseEVDock()));
    connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)),eventViewer, SLOT(attachMatrixData(QPair<matrixData*, QString>)));

    //raise the involved dock when action is triggered
    connect(newDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmAllDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(saveDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));
    connect(renameDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    //
    connect(newMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(printMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(rmMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(renameMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(editMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));


    //raise the involved dock when made visible
    connect(DMviewAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(MMviewAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(plotViewAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(EVviewAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));

    //connect the log output signals
    connect(dataManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(maskManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(plotWidget, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(eventViewer, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));


    setUnifiedTitleAndToolBarOnMac(true);

}
Esempio n. 2
0
LiteApp::LiteApp()
    : m_rootPath(LiteApp::getRootPath()),
      m_applicationPath(QApplication::applicationDirPath()),
      m_toolPath(LiteApp::getToolPath()),
      m_pluginPath(LiteApp::getPluginPath()),
      m_resourcePath(LiteApp::getResoucePath()),
      m_storagePath(LiteApp::getStoragePath())
{    
    QSettings global(m_resourcePath+"/liteapp/config/global.ini",QSettings::IniFormat);
    bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
    if (storeLocal) {
        m_settings = new QSettings(m_resourcePath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
    } else {
        m_settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide",this);
    }
    m_extension = new Extension;
    m_mainwindow = new MainWindow(this);

    QString style = this->settings()->value(LITEAPP_STYLE,"sidebar").toString();
    if (style == "splitter") {
        SplitWindowStyle *style = new SplitWindowStyle(this,m_mainwindow);
        m_mainwindow->setWindowStyle(style);
    } else {
        SideWindowStyle *style = new SideWindowStyle(this,m_mainwindow);
        m_mainwindow->setWindowStyle(style);
    }

    m_toolWindowManager = new ToolWindowManager;
    m_htmlWidgetManager = new HtmlWidgetManager;
    m_actionManager = new ActionManager;
    m_projectManager = new ProjectManager;
    m_fileManager = new FileManager;
    m_editorManager = new EditorManager;
    m_mimeTypeManager = new MimeTypeManager;
    m_optionManager = new OptionManager;

    m_goProxy = new GoProxy(this);
    m_actionManager->initWithApp(this);

    m_mainwindow->createToolWindowMenu();

    m_toolWindowManager->initWithApp(this);
    m_mimeTypeManager->initWithApp(this);
    m_projectManager->initWithApp(this);
    m_fileManager->initWithApp(this);
    m_editorManager->initWithApp(this);
    m_optionManager->initWithApp(this);

    //m_mainwindow->setCentralWidget(m_editorManager->widget());
    m_mainwindow->splitter()->addWidget(m_editorManager->widget());
    //m_mainwindow->splitter()->addWidget(m_outputManager->widget());
    m_mainwindow->splitter()->setStretchFactor(0,50);
    //m_mainwindow->setStatusBar(m_outputManager->statusBar());

    m_htmlWidgetManager->addFactory(new TextBrowserHtmlWidgetFactory(this));

    m_extension->addObject("LiteApi.IMimeTypeManager",m_mimeTypeManager);
    m_extension->addObject("LiteApi.IProjectManager",m_projectManager);
    m_extension->addObject("LiteApi.IEditManager",m_editorManager);
    m_extension->addObject("LiteApi.IOptoinManager",m_optionManager);
    m_extension->addObject("LiteApi.IToolWindowManager",m_toolWindowManager);
    m_extension->addObject("LiteApi.QMainWindow",m_mainwindow);
    m_extension->addObject("LiteApi.QMainWindow.QSplitter",m_mainwindow->splitter());
    m_extension->addObject("LiteApi.IHtmlWidgetManager",m_htmlWidgetManager);

    //add actions
    connect(m_projectManager,SIGNAL(currentProjectChanged(LiteApi::IProject*)),this,SLOT(currentProjectChanged(LiteApi::IProject*)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),m_projectManager,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),m_mainwindow,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(editorModifyChanged(LiteApi::IEditor*,bool)),m_mainwindow,SLOT(editorModifyChanged(LiteApi::IEditor*,bool)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(tabAddRequest()),m_fileManager,SLOT(openEditors()));
    connect(m_editorManager,SIGNAL(editorSaved(LiteApi::IEditor*)),m_fileManager,SLOT(editorSaved(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(editorCreated(LiteApi::IEditor*)),m_fileManager,SLOT(editorCreated(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(editorAboutToClose(LiteApi::IEditor*)),m_fileManager,SLOT(editorAboutToClose(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(doubleClickedTab()),m_mainwindow,SLOT(showOrHideToolWindow()));
    connect(m_optionManager,SIGNAL(applyOption(QString)),m_fileManager,SLOT(applyOption(QString)));
    connect(m_optionManager,SIGNAL(applyOption(QString)),m_projectManager,SLOT(applyOption(QString)));
    connect(m_optionManager,SIGNAL(applyOption(QString)),this,SLOT(applyOption(QString)));

    QAction *esc = new QAction(tr("Escape"),this);
    m_actionManager->getActionContext(this,"App")->regAction(esc,"Escape","ESC");
    m_mainwindow->addAction(esc);
    connect(esc,SIGNAL(triggered()),this,SLOT(escape()));

    createActions();
    createMenus();
    createToolBars();

    m_editorManager->createActions();

    m_logOutput = new TextOutput(this);
    //m_outputManager->addOutuput(m_logOutput,tr("Console"));
    m_logAct = m_toolWindowManager->addToolWindow(Qt::BottomDockWidgetArea,m_logOutput,"eventlog",tr("Event Log"),true);
    connect(m_logOutput,SIGNAL(dbclickEvent(QTextCursor)),this,SLOT(dbclickLogOutput(QTextCursor)));

    m_optionAct = new QAction(tr("Options"),this);
    m_optionAct->setMenuRole(QAction::PreferencesRole);
    m_actionManager->setViewMenuSeparator("sep/option",true);
    m_actionManager->insertViewMenuAction(m_optionAct,"sep/option");

    connect(m_optionAct,SIGNAL(triggered()),m_optionManager,SLOT(exec()));

    this->appendLog("LiteApp","Initializing");

    m_liteAppOptionFactory = new LiteAppOptionFactory(this,this);

    m_optionManager->addFactory(m_liteAppOptionFactory);

    connect(m_goProxy,SIGNAL(stdoutput(QByteArray)),this,SLOT(goproxyDone(QByteArray)));
    connect(this,SIGNAL(key_escape()),m_mainwindow,SLOT(hideOutputWindow()));
    connect(m_mainwindow,SIGNAL(fullScreenStateChanged(bool)),m_fullScreent,SLOT(setChecked(bool)));
}
Esempio n. 3
0
RemoteOM::RemoteOM(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::RemoteOM)
{

    mapResponse[48] = "No fault";
    mapResponse[49] = "IP. Plate current too high.";
    mapResponse[50] = "HV. Plate/anode voltage too low.";
    mapResponse[51] = "SWR. Excessive reflected power.";
    mapResponse[52] = "Ig2. Screen limit exceeded.";
    mapResponse[53] = "Overdrive. Too much drive from exciter.";
    mapResponse[54] = "FWD=0, Power output is zero with drive power higher than zero.";
    mapResponse[55] = "Igmax. 1st grid current limit exceeded.";
    mapResponse[56] = "Tune. Insufficient tuning - retune PA";
    mapResponse[62] = "PA turned on.";
    mapResponse[60] = "PA turned off.";
    mapResponse[83] = "PA turned to stand by mode.";
    mapResponse[79] = "PA turned to operating mode.";
    mapResponse[76] = "List 20 last fault codes.";
    mapResponse[71] = "Reset PA succeeded.";
    mapResponse[87] = "PA is heating up. Please wait.";
    mapResponse[90] = "Operating is not possible.";
    mapResponse[84] = "Fatal fault.";

    dialog = new SettingsDialog();

    ui->setupUi(this);
    createActions();

    //Init settings if startprofile is empty
    if (startProfile.isEmpty())
    {
        dialog->FirstChoice(startProfile.remove("\""));
        startProfile = "";
    }

    QTimer *timer = new QTimer(this);
    timer->setInterval(1000);
    timer->start();
    connect(timer, SIGNAL(timeout()), this, SLOT(TimeOut()));


    ui->menu->addAction(configureAct);
    ui->menu->addAction(exitAct);
    ui->ledDrive->hide();
    ui->ledGrid->hide();
    ui->ledOperate->hide();
    ui->ledPA->hide();
    ui->ledPower->hide();
    ui->ledStdby->hide();
    ui->ledSwr->hide();
    ui->ledTune->hide();
    ui->ledFault->hide();

    connect(ui->buttonConnect, SIGNAL(clicked()), this, SLOT(connectSocket()));
    socket = new QTcpSocket(this);
    ui->buttonPower->setStatusTip(tr("Turn PA ON/OFF."));
    ui->buttonOperate->setStatusTip(tr("Turn Operate ON/OFF."));
    ui->buttonConnect->setStatusTip(tr("Connect/Disconnect to Remote OM"));

    setInfoText("Connecting to Remote OM. Please wait.");

    receiveFaults = false;

    faultTimer = new QTimer(this);
    waitTimer = new QTimer(this);
    connect(faultTimer, SIGNAL(timeout()), this, SLOT(blinkFault()));
    connect(waitTimer, SIGNAL(timeout()), this, SLOT(blinkWait()));

    //Get settings
    if (!startProfile.isEmpty())
    {
       /* dialog->SetInitialSettings();
        QString show_ip = dialog->set_ipaddress;
        QString show_port = dialog->set_port;
        ui->txtCurrentSettings->setText("Current settings: "+show_ip+":"+show_port);*/
    }

}
Esempio n. 4
0
EmercoinGUI::EmercoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("EmerCoin Wallet"));
#ifndef Q_WS_MAC
    setWindowIcon(QIcon(":icons/ppcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    manageNamesPage = new ManageNamesPage(this);

    messagePage = new MessagePage(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    centralWidget->addWidget(manageNamesPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(messagePage);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));

    // Doubleclicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    gotoOverviewPage();
}
Esempio n. 5
0
BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    unitDisplayControl(0),
    labelEncryptionIcon(0),
    labelConnectionsIcon(0),
    labelBlocksIcon(0),
    progressBarLabel(0),
    progressBar(0),
    progressDialog(0),
    appMenuBar(0),
    overviewAction(0),
    historyAction(0),
    quitAction(0),
    sendCoinsAction(0),
    sendCoinsMenuAction(0),
    usedSendingAddressesAction(0),
    usedReceivingAddressesAction(0),
    signMessageAction(0),
    verifyMessageAction(0),
    aboutAction(0),
    receiveCoinsAction(0),
    receiveCoinsMenuAction(0),
    optionsAction(0),
    toggleHideAction(0),
    encryptWalletAction(0),
    backupWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    openRPCConsoleAction(0),
    openAction(0),
    showHelpMessageAction(0),
    trayIcon(0),
    trayIconMenu(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    spinnerFrame(0)
{
    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("Namecoin Core") + " - ";
#ifdef ENABLE_WALLET
    /* if compiled with wallet support, -disablewallet can still disable the wallet */
    enableWallet = !GetBoolArg("-disablewallet", false);
#else
    enableWallet = false;
#endif // ENABLE_WALLET
    if(enableWallet)
    {
        windowTitle += tr("Wallet");
    } else {
        windowTitle += tr("Node");
    }
    windowTitle += " " + networkStyle->getTitleAddText();
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon());
    setWindowIcon(networkStyle->getTrayAndWindowIcon());
#else
    MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon());
#endif
    setWindowTitle(windowTitle);

#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
    // This property is not implemented in Qt 5. Setting it has no effect.
    // A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras.
    setUnifiedTitleAndToolBarOnMac(true);
#endif

    rpcConsole = new RPCConsole(0);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame and make it the central widget */
        walletFrame = new WalletFrame(this);
        setCentralWidget(walletFrame);
    } else
#endif // ENABLE_WALLET
    {
        /* When compiled without wallet or -disablewallet is provided,
         * the central widget is the rpc console.
         */
        setCentralWidget(rpcConsole);
    }

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    // Needs walletFrame to be initialized
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon(networkStyle);

    // Create status bar
    statusBar();

    // Disable size grip because it looks ugly and nobody needs it
    statusBar()->setSizeGripEnabled(false);

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    unitDisplayControl = new UnitDisplayStatusBarControl();
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelEncryptionIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new GUIUtil::ProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = QApplication::style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // prevents an open debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);

    // Subscribe to notifications from core
    subscribeToCoreSignals();
}
Esempio n. 6
0
NPlayer::NPlayer()
{
	qsrand((uint)QTime::currentTime().msec());
	m_settings = NSettings::instance();

	NI18NLoader::init();

	m_playbackEngine = dynamic_cast<NPlaybackEngineInterface *>(NPluginLoader::getPlugin(N::PlaybackEngine));
	m_playbackEngine->setParent(this);

#ifndef _N_NO_SKINS_
	m_mainWindow = new NMainWindow(NSkinLoader::skinUiFormFile());
#else
	m_mainWindow = new NMainWindow();
#endif

	// loading skin script
	m_scriptEngine = new NScriptEngine(this);
#ifndef _N_NO_SKINS_
	QString scriptFileName(NSkinLoader::skinScriptFile());
#else
	QString scriptFileName(":skins/native/script.js");
#endif
	QFile scriptFile(scriptFileName);
	scriptFile.open(QIODevice::ReadOnly);
	m_scriptEngine->evaluate(scriptFile.readAll(), scriptFileName);
	scriptFile.close();
	QScriptValue skinProgram = m_scriptEngine->evaluate("Main").construct();

	m_aboutDialog = NULL;
	m_logDialog = new NLogDialog(m_mainWindow);
	m_preferencesDialog = new NPreferencesDialog(m_mainWindow);
	m_volumeSlider = qFindChild<NVolumeSlider *>(m_mainWindow, "volumeSlider");
	m_coverWidget = qFindChild<QWidget *>(m_mainWindow, "coverWidget");

	m_playlistWidget = qFindChild<NPlaylistWidget *>(m_mainWindow, "playlistWidget");
	if (QAbstractButton *repeatButton = qFindChild<QAbstractButton *>(m_mainWindow, "repeatButton"))
		repeatButton->setChecked(m_playlistWidget->repeatMode());

	m_trackInfoWidget = new NTrackInfoWidget();
	QVBoxLayout *trackInfoLayout = new QVBoxLayout;
	trackInfoLayout->setContentsMargins(0, 0, 0, 0);
	trackInfoLayout->addWidget(m_trackInfoWidget);
	m_waveformSlider = qFindChild<NWaveformSlider *>(m_mainWindow, "waveformSlider");
	m_waveformSlider->setLayout(trackInfoLayout);

#ifndef _N_NO_UPDATE_CHECK_
	m_versionDownloader = new QNetworkAccessManager(this);
	connect(m_versionDownloader, SIGNAL(finished(QNetworkReply *)), this, SLOT(on_versionDownloader_finished(QNetworkReply *)));
	connect(m_preferencesDialog, SIGNAL(versionRequested()), this, SLOT(downloadVersion()));
#endif

	createActions();
	loadSettings();
	connectSignals();

#ifdef Q_WS_WIN
	NW7TaskBar::instance()->setWindow(m_mainWindow);
	NW7TaskBar::instance()->setEnabled(NSettings::instance()->value("TaskbarProgress").toBool());
	connect(m_playbackEngine, SIGNAL(positionChanged(qreal)), NW7TaskBar::instance(), SLOT(setProgress(qreal)));
#endif

#ifdef Q_WS_MAC
	NMacDock::instance()->registerClickHandler();
	connect(NMacDock::instance(), SIGNAL(clicked()), m_mainWindow, SLOT(show()));
#endif

	m_mainWindow->setTitle(QCoreApplication::applicationName() + " " + QCoreApplication::applicationVersion());
	m_mainWindow->show();
	m_mainWindow->loadSettings();
	QResizeEvent e(m_mainWindow->size(), m_mainWindow->size());
	QCoreApplication::sendEvent(m_mainWindow, &e);

	skinProgram.property("afterShow").call(skinProgram);
}
Esempio n. 7
0
void MainWindow::createBars() {
    createActions();

    qpbMain = new QProgressBar;
        qpbMain->setMaximumSize( 150, 15 );
        qpbMain->setTextVisible( 0 );

    setStatusBar(qsbMain = new QStatusBar);
        qsbMain->showMessage( tr( "Ready" ));
        qsbMain->addPermanentWidget( qpbMain );

    setMenuBar( qmbMain = new QMenuBar );
        qmbMain->addMenu( qmFile = new QMenu( tr( "&File" )));
            qmFile->addSeparator();
            qmFile->addAction( qaPrintDialog );
            qmFile->addSeparator();
            qmFile->addAction( qaExit );
        qmbMain->addMenu( qmEdit = new QMenu( tr( "&Edit" )));
            qmEdit->addActions( qagNavigation->actions ());
            qmEdit->addAction( qaSearch );
            qmEdit->addMenu (qmSubEdit = new QMenu( tr( "Languages" )));
                qmSubEdit->addActions (qagLanguages->actions ());
        qmbMain->addMenu( qmView = new QMenu( tr( "&View" )));
            qmView->addActions ( qagZoom->actions ());
        qmbMain->addMenu( qmHelp = new QMenu( tr( "&Help" )));
            qmHelp->addAction( qaAboutQt );
            qmHelp->addSeparator();
            qmHelp->addAction( qaAbout );

    qtbDeleteSearch = new QToolButton(this);
        qtbDeleteSearch->setDefaultAction( qaClearSearch );
        qtbDeleteSearch->setToolTip( "Clear" );
        qtbDeleteSearch->setFocusPolicy( Qt::NoFocus );

    qleSearch = new QLineEdit;
        connect( qleSearch, SIGNAL( returnPressed ()), this, SLOT( lineSearch ()));
        connect( qleSearch, SIGNAL( returnPressed ()), this, SLOT( setSearchWord ()));

#if ( QT_VERSION >= 0x040700 )
        qleSearch->setPlaceholderText( tr( "Search" ));
#endif

    QSqlTableModel qstm;
        qstm.setTable("searchWords"); // table name
        qstm.removeColumn(0); // remove the id column
        qstm.removeColumn(2); // remove the numberofused column
        qstm.select();

    QCompleter::CompletionMode mode = QCompleter::InlineCompletion; // a new completer mode
    QCompleter *qcSearchWordHelp = new QCompleter(&qstm);
	qcSearchWordHelp->setCompletionMode(mode); // set the mode 
    qleSearch->setCompleter(qcSearchWordHelp);

    qtbMain = new QToolBar( "Toolbar" );
	qtbMain->setFloatable( false );
	qtbMain->setMovable( false );
        qtbMain->addAction( qaHome );
        qtbMain->addSeparator();
        qtbMain->addActions( qagNavigation->actions ());
	qtbMain->addSeparator();
	qtbMain->addWidget( qtbDeleteSearch );
        qtbMain->addWidget( qleSearch );
        addToolBar( qtbMain );
}
Esempio n. 8
0
/*!
 * Конструктор класса DaemonUi.
 */
DaemonUi::DaemonUi(QWidget *parent)
  : QDialog(parent, Qt::Tool)
  , m_core(0)
  , m_feeds(0)
  , m_plugins(0)
  , m_pool(0)
  , m_storage(0)
{
  Path::init(LS("schatd2"));

  m_settings = new Settings(Path::data() + LS("/schatd2.conf"), this);

  loadTranslation();

  m_toolBar = new QToolBar(this);
  m_toolBar->setIconSize(QSize(22, 22));
  m_toolBar->setStyleSheet(LS("QToolBar{margin:0px;border:0px;}"));

  m_menu = new QMenu();

  createActions();
  createButtons();

  m_controlGroup = new QGroupBox(this);
  QHBoxLayout *controlGroupLay = new QHBoxLayout(m_controlGroup);
  controlGroupLay->addWidget(m_toolBar);
  controlGroupLay->setMargin(2);
  controlGroupLay->setSpacing(0);

  // Отображение статуса
  m_statusLabel = new QLabel(this);
  m_ledLabel = new QLabel(this);
  m_statusGroup = new QGroupBox(this);
  QHBoxLayout *statusGroupLay = new QHBoxLayout(m_statusGroup);
  statusGroupLay->setMargin(2);
  statusGroupLay->setSpacing(0);
  statusGroupLay->addWidget(m_statusLabel);
  statusGroupLay->addStretch();
  statusGroupLay->addWidget(m_ledLabel);

  QHBoxLayout *controlLay = new QHBoxLayout;
  controlLay->addWidget(m_controlGroup);
  controlLay->addWidget(m_statusGroup);

  m_siteBtn = new QToolButton(this);
  m_siteBtn->setStyleSheet(LS("QToolButton{color:#0066cc;background:none;border:none} QToolButton:hover{text-decoration:underline}"));
  m_siteBtn->setText("schat.me");
  m_siteBtn->setFocusPolicy(Qt::NoFocus);
  m_siteBtn->setCursor(Qt::PointingHandCursor);
  m_siteBtn->setIcon(QIcon(":/images/globe-blue.png"));
  m_siteBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

  // Кнопки внизу окна
  QHBoxLayout *bottomLay = new QHBoxLayout;
  bottomLay->addWidget(m_siteBtn);
  bottomLay->addStretch();
  bottomLay->addWidget(m_hideButton);
  bottomLay->addWidget(m_quitButton);

  // Все основные виджеты
  QVBoxLayout *bodyLay = new QVBoxLayout;
  bodyLay->setMargin(6);
  bodyLay->setSpacing(6);
  bodyLay->addLayout(controlLay);
  bodyLay->addLayout(bottomLay);

  // Надпись вверху окна
  m_aboutLabel = new QLabel(QString(
      "<html><body style='color:#333;margin:6px;'>"
      "<h4 style='margin-bottom:0px;'>Simple Chat Daemon %1</h4>"
      "<p style='margin-left:16px;margin-top:5px;'>Copyright © 2008-%2 Alexander Sedov &lt;<a href='mailto:[email protected]' style='color:#0066cc;'>[email protected]</a>&gt;</p>"
      "</body></html>").arg(SCHAT_VERSION).arg(QDateTime::currentDateTime().toString("yyyy")), this);
  m_aboutLabel->setStyleSheet("background:#fff; border:4px solid #fff;");
  m_aboutLabel->setOpenExternalLinks(true);

  QFrame *line2 = new QFrame(this);
  line2->setFrameShape(QFrame::HLine);
  line2->setFrameShadow(QFrame::Sunken);

  // End
  QVBoxLayout *mainLay = new QVBoxLayout(this);
  mainLay->setMargin(0);
  mainLay->setSpacing(0);
  mainLay->addWidget(m_aboutLabel);
  mainLay->addWidget(line2);
  mainLay->addLayout(bodyLay);

  createTray();
  setState(Unknown);

  setWindowIcon(QIcon(":/images/schat16-green.png"));

  retranslateUi();

  QTimer::singleShot(0, this, SLOT(init()));

  connect(m_siteBtn, SIGNAL(clicked()), SLOT(openSite()));
}
Esempio n. 9
0
ProfileWidget::ProfileWidget(RegisteredUser *user, MainWindow* mw, QWidget *parent) : QWidget(parent)
{

    m_parent = mw;

    //Create the buttons
    m_giftButton = new QPushButton("Gift to a friend");
    m_giftButton->setMaximumSize(QSize(200, 50));
    m_showHistory = new QPushButton("Show my history");
    m_showHistory->setMaximumSize(QSize(200,50));
    m_hideHistory = new QPushButton("Hide the History Table");
    m_hideHistory->setMaximumSize(QSize(200, 50));
    m_submitGift = new QPushButton("Send this gift");
    m_submitGift->setMaximumSize(200, 50);
    m_counteroffer = new QPushButton("Show Upload Requests");
    m_counteroffer->setMaximumSize(200, 50);
    m_hideCOTable = new QPushButton("Hide Upload Requests");
    m_hideCOTable->setMaximumSize(200, 50);
    m_approveButton = new QPushButton("Accept");
    m_approveButton->setMaximumSize(QSize(250, 50));
    m_declineButton = new QPushButton("Decline");
    m_declineButton->setMaximumSize(QSize(250, 50));

    //Create the History Table
    m_historyText = new QTableWidget();
    m_user=user;
    HistoryDB *db=new HistoryDB();
    int row = db->getHistoryRow(user->getUsername());

    m_historyText->setRowCount(row+2);
    m_historyText->setColumnCount(1);
    m_historyText->setHorizontalHeaderLabels(QStringList() << "Recently Viewed");
    m_historyText->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    m_historyText->setEditTriggers(QAbstractItemView::NoEditTriggers);

    for(int i = 1; i <= row; ++i)
    {
        m_historyText->setRowHidden(0, true);
        m_historyText->setRowHidden(1, true);
        m_historyText->verticalHeader()->setVisible(false);
        QString s = db->getHistory(user->getUsername(),i-1);
        m_historyText->setItem(i, 1, new QTableWidgetItem(s));
    }

    //Create the Approve/Decline Counter Offer Table
    m_counterofferTable = new QTableWidget();
    m_counterofferTable->setColumnCount(DECLINE+1);
    m_counterofferTable->setHorizontalHeaderLabels(QStringList() << "UID" << "DOC Title" << "Asking Price" <<
                                                   "Counter Offer"<<"Accept"<<"Decline");
    m_counterofferTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    m_counterofferTable->setEditTriggers(QAbstractItemView::NoEditTriggers);

    //Create the Line Edit
    m_sendCredits = new QLineEdit();
    m_sendCredits->setPlaceholderText("Enter an amount here, has to be an integer");
    m_sendCredits->setMaximumSize(QSize(300, 50));

    //Create the Combo Box
    m_userList = new QComboBox();
    QSqlQuery user_list = user->getAllUsers();
    while (user_list.next())
    {
        QString am_user(user_list.value(0).toString());
        if (am_user == user->getUsername())
            continue;
        else
            m_userList->addItem(am_user);
    }

    //Create the label
    m_creditLabel = new QLabel("Remaining Credits: " + QString::number(user->getNumOfCredits()));
    m_complaintLabel = new QLabel("Number of Deleted Books: " + QString::number(user->getNumOfDeletedBooks()));
    m_datecreateLabel = new QLabel("Member Since: " + user->getDateCreated());

    //Create the Layout
    QVBoxLayout *QV=new QVBoxLayout();
    giftLayout = new QHBoxLayout();
    giftLayout->addWidget(m_userList);
    giftLayout->addWidget(m_sendCredits);
    giftLayout->addWidget(m_submitGift);
    QV->addWidget(new QLabel("Username: " + user->getUsername()));
    QV->addWidget(m_creditLabel);
    QV->addWidget(m_complaintLabel);
    QV->addWidget(m_datecreateLabel);
    QV->addWidget(m_giftButton);
    QV->addLayout(giftLayout);
    QV->addWidget(m_showHistory);
    QV->addWidget(m_hideHistory);
    QV->addWidget(m_counteroffer);
    QV->addWidget(m_historyText);
    QV->addWidget(m_hideCOTable);
    QV->addWidget(m_counterofferTable);
    QV->setAlignment(Qt::AlignTop);

    setLayout(QV);

    createActions();
    populateTable();

    //Hide the gift layout and history table
    m_hideCOTable->hide();
    m_counterofferTable->hide();
    m_hideHistory->hide();
    m_historyText->hide();
    m_userList->hide();
    m_sendCredits->hide();
    m_submitGift->hide();
}
Esempio n. 10
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(840, 550);
    setWindowTitle(tr("Global ") + tr("Wallet"));


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
	QApplication::setStyle(QStyleFactory::create("Fusion"));

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();
//    QFile style(":/styles/styles");
//    style.open(QFile::ReadOnly);
//    qApp->setStyleSheet(QString::fromUtf8(style.readAll()));
//    setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(210,192,123);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(210,192,123); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(210,192,123) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(210,192,123); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); } QMenuBar { background: rgb(210,192,123); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); }");
    qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(63,109,186);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:rgb(63,109,186); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(63,109,186); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(63,109,186), stop: 1 rgb(216,252,251),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(63,109,186) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(63,109,186); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); } QMenuBar { background: rgb(63,109,186); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); }");


//#ifdef Q_OS_MAC
//    toolbar->setStyleSheet("QToolBar { background-color: transparent; border: 0px solid black; padding: 3px; }");
//#endif
    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons

    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();


    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #007FFF, stop: 1 #3B5998); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
	
	
	
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
    toolbar2->setIconSize(QSize(28,28));
    toolbar2->addWidget(labelEncryptionIcon);
    toolbar2->addWidget(labelStakingIcon);
    toolbar2->addWidget(labelConnectionsIcon);
    toolbar2->addWidget(labelBlocksIcon);
    toolbar2->setStyleSheet("#toolbar2 QToolButton { border:none;padding:0px;margin:0px;height:20px;width:28px;margin-top:36px; }");
//    toolbar2->setStyleSheet(QString::fromUtf8(style.readAll()));
	
	addToolBarBreak(Qt::TopToolBarArea);
    QToolBar *toolbar3 = addToolBar(tr("Green bar"));
    addToolBar(Qt::TopToolBarArea,toolbar3);
    toolbar3->setOrientation(Qt::Horizontal);
    toolbar3->setMovable( false );
    toolbar3->setObjectName("toolbar3");
    toolbar3->setFixedHeight(2);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 11
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    setFixedSize(970, 550);
	QFontDatabase::addApplicationFont(":/fonts/Bebas");
    setWindowTitle(tr("Pentacoin") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #spacer { background: transparent;border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; background-color: transparent; } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background-color: qlineargradient(spread:pad, x1:0.511, y1:1, x2:0.482909, y2:0, stop:0 rgba(232,232,232), stop:1 rgba(232,232,232)); color: black; padding-bottom:10px; } QMenu::item { color: black; background: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); } QMenuBar { background-color: white; color: white; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; background-color: white; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);
    masternodeManagerPage = new MasternodeManager(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    centralWidget->addWidget(masternodeManagerPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
    toolbar2->setIconSize(QSize(28,54));
	toolbar2->addWidget(labelEncryptionIcon);
	toolbar2->addWidget(labelStakingIcon);
    toolbar2->addWidget(labelConnectionsIcon);
    toolbar2->addWidget(labelBlocksIcon);
	toolbar2->setStyleSheet("#toolbar2 QToolButton { background: transparent;border:none;padding:0px;margin:0px;height:54px;width:28px; }");
	
    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 12
0
PdfViewer::PdfViewer()
    : QMainWindow()
	, m_currentPage(0)
	, m_showMenuBar(false)
	, m_reloadTimer(0)
	, m_findWidget(0)
{
//QTime t = QTime::currentTime();
    setWindowTitle(QCoreApplication::applicationName());

	// set icon theme search paths
    QStringList themeSearchPaths;
    themeSearchPaths << QDir::homePath() + "/.local/share/icons/";
    themeSearchPaths << QIcon::themeSearchPaths();
    QIcon::setThemeSearchPaths(themeSearchPaths);

	// setup shortcut handler
#ifndef QT_NO_SHORTCUT
	ShortcutHandler *shortcutHandler = new ShortcutHandler(this);
#endif // QT_NO_SHORTCUT
	QSettings *settingsObject = new QSettings(this);
#ifndef QT_NO_SHORTCUT
	shortcutHandler->setSettingsObject(settingsObject);
#endif // QT_NO_SHORTCUT

	// setup recent files menu
	m_fileOpenRecentAction = new RecentFilesAction(Icon("document-open-recent"), tr("Open &Recent", "Action: open recent file"), this);
	m_fileOpenRecentAction->setSettingsObject(settingsObject);
	connect(m_fileOpenRecentAction, SIGNAL(fileSelected(QString)), this, SLOT(slotLoadDocument(QString)));

	// setup the main view
	m_pdfView = new PdfView(this);
	connect(m_pdfView, SIGNAL(scrollPositionChanged(qreal,int)), this, SLOT(slotViewScrollPositionChanged(qreal,int)));
	connect(m_pdfView, SIGNAL(openTexDocument(QString,int)), this, SLOT(slotOpenTexDocument(QString,int)));
	connect(m_pdfView, SIGNAL(mouseToolChanged(PdfView::MouseTool)), this, SLOT(slotSelectMouseTool(PdfView::MouseTool)));


	// setup the central widget
	QWidget *mainWidget = new QWidget(this);
	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(m_pdfView);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->setSpacing(0);
	mainWidget->setLayout(mainLayout);
	setCentralWidget(mainWidget);

	createActions(); // must happen after the setup of m_pdfView
	QSettings settings;
	settings.beginGroup("MainWindow");
	m_showMenuBar = settings.value("ShowMenuBar", false).toBool();
	settings.endGroup();
	if (m_showMenuBar)
	{
		createMenus();
		createToolBars();
	}
	else
		createToolBarsWhenNoMenuBar();
	createDocks();

    Q_FOREACH(DocumentObserver *obs, m_observers) {
        obs->m_viewer = this;
    }

    // activate AA by default
    m_settingsTextAAAction->setChecked(true);
    m_settingsGfxAAAction->setChecked(true);

	// watch file changes
	m_watcher = new QFileSystemWatcher(this);
    // commented out by amkhlv:
    // connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(slotReloadWhenIdle(QString)));

	// setup presentation view (we must do this here in order to have access to the shortcuts)
	m_presentationWidget = new PresentationWidget;
	connect(m_presentationWidget, SIGNAL(pageChanged(int)), this, SLOT(slotGoToPage(int)));
	connect(m_presentationWidget, SIGNAL(doAction(Poppler::LinkAction::ActionType)), this, SLOT(slotDoAction(Poppler::LinkAction::ActionType)));

	readSettings();
	m_pdfView->setFocus();
//qCritical() << t.msecsTo(QTime::currentTime());
}
Esempio n. 13
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    toolbar(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    nWeight(0)
{
    resize(970, 550); 
    setWindowTitle(tr("SatoshiChain") + " - " + tr("Wallet"));
    qApp->setStyleSheet("QMainWindow { background-image: url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #spacer { background:rgb(200,200,200);border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:0px;padding-bottom:0px; background: rgb(104,104,104); } #toolbar { border:1px;height:100%;padding-top:20px; background: rgb(200,200,200); text-align: left; color: black;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(200,200,200), stop: 1 rgb(104,104,104),stop: 2 rgb(104,104,104));}"
#ifdef Q_OS_MAC
"QToolBar QToolButton { font-family:sans-serif;font-size:12px;padding-left:20px;padding-right:45px;padding-top:5px;padding-bottom:5px; width:100%; color: rgb(104,104,104); text-align: left; background-color: rgb(200,200,200);  }"
#else
"QToolBar QToolButton { font-family:sans-serif;font-size:12px;padding-left:20px;padding-right:150px;padding-top:5px;padding-bottom:5px; width:100%; color: rgb(104,104,104); text-align: left; background-color: rgb(200,200,200);  }"
#endif
"#labelMiningIcon { padding-left:5px;font-family:sans-serif;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background: rgb(200,200,200); color:black; padding-bottom:10px; } QMenu::item { color:black; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(200,200,200), stop: 1 rgb(200,200,200)); } QMenuBar { background: rgb(200,200,200); color:black; } QMenuBar::item { font-size:12px;padding-bottom:6px;padding-top:6px;padding-left:15px;padding-right:15px;color:black; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(200,200,200), stop: 1 rgb(200,200,200)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    //transactionsPage = new QWidget(this);
    //QVBoxLayout *vbox = new QVBoxLayout();
    //transactionView = new TransactionView(this);
    //vbox->addWidget(transactionView);
    //transactionsPage->setLayout(vbox);

    //addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    //receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    //sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralStackedWidget = new QStackedWidget(this);
    centralStackedWidget->addWidget(overviewPage);
    //centralStackedWidget->addWidget(transactionsPage);
    //centralStackedWidget->addWidget(addressBookPage);
    //centralStackedWidget->addWidget(receiveCoinsPage);
    //centralStackedWidget->addWidget(sendCoinsPage);

    QWidget *centralWidget = new QWidget();
    QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);
#ifndef Q_OS_MAC
    centralLayout->addWidget(appMenuBar);
#endif
    centralLayout->addWidget(centralStackedWidget);

    setCentralWidget(centralWidget);

    // Status bar notification icons

    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    //actionConvertIcon = new QAction(QIcon(":/icons/statistics"), tr(""), this);

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

	// Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
    toolbar2->setIconSize(QSize(28,28));
	//toolbar2->addAction(actionConvertIcon);
    toolbar2->addWidget(labelEncryptionIcon);
    toolbar2->addWidget(labelStakingIcon);
    toolbar2->addWidget(labelConnectionsIcon);
    toolbar2->addWidget(labelBlocksIcon);
    	
	syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    //connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    //connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
    // prevents an oben debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    //connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    //connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 14
0
LiteEditor::LiteEditor(LiteApi::IApplication *app)
    : m_liteApp(app),
      m_extension(new Extension),
      m_completer(0),
      m_funcTip(0),
      m_bReadOnly(false)
{
    m_widget = new QWidget;
    m_editorWidget = new LiteEditorWidget(app,m_widget);
    m_editorWidget->setCursorWidth(2);
    //m_editorWidget->setAcceptDrops(false);
    m_defEditorPalette = m_editorWidget->palette();

    createActions();
    createToolBars();
    createMenu();

    m_editorWidget->setContextMenu(m_contextMenu);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);
/*
    m_toolBar->setStyleSheet("QToolBar {border: 1px ; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #eeeeee, stop: 1 #ababab); }"\
                             "QToolBar QToolButton { border:1px ; border-radius: 1px; }"\
                             "QToolBar QToolButton::hover { background-color: #ababab;}"\
                             "QToolBar::separator {width:2px; margin-left:2px; margin-right:2px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dedede, stop: 1 #a0a0a0);}");
*/
    QHBoxLayout *toolLayout = new QHBoxLayout;
    toolLayout->setMargin(0);
    toolLayout->setSpacing(0);
    toolLayout->addWidget(m_toolBar);
    toolLayout->addWidget(m_infoToolBar);

    layout->addLayout(toolLayout);
//    QHBoxLayout *hlayout = new QHBoxLayout;
//    hlayout->addWidget(m_editorWidget);
//    hlayout->addWidget(m_editorWidget->navigateArea());
    //layout->addLayout(hlayout);
    layout->addWidget(m_editorWidget);
    m_widget->setLayout(layout);
    m_file = new LiteEditorFile(m_liteApp,this);
    m_file->setDocument(m_editorWidget->document());

//    QTextOption option =  m_editorWidget->document()->defaultTextOption();
//    option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
//    option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
//    option.setTabs(tabs);

//    m_editorWidget->document()->setDefaultTextOption(option);

    setEditToolbarVisible(true);

    connect(m_file->document(),SIGNAL(modificationChanged(bool)),this,SIGNAL(modificationChanged(bool)));
    connect(m_file->document(),SIGNAL(contentsChanged()),this,SIGNAL(contentsChanged()));
    connect(m_liteApp->optionManager(),SIGNAL(applyOption(QString)),this,SLOT(applyOption(QString)));
    connect(m_liteApp->editorManager(),SIGNAL(colorStyleSchemeChanged()),this,SLOT(loadColorStyleScheme()));
    connect(m_liteApp->editorManager(),SIGNAL(editToolbarVisibleChanged(bool)),this,SLOT(setEditToolbarVisible(bool)));

    //applyOption("option/liteeditor");

    m_extension->addObject("LiteApi.ITextEditor",this);
    m_extension->addObject("LiteApi.ILiteEditor",this);
    m_extension->addObject("LiteApi.QToolBar",m_toolBar);
    m_extension->addObject("LiteApi.QPlainTextEdit",m_editorWidget);
    m_extension->addObject("LiteApi.ContextMenu",m_contextMenu);
    m_extension->addObject("LiteApi.Menu.Edit",m_editMenu);

    m_editorWidget->installEventFilter(m_liteApp->editorManager());
    connect(m_editorWidget,SIGNAL(cursorPositionChanged()),this,SLOT(editPositionChanged()));
    connect(m_editorWidget,SIGNAL(navigationStateChanged(QByteArray)),this,SLOT(navigationStateChanged(QByteArray)));
    connect(m_editorWidget,SIGNAL(overwriteModeChanged(bool)),m_overInfoAct,SLOT(setVisible(bool)));
    connect(m_editorWidget,SIGNAL(requestFontZoom(int)),this,SLOT(requestFontZoom(int)));
    connect(m_editorWidget,SIGNAL(updateLink(QTextCursor)),this,SIGNAL(updateLink(QTextCursor)));
    connect(m_lineInfo,SIGNAL(doubleClickEvent()),this,SLOT(gotoLine()));
    connect(m_closeEditorAct,SIGNAL(triggered()),m_liteApp->editorManager(),SLOT(closeEditor()));
}
Esempio n. 15
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow) {
  ui->setupUi(this);

  QFile styleFile(":/style.css");
  styleFile.open(QFile::ReadOnly);
  QString styleSheet = QLatin1String(styleFile.readAll());
  qApp->setStyleSheet(styleSheet);

  QPixmap window_icon;
  QFile iconFile(":/icon.png");
  iconFile.open(QFile::ReadOnly);
  QByteArray icon_data = iconFile.readAll();
  window_icon.loadFromData(icon_data);
  qApp->setWindowIcon(QIcon(window_icon));

  awesome = new QtAwesome(qApp);
  settings = new Settings(this);
  window_watcher = new WindowWatcher(this);
  anitomy = new AnitomyWrapper();
  event_timer = new QTimer(this);
  watch_timer = new QTimer(this);
  uptime_timer = new QElapsedTimer;
  progress_bar = new QProgressBar(ui->statusBar);
  over = new Overlay(this);
  torrent_refresh_time = 0;
  user_refresh_time =
      settings->getValue(Settings::UserRefreshTime, D_USER_REFRESH_TIME)
          .toInt();
  download_rule = 0;
  download_count = 0;
  hasUser = false;

  uptime_timer->start();
  watch_timer->setSingleShot(true);

  awesome->initFontAwesome();

  bool check_for_updates =
      settings->getValue(Settings::CheckUpdates, D_CHECK_FOR_UPDATES).toBool();

  if (check_for_updates) {
    connect(FvUpdater::sharedUpdater(), &FvUpdater::restartRequested,
            [&]() {  // NOLINT
              QString app = QApplication::applicationFilePath();
              QStringList arguments = QApplication::arguments();
              QString wd = QDir::currentPath();
              QProcess::startDetached(app, arguments, wd);
              elegantClose(true);
            });

    FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
  }

  QFont font = ui->listTabs->tabBar()->font();
  font.setCapitalization(QFont::Capitalize);
  ui->listTabs->tabBar()->setFont(font);

  int currentYear = QDate::currentDate().year();
  int lowerYear = currentYear - 10;

  while (currentYear > lowerYear) {
    ui->comboYear->addItem(QString::number(currentYear));
    currentYear--;
  }

  QWidget *container = new QWidget(ui->scrollArea);
  layout = new FlowLayout(container);
  ui->scrollArea->setWidget(container);
  container->setLayout(layout);

  QWidget *container2 = new QWidget(ui->scrollArea_2);
  layout2 = new FlowLayout(container2);
  layout2->disableSort();
  ui->scrollArea_2->setWidget(container2);
  container2->setLayout(layout2);

  QVariantMap black;
  black.insert("color", QColor(0, 0, 0));
  black.insert("color-active", QColor(0, 0, 0));
  black.insert("color-disabled", QColor(0, 0, 0));
  black.insert("color-selected", QColor(0, 0, 0));

  ui->airingButton->setIcon(awesome->icon(fa::clocko, black));
  ui->torrentsButton->setIcon(awesome->icon(fa::rss, black));
  ui->animeButton->setIcon(awesome->icon(fa::bars, black));
  ui->seasonsButton->setIcon(awesome->icon(fa::th, black));
  ui->statisticsButton->setIcon(awesome->icon(fa::piechart, black));

  ui->tabWidget->tabBar()->hide();
  ui->tabWidget->setCurrentIndex(UserTabs::tAnime);
  ui->listTabs->setCurrentIndex(0);

  ui->statusBar->addWidget(progress_bar);
  ui->statusBar->layout()->setContentsMargins(1, 0, 0, 0);
  progress_bar->setRange(0, 100);
  progress_bar->setValue(5);
  progress_bar->setFormat("Authorizing");

  QSettings s;
  restoreGeometry(s.value("mainWindowGeometry").toByteArray());
  restoreState(s.value("mainWindowState").toByteArray());

  connect(&user_future_watcher, SIGNAL(finished()), SLOT(userLoaded()));
  connect(&user_list_future_watcher, SIGNAL(finished()),
          SLOT(userListLoaded()));

  connect(ui->animeButton, SIGNAL(clicked()), SLOT(showAnimeTab()));
  connect(ui->airingButton, SIGNAL(clicked()), SLOT(showAiringTab()));
  connect(ui->torrentsButton, SIGNAL(clicked()), SLOT(showTorrentsTab()));
  connect(ui->seasonsButton, SIGNAL(clicked()), SLOT(showBrowseTab()));
  connect(ui->actionSettings, SIGNAL(triggered()), SLOT(showSettings()));
  connect(ui->statisticsButton, SIGNAL(clicked()), SLOT(showStatisticsTab()));

  connect(ui->actionExit, &QAction::triggered, [&, this]() {  // NOLINT
    this->elegantClose();
  });

  connect(ui->actionAbout, &QAction::triggered, [&, this]() {  // NOLINT
    About *about = new About(this);
    about->show();
  });

  connect(ui->actionHelp, &QAction::triggered, [&, this]() {  // NOLINT
    QDesktopServices::openUrl(QUrl("http://app.shinjiru.me/support.php"));
  });

  connect(ui->actionRL, &QAction::triggered, [&, this]() {  // NOLINT
    loadUser();
  });

  connect(ui->actionAS, &QAction::triggered, [&]() {  // NOLINT
    SearchPanel *sp = new SearchPanel(this);
    sp->show();
  });

  connect(ui->actionARR, &QAction::triggered, [&, this]() {  // NOLINT
    SettingsDialog *s = new SettingsDialog(this);
    s->showSmartTitles();

    connect(s, &QDialog::accepted, [&, this]() {  // NOLINT
      Settings set;

      toggleAnimeRecognition(
          set.getValue(Settings::AnimeRecognitionEnabled, D_ANIME_RECOGNITION)
              .toBool());

      torrents_enabled =
          set.getValue(Settings::TorrentsEnabled, D_TORRENTS_ENABLED).toBool();

      reloadSmartTitles();
      reloadRules();
    });
  });

  connect(qApp, SIGNAL(aboutToQuit()), SLOT(elegantClose()));

  connect(ui->actionVAL, SIGNAL(triggered()), SLOT(viewAnimeList()));
  connect(ui->actionVD, SIGNAL(triggered()), SLOT(viewDashboard()));
  connect(ui->actionVP, SIGNAL(triggered()), SLOT(viewProfile()));
  connect(ui->actionEAR, SIGNAL(triggered(bool)),
          SLOT(toggleAnimeRecognition(bool)));
  connect(ui->actionExport, SIGNAL(triggered()), SLOT(exportListJSON()));
  connect(ui->actionUpdate, SIGNAL(triggered()), FvUpdater::sharedUpdater(),
          SLOT(CheckForUpdatesNotSilent()));

  connect(window_watcher, SIGNAL(title_found(QString)), SLOT(watch(QString)));
  connect(watch_timer, SIGNAL(timeout()), SLOT(updateEpisode()));
  connect(event_timer, SIGNAL(timeout()), SLOT(eventTick()));

  connect(ui->torrentTable, SIGNAL(customContextMenuRequested(QPoint)),
          SLOT(torrentContextMenu(QPoint)));
  connect(ui->torrentFilter, SIGNAL(textChanged(QString)),
          SLOT(filterTorrents(QString)));
  connect(ui->chkHideUnknown, SIGNAL(toggled(bool)),
          SLOT(filterTorrents(bool)));
  connect(ui->refreshButton, SIGNAL(clicked()), SLOT(refreshTorrentListing()));

  connect(ui->actionEAR, SIGNAL(toggled(bool)), SLOT(applyEAR()));

  connect(ui->tabWidget, &QTabWidget::currentChanged, [&, this](  // NOLINT
                                                          int tab) {
    if (tab != 0) {
      this->over->removeDrawing("blank_table");
      this->over->removeDrawing("no anime");
      ui->listTabs->show();
      ui->listFilterLineEdit->show();
    } else {
      this->filterList(3);

      if (hasUser && (User::sharedUser()->getAnimeList().count() == 0)) {
        this->addNoAnimePrompt();
      }
    }
  });

  ui->actionEAR->setChecked(
      settings->getValue(Settings::AnimeRecognitionEnabled, D_ANIME_RECOGNITION)
          .toBool());

  this->toggleAnimeRecognition(ui->actionEAR->isChecked());

  QString genrelist =
      "Action, Adult, Adventure, Cars, Comedy, Dementia, Demons, Doujinshi, "
      "Drama, Ecchi, Fantasy, Game, Gender Bender, Harem, Hentai, Historical, "
      "Horror, Josei, Kids, Magic, Martial Arts, Mature, Mecha, Military, "
      "Motion Comic, Music, Mystery, Mythological , Parody, Police, "
      "Psychological, Romance, Samurai, School, Sci-Fi, Seinen, Shoujo, Shoujo "
      "Ai, Shounen, Shounen Ai, Slice of Life, Space, Sports, Super Power, "
      "Supernatural, Thriller, Tragedy, Vampire, Yaoi, Yuri";
  QStringList genres = genrelist.split(", ");

  for (QString genre : genres) {
    QCheckBox *chk = new QCheckBox();

    chk->setText(genre);
    chk->setTristate(true);

    ui->genreList->addWidget(chk);
  }

  connect(ui->listFilterLineEdit, SIGNAL(textChanged(QString)),
          SLOT(filterList(QString)));
  connect(ui->listFilterLineEdit, SIGNAL(returnPressed()), SLOT(showSearch()));
  connect(ui->listTabs, SIGNAL(currentChanged(int)), SLOT(filterList(int)));

  connect(ui->browseButton, SIGNAL(clicked()), SLOT(loadBrowserData()));

  this->show();
  createActions();
  initTray();
  trayIcon->show();

  int result = API::sharedAPI()->verifyAPI();

  if (result == AniListAPI::OK) {
    connect(API::sharedAPI()->sharedAniListAPI(), &AniListAPI::access_granted,
            [&, this]() {  // NOLINT
              progress_bar->setValue(10);
              progress_bar->setFormat("Access granted");
              loadUser();

              event_timer->start(1000);
            });

    connect(API::sharedAPI()->sharedAniListAPI(), &AniListAPI::access_denied,
            [&, this](QString error) {  // NOLINT
              qCritical() << error;

              if (isVisible()) {
                QMessageBox::critical(this, "Shinjiru", tr("Error: ") + error);
              }
            });
  } else if (result == AniListAPI::NO_CONNECTION) {
    qDebug() << "Starting Shinjiru in offline mode";
    hasUser = User::sharedUser()->loadLocal();
  }

  reloadRules();
}
Esempio n. 16
0
void PopupView::showContextMenu(QWidget *widget, const QPoint &screenPos, const QList<QModelIndex> &indexes)
{
    Q_UNUSED(widget)
    // contextMenuRequest is only called from the icon view, which is created in init()
    // which mean m_model should always be initialized
    Q_ASSERT(m_model);

    if (indexes.isEmpty()) {
        return;
    }

    if (m_actionCollection.isEmpty()) {
        createActions();
    }

    KFileItemList items;
    bool hasRemoteFiles = false;
    bool isTrashLink = false;

    foreach (const QModelIndex &index, m_selectionModel->selectedIndexes()) {
        KFileItem item = m_model->itemForIndex(index);
        if (!item.isNull()) {
            hasRemoteFiles |= item.localPath().isEmpty();
            items.append(item);
        }
    }

    // Check if we're showing the menu for the trash link
    if (items.count() == 1 && items.at(0).isDesktopFile()) {
        KDesktopFile file(items.at(0).localPath());
        if (file.readType() == "Link" && file.readUrl() == "trash:/") {
            isTrashLink = true;
        }
    }

    QAction *pasteTo = m_actionCollection.action("pasteto");
    if (pasteTo) {
        if (QAction *paste = m_actionCollection.action("paste")) {
            pasteTo->setEnabled(paste->isEnabled());
            pasteTo->setText(paste->text());
        }
    }

    QList<QAction*> editActions;
    editActions.append(m_actionCollection.action("rename"));

    KConfigGroup configGroup(KGlobal::config(), "KDE");
    bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);

    // Don't add the "Move to Trash" action if we're showing the menu for the trash link
    if (!isTrashLink) {
        if (!hasRemoteFiles) {
            editActions.append(m_actionCollection.action("trash"));
        } else {
            showDeleteCommand = true;
        }
    }
    if (showDeleteCommand) {
        editActions.append(m_actionCollection.action("del"));
    }

    KParts::BrowserExtension::ActionGroupMap actionGroups;
    actionGroups.insert("editactions", editActions);

    KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::ShowProperties;
    flags |= KParts::BrowserExtension::ShowUrlOperations;

    // m_newMenu can be NULL here but KonqPopupMenu does handle this.
    KonqPopupMenu *contextMenu = new KonqPopupMenu(items, m_url, m_actionCollection, m_newMenu,
                                                   KonqPopupMenu::ShowNewWindow, flags,
                                                   QApplication::desktop(),
                                                   KBookmarkManager::userBookmarksManager(),
                                                   actionGroups);

    connect(contextMenu->fileItemActions(), SIGNAL(openWithDialogAboutToBeShown()), this, SLOT(openWithDialogAboutToShow()));

    m_showingMenu = true;
    contextMenu->exec(screenPos);
    delete contextMenu;
    m_showingMenu = false;

    if (pasteTo) {
        pasteTo->setEnabled(false);
    }

    if (m_delayedClose) {
        m_delayedClose = false;
        closeThisAndParentPopup();
    }
}
Esempio n. 17
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
  setWindowTitle(tr("BitBar")+" - "+tr("Wallet")+" "+QString::fromStdString(CLIENT_BUILD));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();
menuBar()->setNativeMenuBar(false);// menubar on form instead

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    skinsPage = new SkinsPage(this);
    connect(skinsPage, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
    connect(skinsPage, SIGNAL(information(QString,QString)), this, SLOT(information(QString,QString)));
    connect(skinsPage, SIGNAL(status(QString)), this, SLOT(status(QString)));

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
	centralWidget->addWidget(skinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMintingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMintingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Set minting pixmap
    labelMintingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelMintingIcon->setEnabled(false);
    // Add timer to update minting icon
    QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
    timerMintingIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
    // Add timer to update minting weights
    QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
    timerMintingWeights->start(30 * 1000);
    connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
    // Set initial values for user and network weights
    nWeight=0;
    nNetworkWeight = 0;

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 18
0
LiteApp::LiteApp()
    : m_applicationPath(QApplication::applicationDirPath()),
      m_pluginPath(LiteApp::getPluginPath()),
      m_resourcePath(LiteApp::getResoucePath()),
      m_storagePath(LiteApp::getStoragePath()),
      m_settings(new QSettings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide",this)),
      m_extension(new Extension),
      m_mainwindow(new MainWindow(this)),
      m_toolWindowManager(new ToolWindowManager),
      m_htmlWidgetManager(new HtmlWidgetManager),
      m_actionManager(new ActionManager),
      m_projectManager(new ProjectManager),
      m_editorManager(new EditorManager),
      m_fileManager(new FileManager),
      m_mimeTypeManager(new MimeTypeManager),
      m_optionManager(new OptionManager)
{    
    m_goProxy = new GoProxy(this);
    m_actionManager->initWithApp(this);
    m_toolWindowManager->initWithApp(this);
    m_mimeTypeManager->initWithApp(this);
    m_projectManager->initWithApp(this);
    m_editorManager->initWithApp(this);
    m_fileManager->initWithApp(this);
    m_optionManager->initWithApp(this);        

    //m_mainwindow->setCentralWidget(m_editorManager->widget());
    m_mainwindow->splitter()->addWidget(m_editorManager->widget());
    //m_mainwindow->splitter()->addWidget(m_outputManager->widget());
    m_mainwindow->splitter()->setStretchFactor(0,50);
    //m_mainwindow->setStatusBar(m_outputManager->statusBar());

    m_htmlWidgetManager->addFactory(new TextBrowserHtmlWidgetFactory(this));

    m_extension->addObject("LiteApi.IMimeTypeManager",m_mimeTypeManager);
    m_extension->addObject("LiteApi.IProjectManager",m_projectManager);
    m_extension->addObject("LiteApi.IEditManager",m_editorManager);
    m_extension->addObject("LiteApi.IOptoinManager",m_optionManager);
    m_extension->addObject("LiteApi.IToolWindowManager",m_toolWindowManager);
    m_extension->addObject("LiteApi.QMainWindow",m_mainwindow);
    m_extension->addObject("LiteApi.QMainWindow.QSplitter",m_mainwindow->splitter());
    m_extension->addObject("LiteApi.IHtmlWidgetManager",m_htmlWidgetManager);

    //add actions
    connect(m_projectManager,SIGNAL(currentProjectChanged(LiteApi::IProject*)),this,SLOT(currentProjectChanged(LiteApi::IProject*)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),m_projectManager,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),m_mainwindow,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(tabAddRequest()),m_fileManager,SLOT(openEditors()));
    connect(m_editorManager,SIGNAL(editorSaved(LiteApi::IEditor*)),m_fileManager,SLOT(editorSaved(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(editorCreated(LiteApi::IEditor*)),m_fileManager,SLOT(editorCreated(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(editorAboutToClose(LiteApi::IEditor*)),m_fileManager,SLOT(editorAboutToClose(LiteApi::IEditor*)));
    connect(m_editorManager,SIGNAL(doubleClickedTab()),m_mainwindow,SLOT(showOrHideToolWindow()));
    connect(m_optionManager,SIGNAL(applyOption(QString)),m_fileManager,SLOT(applyOption(QString)));
    connect(m_optionManager,SIGNAL(applyOption(QString)),m_projectManager,SLOT(applyOption(QString)));
    connect(m_optionManager,SIGNAL(applyOption(QString)),this,SLOT(applyOption(QString)));

    QAction *esc = new QAction(tr("Escape"),this);
    m_actionManager->getActionContext(this,"App")->regAction(esc,"Escape","ESC");
    connect(esc,SIGNAL(triggered()),this,SLOT(escape()));
    m_mainwindow->addAction(esc);

    createActions();
    createMenus();
    createToolBars();

    m_editorManager->createActions();

    m_logOutput = new TextOutput(this);
    //m_outputManager->addOutuput(m_logOutput,tr("Console"));
    m_logAct = m_toolWindowManager->addToolWindow(Qt::BottomDockWidgetArea,m_logOutput,"eventlog",tr("Event Log"),true);
    connect(m_logOutput,SIGNAL(dbclickEvent(QTextCursor)),this,SLOT(dbclickLogOutput(QTextCursor)));
    m_optionAct = m_editorManager->registerBrowser(m_optionManager->browser());
    //m_viewMenu->addAction(m_optionAct);
    m_actionManager->insertViewMenu(LiteApi::ViewMenuBrowserPos,m_optionAct);
    m_optionManager->setAction(m_optionAct);

    this->appendLog("LiteApp","Initializing");

    m_liteAppOptionFactory = new LiteAppOptionFactory(this,this);

    m_optionManager->addFactory(m_liteAppOptionFactory);

    //m_projectManager->addFactory(new FolderProjectFactory(this,this));

    connect(m_goProxy,SIGNAL(done(QByteArray,QByteArray)),this,SLOT(goproxyDone(QByteArray,QByteArray)));
    connect(this,SIGNAL(key_escape()),m_mainwindow,SLOT(hideToolWindow()));
    connect(m_mainwindow,SIGNAL(fullScreenStateChanged(bool)),m_fullScreent,SLOT(setChecked(bool)));
}
Esempio n. 19
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(650, 550);
//    resize(530, 550);
    setWindowTitle(tr("LEOcoin") + " - " + tr("Wallet"));

    qApp->setStyleSheet(
                "QMainWindow { background: #e8e8e8;font-family:'Open Sans,sans-serif'; } " \
                "QCheckBox { spacing: 5px; } "\
                "QCheckBox::indicator { width: 24px; height: 24px; }" \
                "QCheckBox::indicator:unchecked { image: url(:/images/checkbox_unchecked); }" \
                "QCheckBox::indicator:checked { image: url(:/images/checkbox_checked); }" \
                "QComboBox  { border: 1px solid gray; border-radius: 3px; padding: 1px 18px 1px 3px; }" \
                "QComboBox:editable  { background: white; }" \
                "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); } " \
                "QComboBox:!editable:on, QComboBox::drop-down:editable:on  { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); } " \
                "QComboBox:on  { /* shift the text when the popup opens */ padding-top: 3px; padding-left: 4px; } " \
                "QComboBox::drop-down  { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; /* just a single line */ border-top-right-radius: 3px; /* same radius as the QComboBox */ border-bottom-right-radius: 3px; } " \
                "QComboBox::down-arrow1  { image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png); } " \
                "QComboBox::down-arrow:on  { /* shift the arrow when popup is open */ top: 1px; left: 1px; }" \
                "QLineEdit { border: 0px; border-radius1: 10px; padding: 0 8px; background: #c7c8ca; selection-background-color: #eea734; margin: 6px; }" \
                "QLabel { color: #404041; } " \
                "QTableView { background: #c7c8ca; border-color: #e8e8e8; margin: 6px; } " \
                "QTableView QHeaderView { } " \
                "QTableView QAbstractItemView { margin: 4px; min-height: 28px; border: 3px; } " \
                "QStatusBar { background: #a7aaac; } " \
                    "#frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; border: 0px; border-color: yellow;} " \
                    "#spacer { background:#a7aaac;border:none; } " \
                    "#toolbar { height:100%;padding-top:20px; background: #e8e8e8; text-align: left; min-width:200px;max-width:200px; border: none; margin: -2px; padding: -2px; } " \
                "QToolBar QToolButton { font-family:Open Sans;padding-left:0px;padding-top:10px;padding-bottom:10px; width:200px; color: black; text-align: left; background-color: #a7aaac } " \
                "QToolBar QToolButton:hover:!checked { color: #eea734; background-color: #a7aaac; border: none; } " \
                "QToolBar QToolButton:pressed { color: #404041; background-color: #e8e8e8; border: none; } " \
                "QToolBar QToolButton:checked { color: #eea734; background-color: #e8e8e8; border: none; } " \
                "QToolBar QToolButton:disabled { color: grey; } " \
                "QToolButton { color: black; background-color: #eea734; border: none; text-align: center; min-height: 24px; } " \
                    "#labelMiningIcon { padding-left:5px;font-family:Open Sans;width:100%;font-size:10px;text-align:center;color:grey; } " \
                "QMenu { background: #a7aaac; color: #404041; padding-bottom:10px; border: 1px solid grey; } " \
                "QMenu::item { color:#404041; background-color: transparent; } " \
                "QMenu::item:selected { color: #282828; background-color: #e8e8e8; } " \
                "QMenuBar { background: #a7aaac; color: #404041; } " \
                "QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:#282828; background-color: transparent; } " \
                "QMenuBar::item:selected { color: #e8e8e8; background-color: #282828); }"
                "QTabWidget {background-color: #e8e8e8; }" \
                "#debug QLabel {color: white; }" \
                "QDateTime {}"
    );


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);
    progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 0px solid grey; border-radius: 7px; padding: 1px; text-align: center; } " \
                               "QProgressBar::chunk { background: #eea734; border-radius: 7px; margin: 0px; }");

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 0px solid grey; border-radius: 7px; padding: 1px; text-align: center; } " \
                                   "QProgressBar::chunk { background: #eea734; border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);
    syncIconMovie->setScaledSize(QSize(24,24));

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 20
0
VSCDeviceTree::VSCDeviceTree(QWidget *parent)
    : QTreeWidget(parent)
{
    createActions();
}
Esempio n. 21
0
DarkSilkGUI::DarkSilkGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    toolbar(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    nWeight(0) {
    resize(1000, 600);
    setWindowTitle(tr("DarkSilk") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/darksilk"));
    setWindowIcon(QIcon(":icons/darksilk"));
#else
    //setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    QPalette p;
    p.setColor(QPalette::Window, QColor(0, 0, 0));
    p.setColor(QPalette::Text, QColor(80, 0, 120));
    setPalette(p);

    // Create tabs
    overviewPage = new OverviewPage();

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralStackedWidget = new QStackedWidget(this);
    centralStackedWidget->setContentsMargins(0, 0, 0, 0);
    centralStackedWidget->addWidget(overviewPage);

    QWidget *centralWidget = new QWidget();
    QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);

    centralLayout->setContentsMargins(0, 0, 0, 0);
    centralWidget->setContentsMargins(0, 0, 0, 0);
    centralLayout->addWidget(centralStackedWidget);

    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Disable size grip because it looks ugly and nobody needs it
    statusBar()->setSizeGripEnabled(false);

    // Status bar notification icons
    QWidget *frameBlocks = new QWidget();
    frameBlocks->setContentsMargins(0, 0, 0, 0);
    frameBlocks->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    frameBlocks->setStyleSheet("QWidget { background: none; margin-bottom: 5px; }");

    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3, 0, 3, 0);
    frameBlocksLayout->setSpacing(3);
    frameBlocksLayout->setAlignment(Qt::AlignHCenter);

    labelEncryptionIcon = new GUIUtil::ClickableLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();

#ifdef USE_NATIVE_I2P
    labelI2PConnections = new QLabel();
    labelI2POnly = new QLabel();
    labelI2PGenerated = new QLabel();

    frameBlocksLayout->addWidget(labelI2PGenerated);
    frameBlocksLayout->addWidget(labelI2POnly);
    frameBlocksLayout->addWidget(labelI2PConnections);
#endif

    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();


    if (GetBoolArg("-staking", true)) {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);

        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);

    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    if (!fUseBlackTheme) {
        // Override style sheet for progress bar for styles that have a segmented progress bar,
        // as they make the text unreadable (workaround for issue #1071)
        // See https://qt-project.org/doc/qt-4.8/gallery.html
        QString curStyle = qApp->style()->metaObject()->className();

        if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") {
            progressBar->setStyleSheet("QProgressBar { background-color: rgb(0,0,0); border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #500078, stop: 1 #500078); border-radius: 7px; margin: 0px; }");

            appMenuBar->setStyleSheet("QMenuBar { background-color: rgb(0,0,0); }");
        }
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);
    statusBar()->setObjectName("statusBar");
    statusBar()->setStyleSheet("#statusBar { background-color: qradialgradient(cx: -0.8, cy: 0, fx: -0.8, fy: 0, radius: 0.6, stop: 0 #000000, stop: 1 #000000);  }");

    syncIconMovie = new QMovie(fUseBlackTheme ? ":/movies/update_spinner_black" : ":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); // prevents an oben debug window from becoming stuck/unusable on client shutdown

    gotoOverviewPage();
}
Esempio n. 22
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
    
{
    resize(850, 550);
    setWindowTitle(tr("Zimstake") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/zimstake"));
    setWindowIcon(QIcon(":icons/zimstake"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();
    blockExplorer = new BlockExplorer(this);
	chatWindow = new ChatWindow(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(blockExplorer);
	centralWidget->addWidget(chatWindow);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        //statusBar()->setObjectName("QProgressBar");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
MainWindow::MainWindow()
{
    if (QSound::isAvailable ())
        qDebug() << "Sound Facility is available.";
    else
        qDebug() << "Sound Facility is not available.";

    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    operationChar = createRandomOperationChar();

    QFont fontMath("Arial", 60, QFont::Bold);
    QFont fontCheckButton("Arial", 30, QFont::Bold);

    leftTermLabel = new QLabel(QString::number(qrand() % MAX_OPERAND_VALUE));
    leftTermLabel->setFont(fontMath);
    operationLabel = new QLabel(operationChar);
    operationLabel->setFont(fontMath);
    rightTermLabel = new QLabel(QString::number(qrand() % MAX_OPERAND_VALUE));
    rightTermLabel->setFont(fontMath);
    equalsLabel = new QLabel("=");
    equalsLabel->setFont(fontMath);
    resultLineEdit = new QLineEdit;
    resultLineEdit->setFont(fontMath);
    connect(resultLineEdit, SIGNAL(returnPressed()), this, SLOT(handleCheckButtonPressed()));

    checkButton = new QPushButton(tr("Check my result!"));
    checkButton->setFont(fontCheckButton);
    connect(checkButton, SIGNAL(clicked()), this, SLOT(handleCheckButtonPressed()));

    resultLabel = new QLabel(tr("Press the check button to check your result..."));
    resultLabel->setFont(fontCheckButton);
    resultLabel->setAlignment(Qt::AlignCenter);

    QHBoxLayout *mathLayout = new QHBoxLayout;
    mathLayout->addWidget(leftTermLabel);
    mathLayout->addWidget(operationLabel);
    mathLayout->addWidget(rightTermLabel);
    mathLayout->addWidget(equalsLabel);
    mathLayout->addWidget(resultLineEdit);

    QVBoxLayout *totalLayout = new QVBoxLayout;
    totalLayout->addLayout(mathLayout);
    totalLayout->addWidget(checkButton);
    totalLayout->addWidget(resultLabel);

    QWidget* mainWidget = new QWidget();
    mainWidget->setLayout(totalLayout);

    setCentralWidget(mainWidget);
    setWindowTitle(tr("QSchoolIsCool: your personal school stuff trainer!"));

    createActions();
    createMenus();
    //createContextMenu();
    //createToolBars();
    //createStatusBar();

    //readSettings();

    //findDialog = 0;

    //setWindowIcon(QIcon(":/images/icon.png"));
    //setCurrentFile("");
}
Esempio n. 24
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    lockWalletToggleAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    this -> setWindowFlags ( this -> windowFlags () & ~ Qt :: WindowMaximizeButtonHint ); //disable Max window
    this -> setFixedSize(this->width(), this->height());  //diaable draw window
    setWindowTitle(tr("FundCoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    setObjectName("FundCoinWallet");
    setStyleSheet("#FundCoinWallet { background-image: url(:/images/bgsplatter) repeat-xy; } QToolTip { color: #8b12d0; background-color: #7412D0;  border:0px;} ");

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMintingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMintingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    labelEncryptionIcon->setObjectName("labelEncryptionIcon");
    labelConnectionsIcon->setObjectName("labelConnectionsIcon");
    labelBlocksIcon->setObjectName("labelBlocksIcon");
    labelMintingIcon->setObjectName("labelMintingIcon");

    labelEncryptionIcon->setStyleSheet("#labelEncryptionIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}");
    labelConnectionsIcon->setStyleSheet("#labelConnectionsIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}");
    labelBlocksIcon->setStyleSheet("#labelBlocksIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}");
    labelMintingIcon->setStyleSheet("#labelMintingIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}");

    // Set minting pixmap
    labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelMintingIcon->setEnabled(false);
    // Add timer to update minting icon
    QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
    timerMintingIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
    // Add timer to update minting weights
    QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
    timerMintingWeights->start(30 * 1000);
    connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
    // Set initial values for user and network weights
    nWeight, nNetworkWeight = 0;

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);
    statusBar()->setObjectName("FundCoinStatusBar");
    statusBar()->setStyleSheet("#FundCoinStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:0.5 #8b12d0, stop:1.0 #7412d0); border-top-width: 1px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412d0); color: #aadda6; } QToolTip { color: #e1eee1; background-color: #0fc42c; border:0px;}");
  //statusBar()->setStyleSheet("#FundCoinStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:0.5 #8b12d0, stop:1.0 #7412d0); border-top-width: 1px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #主色,   stop:1.0 #过度色); color: #8b12d0; } QToolTip { color: #8b12d0; background-color: #7412d0; border:0px;}");

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
    // this->setStyleSheet("background-color: #8b12d0;");

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 25
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("EBT") + " - " + tr("Wallet"));
    this->setStyleSheet("QMainWindow {background-color: white;} "
                        "SendCoinsEntry {background-color: white;} "
                        "transactionView {background-color: white;} "
                        "TransactionView {background-color: white;}");

#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 26
0
void ProfileManager::profileInit()
{
  setModal(true);
  resize(370, 170);
  setWindowIcon(QIcon("icons/backupsoft.png"));

  name = new QLabel(tr("Name"), this);
  name->setGeometry(10,10,100,20);
  nameField = new QLineEdit(this);
  nameField->setGeometry(100,10,150,20);

  source = new QLabel(tr("Source"), this);
  source->setGeometry(10,40,100,20);
  sourceField = new QLineEdit(this);
  sourceField->setGeometry(100,40,150,20);

  destination = new QLabel(tr("Destination"), this);
  destination->setGeometry(10,70,100,20);
  destinationField = new QLineEdit(this);
  destinationField->setGeometry(100,70,150,20);

  sourceBrowseButton = new QPushButton(tr("&Browse..."), this);
  sourceBrowseButton->setGeometry(250,40,100,20);
  destinationBrowseButton = new QPushButton(tr("&Browse..."), this);
  destinationBrowseButton->setGeometry(250,70,100,20);

  stateBox = new QCheckBox(tr("Activated"), this);
  stateBox->setGeometry(100, 100, 250, 20);

  cancelButton = new QPushButton(tr("&Cancel"), this);

  if(origin == 1) { // for a new Profile
    setWindowTitle(tr("New Profile"));

    saveButton = new QPushButton(tr("&Save"), this);
    saveButton->setEnabled(false);

    stateBox->setChecked(true); // default
  }

  if(origin == 2) {
    extractedInfo = profile.split('|', QString::SkipEmptyParts);
    setWindowTitle(tr("Edit Profile"));

    saveButton = new QPushButton(tr("&Edit"), this);
    saveButton->setEnabled(true);

    nameField->setText(extractedInfo.value(0));
    sourceField->setText(extractedInfo.value(1));
    destinationField->setText(extractedInfo.value(2));

    bool isActivated = extractedInfo.at(3) == tr("Activated");
    stateBox->setChecked(isActivated);
  }

#ifdef _WIN32
  saveButton->setGeometry(150,130,100,30);
  cancelButton->setGeometry(250,130,100,30);
#else
  saveButton->setGeometry(250,130,100,30);
  cancelButton->setGeometry(150,130,100,30);
#endif

  createActions();
}
Esempio n. 27
0
static Logfile *
logfile_new(const CfgLog *cl)
{
    struct stat st;
    int fd;
    char *realName;
    Logfile *curr;
    char *tmp, *baseName, *dirName;
    Logfile *self = NULL;
    Action *action = createActions(cl);

    if (!action)
    {
	/* a logfile without actions doesn't have to be watched */
	Daemon_printf_level(LEVEL_WARNING,
		"Ignoring `%s' without actions.", cfgLog_name(cl));
	return NULL;
    }

    /* calculate paths */
    tmp = lladCloneString(cfgLog_name(cl));
    baseName = basename(tmp);
    dirName = realpath(dirname(tmp), NULL);

    if (!dirName)
    {
	/* at least the directory has to exist */
	Daemon_printf_level(LEVEL_WARNING,
		"Can't get real directory of `%s': %s", tmp, strerror(errno));
	free(tmp);
	action_free(action);
	return NULL;
    }

    if (stat(dirName, &st) < 0)
    {
	/* and the directory has to be accessible */
	Daemon_printf_level(LEVEL_WARNING,
		"Could not stat `%s': %s", dirName, strerror(errno));
	free(dirName);
	free(tmp);
	action_free(action);
	return NULL;
    }

    if (!S_ISDIR(st.st_mode))
    {
	/* and it has to actually BE a directory */
	Daemon_printf_level(LEVEL_WARNING,
		"%s: Not a directory", dirName);
	free(dirName);
	free(tmp);
	action_free(action);
	return NULL;
    }

    /* determine canonical path name */
    realName = lladAlloc(strlen(dirName) + strlen(baseName) + 2);
    strcpy(realName, dirName);
    strcat(realName, "/");
    strcat(realName, baseName);

    /* check whether this logfile is already in the list */
    curr = firstLog;
    while (curr)
    {
	if (!strcmp(curr->name, realName))
	{
	    /* if it is, append actions there */
	    free(realName);
	    free(dirName);
	    free(tmp);
	    if (curr->first)
	    {
		action_append(curr->first, action);
	    }
	    else
	    {
		curr->first = action;
	    }
	    return NULL;
	}
	curr = curr->next;
    }

    /* otherwise, create new Logfile object */
    self = lladAlloc(sizeof(Logfile));
    self->name = realName;
    self->dirName = dirName;
    self->baseName = lladCloneString(baseName);
    free(tmp);
    self->file = NULL;

    /* try to open it directly for reading */
    if ((self->file = fopen(self->name, "r")))
    {
	fd = fileno(self->file);
	fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
	fseeko(self->file, 0L, SEEK_END);
    }
    else
    {
	/* it's ok if this isn't possible -- the directory should be watched
	 * and maybe we can open it later */
	Daemon_printf_level(LEVEL_NOTICE,
		"Could not open `%s': %s", self->name, strerror(errno));
    }

    self->next = NULL;
    self->first = action;
    return self;
}
Esempio n. 28
0
	SoundEntity::SoundEntity(EmberEntity& parentEntity)
	: mParentEntity(parentEntity), mCurrentMovementAction(0)
	{
		parentEntity.Acted.connect(sigc::mem_fun(*this, &SoundEntity::Entity_Action));
		createActions();
	}
Esempio n. 29
0
BitcoinGUI::BitcoinGUI(QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0)
{
    restoreWindowGeometry();
    setWindowTitle(tr("Quark") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Create wallet frame and make it the central widget
    walletFrame = new WalletFrame(this);
    setCentralWidget(walletFrame);

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    // Needs walletFrame to be initialized
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon();

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = QApplication::style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);
}
Esempio n. 30
0
BikeMenuBar::BikeMenuBar(QWidget* parent) : QMenuBar(parent)
{
  createActions();
  createMenus();
}