Exemplo n.º 1
0
void LaunchyWidget::executeStartupCommand(int command)
{
	if (command & ResetPosition)
	{
		QRect r = geometry();
		int primary = qApp->desktop()->primaryScreen();
		QRect scr = qApp->desktop()->availableGeometry(primary);

		QPoint pt(scr.width()/2 - r.width()/2, scr.height()/2 - r.height()/2);
		move(pt);
	}

	if (command & ResetSkin)
	{
		setOpaqueness(100);
		showTrayIcon();
		applySkin("Default");
	}

	if (command & ShowLaunchy)
		showLaunchy();

	if (command & ShowOptions)
		showOptionsDialog();

	if (command & Rescan)
		buildCatalog();

	if (command & Exit)
		close();
}
Exemplo n.º 2
0
static void createWindow(HINSTANCE instance) {
    iconActive = LoadIcon(instance, MAKEINTRESOURCE(IDR_MAINFRAME));
    iconKilled = LoadIcon(instance, MAKEINTRESOURCE(IDI_KILLED));

    WNDCLASS wc = {};
    wc.lpfnWndProc = windowProc;
    wc.hInstance = instance;
    wc.lpszClassName = L"WinKillClass";
    RegisterClass(&wc);

    mainWindow =
        CreateWindowEx(
            WS_EX_TOOLWINDOW,
            WINDOW_CLASS,
            TRAY_ICON_TIP,
            0,
            0, 0, 0, 0, /* dimens */
            nullptr,
            nullptr,
            instance,
            nullptr);

    SetWindowLong(mainWindow, GWL_STYLE, 0); /* removes title, borders. */

    SetWindowPos(
        mainWindow,
        nullptr,
        -32000, -32000, 50, 50,
        SWP_FRAMECHANGED | SWP_SHOWWINDOW);

    createTrayMenu();
    showTrayIcon();
}
Exemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    color_icon = false;

    loadDevices();
    showTrayIcon();
}
Exemplo n.º 4
0
Watcher::Watcher(QDialog *parent, QString path): QWidget(parent) {
    parentPointer = parent;
    watcher = new QFileSystemWatcher(this);
    setTrayIconActions();
    showTrayIcon();
    watcher->addPath(path);

    dir = new QDir(path);
    listOfFiles = dir->entryInfoList();
    oldListOfFiles = dir->entryInfoList();
    oldLength = listOfFiles.length();

    QObject::connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(checkChanges(const QString&)));
}
Exemplo n.º 5
0
static void createTrayMenu() {
    trayMenu = CreatePopupMenu();

    MENUITEMINFO menuItem = { 0 };
    menuItem.cbSize = sizeof(MENUITEMINFO);
    menuItem.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;

    AppendMenu(trayMenu, 0, MENU_ITEM_TOGGLE, MENU_ITEM_TOGGLE_CAPTION);
    AppendMenu(trayMenu, MF_SEPARATOR, MENU_ITEM_TOGGLE, L"-");
    AppendMenu(trayMenu, 0, MENU_ITEM_EXIT, MENU_ITEM_EXIT_CAPTION);

    //MyCommandLineInfo commandLine;
    //AfxGetApp()->ParseCommandLine(commandLine);
    //commandLine.startDisabled ? StopHook() : StartHook();

    showTrayIcon();
}
Exemplo n.º 6
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->setWindowTitle(APP_FRIENDLY_NAME);

    loadScreenPosition();

    showTrayIcon();
    configureContextMenu();

    connect(&findutils, SIGNAL(updatedb_finished()), this, SLOT(updatedb_finished()));
    connect(&findutils, SIGNAL(locate_finished(const QStringList &)), this, SLOT(locate_finished(const QStringList &)));
    connect(&findutils, SIGNAL(statistics_finished(QString)), this, SLOT(statistics_finished(QString)));

    updatedb();
}
Exemplo n.º 7
0
MainWindow::MainWindow(bool verbose, QWindow *parent) : QQuickView(parent) {

	connect(this, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(loadStatus(QQuickView::Status)));

#ifdef Q_OS_WIN
	QtWin::enableBlurBehindWindow(this);
#endif

	// Settings and variables
	settingsPerSession = new SettingsSession;
	settingsPermanent = new Settings;
	fileformats = new FileFormats(verbose);
	variables = new Variables;
	shortcuts = new Shortcuts;
	touch = new TouchHandler;

	variables->verbose = verbose;

	overrideCursorHowOftenSet = 0;

	this->setMinimumSize(QSize(800,600));

	// Add image providers
	this->engine()->addImageProvider("thumb",new ImageProviderThumbnail);
	this->engine()->addImageProvider("full",new ImageProviderFull);
	this->engine()->addImageProvider("icon",new ImageProviderIcon);

	// Add settings access to QML
	qmlRegisterType<Settings>("Settings", 1, 0, "Settings");
	qmlRegisterType<FileFormats>("FileFormats", 1, 0, "FileFormats");
	qmlRegisterType<SettingsSession>("SettingsSession", 1, 0, "SettingsSession");
	qmlRegisterType<GetMetaData>("GetMetaData", 1, 0, "GetMetaData");
	qmlRegisterType<GetAndDoStuff>("GetAndDoStuff", 1, 0, "GetAndDoStuff");
	qmlRegisterType<ThumbnailManagement>("ThumbnailManagement", 1, 0, "ThumbnailManagement");
	qmlRegisterType<ToolTip>("ToolTip", 1, 0, "ToolTip");
	qmlRegisterType<ShortcutsNotifier>("ShortcutsNotifier", 1, 0, "ShortcutsNotifier");
	qmlRegisterType<Colour>("Colour", 1, 0, "Colour");

	// Load QML
	this->setSource(QUrl("qrc:/qml/mainwindow.qml"));
	this->setColor(QColor(Qt::transparent));

	// Get object (for signals and stuff)
	object = this->rootObject();

	// Class to load a new directory
	loadDir = new LoadDir(verbose);

	// Scrolled view
	connect(object, SIGNAL(thumbScrolled(int)), this, SLOT(handleThumbnails(int)));


	connect(object, SIGNAL(reloadDirectory(QString,QString)), this, SLOT(handleOpenFileEvent(QString,QString)));
	connect(object, SIGNAL(loadMoreThumbnails()), this, SLOT(loadMoreThumbnails()));
	connect(object, SIGNAL(didntLoadThisThumbnail(int)), this, SLOT(didntLoadThisThumbnail(int)));
	connect(object, SIGNAL(setOverrideCursor()), this, SLOT(setOverrideCursor()));
	connect(object, SIGNAL(restoreOverrideCursor()), this, SLOT(restoreOverrideCursor()));
	connect(object, SIGNAL(stopThumbnails()), this, SLOT(stopThumbnails()));
	connect(object, SIGNAL(reloadThumbnails()), this, SLOT(reloadThumbnails()));

	connect(object, SIGNAL(verboseMessage(QString,QString)), this, SLOT(qmlVerboseMessage(QString,QString)));

	// Hide/Quit window
	connect(object, SIGNAL(hideToSystemTray()), this, SLOT(hideToSystemTray()));
	connect(object, SIGNAL(quitPhotoQt()), this, SLOT(quitPhotoQt()));

	// React to some settings...
	connect(settingsPermanent, SIGNAL(trayiconChanged(int)), this, SLOT(showTrayIcon()));
	connect(settingsPermanent, SIGNAL(trayiconChanged(int)), this, SLOT(hideTrayIcon()));
	connect(settingsPermanent, SIGNAL(windowmodeChanged(bool)), this, SLOT(updateWindowGeometry()));
	connect(settingsPermanent, SIGNAL(windowDecorationChanged(bool)), this, SLOT(updateWindowGeometry()));

	connect(this, SIGNAL(xChanged(int)), this, SLOT(updateWindowXandY()));
	connect(this, SIGNAL(yChanged(int)), this, SLOT(updateWindowXandY()));

	// Pass on touchevent
	connect(touch, SIGNAL(receivedTouchEvent(QPointF,QPointF,qint64,int,QStringList)), this, SLOT(passOnTouchEvent(QPointF,QPointF,qint64,int,QStringList)));
	connect(touch, SIGNAL(setImageInteractiveMode(bool)), this, SLOT(setImageInteractiveMode(bool)));

	showTrayIcon();

	// We need to call this with a little delay, as the automatic restoration of the window geometry at startup when window mode
	// is enabled doesn't update the actualy window x/y (and thus PhotoQt might be detected on the wrong screen which messes up
	// calculations involving local cursor coordinates (e.g., for 'close on click on grey'))
	QTimer::singleShot(100,this, SLOT(updateWindowXandY()));

}
Exemplo n.º 8
0
STDMETHODIMP_(LRESULT) TffdshowEnc::compress(const BITMAPINFOHEADER *inhdr, const uint8_t *src, size_t /*srclen*/, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
    if (firstrun) {
        firstrun = false;
        showTrayIcon();
    }

    _mm_empty();
    inColorspace = getBMPcolorspace(inhdr, coSettings->incsps);
    if (inColorspace == FF_CSP_NULL) {
        return ICERR_BADFORMAT;
    }
    if (coSettings->flip) {
        inColorspace ^= FF_CSP_FLAGS_VFLIP;
    }
    if (globalSettings->isDyInterlaced && dy > (unsigned int)globalSettings->dyInterlaced) {
        inColorspace |= FF_CSP_FLAGS_INTERLACED;
    }
    params.quant = -1;
    params.frametype = FRAME_TYPE::UNKNOWN;
    params.keyframe = false;
    switch (cfgcomode) {
        case ENC_MODE::CBR:
        case ENC_MODE::VBR_QUAL:
            break;
        case ENC_MODE::VBR_QUANT:
            params.quant = getQuantQuant();
            break;
        case ENC_MODE::UNKNOWN:
            break;
        default:
            DPRINTF(_l("Invalid encoding mode"));
            return ICERR_ERROR;
    }

    params.gray = !!coSettings->gray;

    //if (!src || !srclen) return ICERR_ERROR;

    if (pict.csp != inColorspace) {
        pict.csp = inColorspace;
        pict.cspInfo = *csp_getInfo(pict.csp);
    }
    pict.setSize(dx, dy);
    pict.data[0] = (unsigned char*)src;
    pict.stride[0] = dx * pict.cspInfo.Bpp;
    if (src) {
        csp_yuv_adj_to_plane(pict.csp, &pict.cspInfo, dy, pict.data, pict.stride);
        csp_yuv_order(pict.csp, pict.data, pict.stride);
        csp_vflip(pict.csp, &pict.cspInfo, pict.data, pict.stride, dy);
    }

    if (!coSettings->isProc || !ffproc) {
        bool directYV12 = false;
        for (Tcsps::const_iterator c = enccsps.begin(); c != enccsps.end(); c++)
            if (*c == pict.csp) {
                directYV12 = true;
                break;
            }
        if (!directYV12) {
            if (!convert) {
                convert = new Tconvert(this, dx, dy);
            }
            if (!ownpict.data[0]) {
                ownpict.alloc(dx, dy, enccsp, ownpictbuf);
            }
            if (src) {
                convert->convert(pict, ownpict.csp, ownpict.data, ownpict.stride);
            }
            //srclen=ownpict.cspInfo.bpp*ownpict.rectFull.dx*ownpict.rectFull.dy/8;
            pict = ownpict;
            if (!src) {
                pict.data[0] = NULL;
            }
        }
    }

    params.length = 0;
    params.priv = NULL;
    pict.rtStart = rtStart;
    pict.rtStop = rtStop;
    if (src && coSettings->isProc && ffproc) {
        HRESULT hr = ffproc->processPict(params.framenum, pict, enccsp);
        if (hr == S_OK) {
            hr = src ? enc->compress(pict, params) : enc->flushEnc(pict, params);
        }
        return hr;
    } else {
        return src ? enc->compress(pict, params) : enc->flushEnc(pict, params);
    }
}