nextcloud-desktop/shell_integration/windows/OCUtil/RemotePathChecker.h
Jocelyn Turcotte bb5c370575 Windows: Update the overlay icon graphics #3105
The bug seems to be in Windows when it upscales an smaller icon for
HiDPI displays. It works fine if we provide a 256x256 size in the
ico files.

Use the new square icons also used on OS X that removes the share badge
and instead has a share icon only for the OK state. This means that we
can also remove 3 icons and release 3 slots in the registry for
overlay icons (only the first few are actually loaded by explorer).

This also adds a script that uses ImageMagick to convert our SVG icons
to Windows ico files. Since ImageMagick seems to have issue doing
proper antialiasing with pixels on the edge of icons, this also
slightly scale the icons to leave 2px on each edge, out of its
logical 128px width.
2016-01-12 11:46:05 +01:00

68 lines
No EOL
1.8 KiB
C++

/**
* Copyright (c) 2014 ownCloud, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; version 2.1 of the License
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
#ifndef PATHCHECKER_H
#define PATHCHECKER_H
#include <string>
#include <vector>
#include <unordered_map>
#include <queue>
#include <thread>
#include <mutex>
#include <atomic>
#include <condition_variable>
#pragma once
class __declspec(dllexport) RemotePathChecker {
public:
enum FileState {
// Order synced with OCOverlay
StateError = 0,
StateOk, StateOkSWM,
StateSync,
StateWarning,
StateNone
};
RemotePathChecker();
~RemotePathChecker();
std::vector<std::wstring> WatchedDirectories();
bool IsMonitoredPath(const wchar_t* filePath, int* state);
private:
FileState _StrToFileState(const std::wstring &str);
std::mutex _mutex;
std::atomic<bool> _stop;
// Everything here is protected by the _mutex
/** The list of paths we need to query. The main thread fill this, and the worker thread
* send that to the socket. */
std::queue<std::wstring> _pending;
std::unordered_map<std::wstring, FileState> _cache;
std::unordered_map<std::wstring, FileState> _oldCache;
std::vector<std::wstring> _watchedDirectories;
bool _connected;
// The main thread notifies when there are new items in _pending
//std::condition_variable _newQueries;
HANDLE _newQueries;
std::thread _thread;
void workerThreadLoop();
};
#endif